ALT Linux kernel packages development
 help / color / mirror / Atom feed
* [d-kernel] PATCH: acpi irq safe gendisk_lock
@ 2004-10-18 20:53 Konstantin A. Lepikhov
  2004-10-19 17:46 ` [d-kernel] " Konstantin A. Lepikhov
  0 siblings, 1 reply; 2+ messages in thread
From: Konstantin A. Lepikhov @ 2004-10-18 20:53 UTC (permalink / raw)
  To: ALT Linux Kernel Devel Mailing List

[-- Attachment #1: Type: text/plain, Size: 299 bytes --]

Здравствуйте!

МБ этот патчик в -fix-acpi? Найден в логах BK.

-- 
WBR, Konstantin	      chat with ==>ICQ: 109916175
     Lepikhov,	      speak  to ==>JID: lakostis@jabber.org
aka L.A. Kostis       write  to ==>mailto:lakostis@pisem.net.nospam

...The information is like the bank... 			  (c) EC8OR

[-- Attachment #2: acpi_irq_safe.patch --]
[-- Type: text/plain, Size: 3344 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/09/29 13:56:57-03:00 axboe@suse.de 
#   [PATCH] irq safe gendisk_lock
#   
#   Hi,
#   
#   There's a problem with gendisk_lock in 2.4 right now - it never disables
#   interrupts, but io completion stat updates can grab the lock from
#   end_that_request_last -> req_finished_io -> locate_hd_struct ->
#   get_gendisk. So make the lock irq safe so we don't risk deadlocking with
#   eg people doing add_gendisk(). This race has been seen and traced in
#   real life.
#   
#   ===== drivers/block/genhd.c 1.26 vs edited =====
#   TAG: MailDone
# 
# drivers/block/genhd.c
#   2004/09/29 04:00:23-03:00 axboe@suse.de +14 -10
#   irq safe gendisk_lock
# 
# arch/i386/kernel/acpi.c
#   2004/09/14 17:27:58-03:00 ha505@hszk.bme.hu +2 -0
#   [i386] acpi.c: implicit declaration of mp_irqs_alloc()
# 
diff -Nru a/arch/i386/kernel/acpi.c b/arch/i386/kernel/acpi.c
--- a/arch/i386/kernel/acpi.c	2004-09-29 12:03:30 -07:00
+++ b/arch/i386/kernel/acpi.c	2004-09-29 12:03:30 -07:00
@@ -389,6 +389,8 @@
 }
 
 
+extern int mp_irqs_alloc(void);
+
 /*
  * acpi_boot_init()
  *  called from setup_arch(), always.
diff -Nru a/drivers/block/genhd.c b/drivers/block/genhd.c
--- a/drivers/block/genhd.c	2004-09-29 12:03:30 -07:00
+++ b/drivers/block/genhd.c	2004-09-29 12:03:30 -07:00
@@ -49,8 +49,9 @@
 add_gendisk(struct gendisk *gp)
 {
 	struct gendisk *sgp;
+	unsigned long flags;
 
-	write_lock(&gendisk_lock);
+	write_lock_irqsave(&gendisk_lock, flags);
 
 	/*
  	 *	In 2.5 this will go away. Fix the drivers who rely on
@@ -70,7 +71,7 @@
 	gp->next = gendisk_head;
 	gendisk_head = gp;
 out:
-	write_unlock(&gendisk_lock);
+	write_unlock_irqrestore(&gendisk_lock, flags);
 }
 
 EXPORT_SYMBOL(add_gendisk);
@@ -87,15 +88,16 @@
 del_gendisk(struct gendisk *gp)
 {
 	struct gendisk **gpp;
+	unsigned long flags;
 
-	write_lock(&gendisk_lock);
+	write_lock_irqsave(&gendisk_lock, flags);
 	gendisk_array[gp->major] = NULL;
 	for (gpp = &gendisk_head; *gpp; gpp = &((*gpp)->next))
 		if (*gpp == gp)
 			break;
 	if (*gpp)
 		*gpp = (*gpp)->next;
-	write_unlock(&gendisk_lock);
+	write_unlock_irqrestore(&gendisk_lock, flags);
 }
 
 EXPORT_SYMBOL(del_gendisk);
@@ -113,8 +115,9 @@
 {
 	struct gendisk *gp = NULL;
 	int maj = MAJOR(dev);
+	unsigned long flags;
 
-	read_lock(&gendisk_lock);
+	read_lock_irqsave(&gendisk_lock, flags);
 	if ((gp = gendisk_array[maj]))
 		goto out;
 
@@ -123,7 +126,7 @@
 		if (gp->major == maj)
 			break;
 out:
-	read_unlock(&gendisk_lock);
+	read_unlock_irqrestore(&gendisk_lock, flags);
 	return gp;
 }
 
@@ -143,12 +146,13 @@
 {
 	struct gendisk *gp;
 	int error = 0;
+	unsigned long flags;
 
-	read_lock(&gendisk_lock);
+	read_lock_irqsave(&gendisk_lock, flags);
 	for (gp = gendisk_head; gp; gp = gp->next)
 		if ((error = walk(gp, data)))
 			break;
-	read_unlock(&gendisk_lock);
+	read_unlock_irqrestore(&gendisk_lock, flags);
 
 	return error;
 }
@@ -160,7 +164,7 @@
 	struct gendisk *gp;
 	loff_t pos = *ppos;
 
-	read_lock(&gendisk_lock);
+	read_lock_irq(&gendisk_lock);
 	for (gp = gendisk_head; gp; gp = gp->next)
 		if (!pos--)
 			return gp;
@@ -175,7 +179,7 @@
 
 static void part_stop(struct seq_file *s, void *v)
 {
-	read_unlock(&gendisk_lock);
+	read_unlock_irq(&gendisk_lock);
 }
 
 static int part_show(struct seq_file *s, void *v)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [d-kernel] Re: PATCH: acpi irq safe gendisk_lock
  2004-10-18 20:53 [d-kernel] PATCH: acpi irq safe gendisk_lock Konstantin A. Lepikhov
@ 2004-10-19 17:46 ` Konstantin A. Lepikhov
  0 siblings, 0 replies; 2+ messages in thread
From: Konstantin A. Lepikhov @ 2004-10-19 17:46 UTC (permalink / raw)
  To: ALT Linux kernel packages development

Hi!

Tuesday 19, at 12:53:52 AM you wrote:

> Здравствуйте!
> 
> МБ этот патчик в -fix-acpi? Найден в логах BK.
nevermind. Это меня ночью уже колбасило. В лучшем случае, тут 2 патча -
один косметический (для acpi), и один для -fix-block.

-- 
WBR, Konstantin	      chat with ==>ICQ: 109916175
     Lepikhov,	      speak  to ==>JID: lakostis@jabber.org
aka L.A. Kostis       write  to ==>mailto:lakostis@pisem.net.nospam

...The information is like the bank... 			  (c) EC8OR


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-10-19 17:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-18 20:53 [d-kernel] PATCH: acpi irq safe gendisk_lock Konstantin A. Lepikhov
2004-10-19 17:46 ` [d-kernel] " Konstantin A. Lepikhov

ALT Linux kernel packages development

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel-kernel/0 devel-kernel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel-kernel devel-kernel/ http://lore.altlinux.org/devel-kernel \
		devel-kernel@altlinux.org devel-kernel@altlinux.ru devel-kernel@altlinux.com
	public-inbox-index devel-kernel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git