public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: John Fremlin <chief@bandits.org>
To: <linux-kernel@vger.kernel.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Racing power management
Date: 07 Mar 2001 21:13:11 +0000	[thread overview]
Message-ID: <m2hf15th94.fsf_-_@boreas.yi.org.> (raw)
In-Reply-To: <9038100.983917051702.JavaMail.imail@digger.excite.com> <m2vgpltkrh.fsf@boreas.yi.org.> <3AA6951B.45FDBC1B@mandrakesoft.com>
In-Reply-To: Jeff Garzik's message of "Wed, 07 Mar 2001 15:07:55 -0500"

 Jeff Garzik <jgarzik@mandrakesoft.com> writes:

> John Fremlin wrote:
> > Why not set up the device driver to handle PM events itself. See
> > Documentation/pm.txt under Driver Interface.
> 
> For PCI drivers, you implement the ::suspend and ::remove hooks.
> 
> > I have a race free version of pm_send_all if you want it.
> 
> Is this the same thing that is in 2.4.3-pre3?

Aarrgh. Looks like Alan Cox got his version in kernel first. (I did
write mine before.)

If I am not mistaken there is one (hypothetical) race still remaining
in Alan's version. Last time I checked the only code doing pm_send_all
was in the i386 APM driver (and so of course there is no chance of any
race at all even with the old version, if I understand correctly).

But suppose there were another pm_send_all caller. APM would decide to
user suspend and call pm_send_all asking for a SUSPEND to check it was
allowed to. While this is happening some clueless loser decides to
pm_send_all RESUME for whatever reason. This loser has to wait until
the APM pm_send_all finishes, but hypothetically and if I am not
mistaken, his pm_send_all RESUME could get in just after the APM
pm_send_all finished and just before APM made the physical BIOS call
to suspend the machine. This would screw stuff up of course.

You may say, this is rather improbable if not impossible, but it does
suggest that it would be a good idea to have locking wrapping
pm_send_all and the hardware machine suspend request. Cue: John's
pmpolicy patch.

Unfortunately, my patch adds another thing as well: /sbin/powermanager
so it got (is getting) trampled on by a lot of people who didn't like
that idea. If anybody wants the race free PM by itself, I can factor
out that bit.

-- 

	http://www.penguinpowered.com/~vii

  reply	other threads:[~2001-03-07 21:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-06 22:17 Forcible removal of modules Thomas Hood
2001-03-07  1:58 ` Keith Owens
2001-03-07 19:57 ` John Fremlin
2001-03-07 20:07   ` Jeff Garzik
2001-03-07 21:13     ` John Fremlin [this message]
2001-03-07 22:42     ` Alan Cox

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=m2hf15th94.fsf_-_@boreas.yi.org. \
    --to=chief@bandits.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.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