From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel mailing list <linux-kernel@vger.kernel.org>,
Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Subject: [PATCH] IDE: Fix Power Management request race on resume
Date: Tue, 09 Sep 2003 20:39:20 +0200 [thread overview]
Message-ID: <1063132760.642.15.camel@gaston> (raw)
Hi Linus !
The current IDE Power Management code I wrote has a race on wakeup
when the master device got resumed, it may take a request. At this
point, a PM resume request to a slave device of the same hwgroup
would clear hwgroup->rq and cause an Oops when the master device
request completes.
This patch fixes it. Due to the context in which PM resume requests
are sent, just not clearing hwgroup->rq for these is enough.
Please apply, this patch was already tested & discussed with Bart.
I also removed a useless debug message in the PM code that was
actually misleading (people though it indicated a problem while it
didn't, it's really useless) and fix a typo in a comment.
Cheers,
Ben.
diff -urN linux-2.5/drivers/ide/ide-io.c linuxppc-2.5-benh/drivers/ide/ide-io.c
--- linux-2.5/drivers/ide/ide-io.c 2003-09-09 20:15:34.000000000 +0200
+++ linuxppc-2.5-benh/drivers/ide/ide-io.c 2003-09-09 20:31:23.000000000 +0200
@@ -928,13 +928,10 @@
*
* We let requests forced at head of queue with ide-preempt
* though. I hope that doesn't happen too much, hopefully not
- * unless the subdriver triggers such a thing in it's own PM
+ * unless the subdriver triggers such a thing in its own PM
* state machine.
*/
if (drive->blocked && !blk_pm_request(rq) && !(rq->flags & REQ_PREEMPT)) {
-#ifdef DEBUG_PM
- printk("%s: a request made it's way while we are power managing...\n", drive->name);
-#endif
/* We clear busy, there should be no pending ATA command at this point. */
hwgroup->busy = 0;
break;
@@ -1417,8 +1414,9 @@
}
spin_lock_irqsave(&ide_lock, flags);
- if (action == ide_preempt || action == ide_head_wait) {
+ if (action == ide_preempt)
hwgroup->rq = NULL;
+ if (action == ide_preempt || action == ide_head_wait) {
where = ELEVATOR_INSERT_FRONT;
rq->flags |= REQ_PREEMPT;
}
next reply other threads:[~2003-09-09 18:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-09 18:39 Benjamin Herrenschmidt [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-09-10 9:04 [PATCH] IDE: Fix Power Management request race on resume cb-lkml
2003-09-10 9:16 ` Benjamin Herrenschmidt
2003-09-10 9:25 ` cb-lkml
2003-09-10 9:30 ` Benjamin Herrenschmidt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1063132760.642.15.camel@gaston \
--to=benh@kernel.crashing.org \
--cc=B.Zolnierkiewicz@elka.pw.edu.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox