From: Thomas Hood <jdthood@mail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: apm suspend broken ?
Date: 30 Oct 2001 23:05:01 -0500 [thread overview]
Message-ID: <1004501103.4367.172.camel@thanatos> (raw)
Following up on my earlier message.
On my machine, lsof reveals that apmd and X both open
/dev/apm_bios with O_RDWR flags; also, reading the source
of libapm reveals that it too opens with O_RDWR;
so none of these should see any change in the behavior
of the apm driver.
Nevertheless, the two-line patch given below needs to be
applied in order to prevent the problem I described before.
I'm running a kernel with the patch applied now and it
works fine.
--
Thomas
--- original message ---
The apm driver was changed so that clients who open
the apm device without the write flag won't be expected
to return standby or suspend events; and clients who
open the apm device without the read flag won't be
notified of apm events.
For consistency, clients without the write flag should
not be able to request standbys or suspends. Thus
this patch seems required:
--- linux-2.4.13-ac2/arch/i386/kernel/apm.c Mon Oct 22 09:22:38 2001
+++ linux-2.4.13-ac2-fix/arch/i386/kernel/apm.c Tue Oct 30 10:29:41 2001
@@ -1473,6 +1473,8 @@
return -EIO;
if (!as->suser)
return -EPERM;
+ if (!as->writer)
+ return -EPERM;
switch (cmd) {
case APM_IOC_STANDBY:
if (as->standbys_read > 0) {
Applying this patch may solve your problem.
Scenario: You have a client that is opening the apm
device O_RDONLY, yet has been acking standby events
back to the apm driver. Formerly the driver would
ignore the lack of write permission, but now, since
the client does not have write permission, the driver
does not count the standby event that it sends to the
client as "pending". So when the client acks the
event, it looks to the driver like a new request.
Without the above patch, the driver will process this
request, dutifully queueing it to the other clients.
If there is more than one client of this kind, then
an infinite series of standby requests will result.
The patch should prevent that from happening.
However, if there are apm clients that expect the
driver to inform them of standby and suspend events
and to wait for an ack before going ahead with the
standby or suspend, then such clients should be
modified to open the apm device O_RDWR. So long
as such a client opens the apm device O_RDONLY,
the driver will not wait for it to reply and
(patched with the above) will reject its reply
when it comes.
The changelog at the top of apm.c cites me as the
originator of the idea behind the change. The
motivation was to eliminate queue overflows for
clients that aren't interested in the events and
don't read them. The idea of not waiting for
feedback from clients without write perm seems
like a good one too, since some clients might
just want to hear about events, not generate or
ack them. However this does constitute an API
change, so either (1) we should disable the
change until 2.5, or (2) we should check that
clients such as apmd are opening the apm device
with O_RDWR.
--
Thomas Hood
next reply other threads:[~2001-10-31 4:05 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-31 4:05 Thomas Hood [this message]
-- strict thread matches above, loose matches on Subject: below --
2001-11-29 19:59 apm suspend broken ? Thomas Hood
2001-11-02 12:38 Thomas Hood
2001-10-30 16:18 Thomas Hood
2001-10-31 14:28 ` Stephen Rothwell
2001-10-30 16:04 Thomas Hood
2001-10-30 15:58 Thomas Hood
2001-10-30 10:55 Pascal Lengard
2001-10-30 11:43 ` Samuli Suonpaa
2001-10-30 12:10 ` Alan Cox
2001-10-31 1:27 ` Pascal Lengard
2001-10-31 11:08 ` Alan Cox
2001-10-31 14:51 ` Stephen Rothwell
2001-11-02 8:31 ` Pascal Lengard
2001-11-29 18:50 ` Pascal Lengard
2001-11-15 17:43 ` Samuli Suonpaa
2001-11-15 17:58 ` 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=1004501103.4367.172.camel@thanatos \
--to=jdthood@mail.com \
--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