From: Linus Torvalds <torvalds@osdl.org>
To: "Richard B. Johnson" <root@chaos.analogic.com>
Cc: David Dillow <dave@thedillows.org>,
Bill Davidsen <davidsen@tmr.com>,
Roland Dreier <roland@topspin.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: poll() in 2.6 and beyond
Date: Wed, 3 Mar 2004 14:25:52 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.58.0403031419280.3000@ppc970.osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.53.0403031313270.12900@chaos>
On Wed, 3 Mar 2004, Richard B. Johnson wrote:
>
> are being quashed by those who just like to argue. Therefore,
> I wrote some code that emulates the environment in which I
> discovered the poll failure.
No. I think you wrote some code that shows the bug you have.
Your "poll()" function IS BUGGY.
Look at this:
static size_t poll(struct file *fp, struct poll_table_struct *wait)
{
size_t poll_flag;
size_t flags;
DEB(printk(KERN_INFO"%s : poll() called\n", devname));
poll_wait(fp, &pwait, wait);
DEB(printk(KERN_INFO"%s : poll() returned\n", devname));
spin_lock_irqsave(&rtc_lock, flags);
poll_flag = global_poll_flag;
*** global_poll_flag = 0;
spin_unlock_irqrestore(&rtc_lock, flags);
return poll_flag;
}
you are clearing your own flag that says "there are events pending", so if
you call your "poll()" function twice, on the second time it will say
"there are no events pending".
You should clear the "events pending" flag only when you literally remove
the event (ie at "read()" time, not at "poll()" time). Because the
select() code _will_ call down to the "poll()" functions multiple times if
it gets woken up for any bogus reason.
See if that fixes anything.
It may well be that 2.6.x calls down to the low-level driver "poll()"
function more than it should. That would be a mis-feature, and worth
looking at, but I think you should try to fix your test first, since right
now the bug is questionable.
Linus
next prev parent reply other threads:[~2004-03-03 22:20 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1vmPm-4lU-11@gated-at.bofh.it>
[not found] ` <1vonq-6dr-37@gated-at.bofh.it>
[not found] ` <1voGY-6vC-41@gated-at.bofh.it>
[not found] ` <1vpjt-7dl-17@gated-at.bofh.it>
[not found] ` <1vpCV-7wY-41@gated-at.bofh.it>
[not found] ` <1vpWa-7Py-19@gated-at.bofh.it>
2004-03-02 22:53 ` Bill Davidsen
2004-03-02 22:57 ` Roland Dreier
2004-03-02 23:32 ` Richard B. Johnson
2004-03-03 0:07 ` John Muir
2004-03-03 1:18 ` Richard B. Johnson
2004-03-03 4:04 ` Roland Dreier
2004-03-03 12:38 ` Richard B. Johnson
2004-03-03 14:29 ` Davide Libenzi
2004-03-03 3:57 ` David Dillow
2004-03-03 18:23 ` Richard B. Johnson
2004-03-03 19:29 ` Dave Dillow
2004-03-03 20:10 ` Richard B. Johnson
2004-03-03 22:25 ` Linus Torvalds [this message]
2004-03-03 22:42 ` Richard B. Johnson
2004-03-03 23:14 ` Linus Torvalds
2004-03-03 22:52 ` Linus Torvalds
2004-03-03 23:07 ` Richard B. Johnson
2004-03-03 3:06 linux
-- strict thread matches above, loose matches on Subject: below --
2004-03-02 18:21 Richard B. Johnson
2004-03-02 20:04 ` Roland Dreier
2004-03-02 20:24 ` Richard B. Johnson
2004-03-02 21:00 ` Roland Dreier
2004-03-02 21:26 ` Richard B. Johnson
2004-03-02 21:39 ` Roland Dreier
2004-03-02 21:59 ` Richard B. Johnson
2004-03-02 22:41 ` Dave Dillow
2004-03-02 22:56 ` Roland Dreier
2004-03-02 23:16 ` Richard B. Johnson
2004-03-02 23:21 ` Roland Dreier
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=Pine.LNX.4.58.0403031419280.3000@ppc970.osdl.org \
--to=torvalds@osdl.org \
--cc=dave@thedillows.org \
--cc=davidsen@tmr.com \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@topspin.com \
--cc=root@chaos.analogic.com \
/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
all inboxes | Powered by JetHome®