All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Manfred Spraul" <manfred@colorfullife.com>
To: <root@chaos.analogic.com>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: Behavior of poll() within a module
Date: Tue, 23 Oct 2001 20:02:42 +0200	[thread overview]
Message-ID: <002601c15bec$ea4ed950$010411ac@local> (raw)
In-Reply-To: <Pine.LNX.3.95.1011023124944.14694A-100000@chaos.analogic.com>

From: "Richard B. Johnson" <root@chaos.analogic.com>
> 
> In this module, there isn't any read() or write() event that can
> clear the poll mask. Instead, the sole purpose of poll is to tell
> the user-mode caller that there is new status available as a result
> of an interrupt. This is a module that controls a motor. It runs
> <forever> on its own. It gets new parameters via an ioctl(). It
> reports exceptions (like overload conditions) using the poll
> mechanism.
> 
> The caller reads the cached status via an ioctl(). Any caller sleeping
> in poll must be awakened as a result of the interrupt event. Any caller
> can read the cached status at any time. If this was allowed to
> clear the poll mask, only one caller would be awakened. 
>
Ugh.
->poll must never change any state. The kernel is free to call poll
multiple times (common are once, twice and three times).

Can you use a per-filp pollmask?
* remove poll_active
* remove poll_mask
* add event counters for every possible event.
    poll_count_POLLIN, poll_count_POLLOUT, etc.
* interrupt handler increases the counter.
* ioctl() copies the value of the counters into
    filp->private_data->event_handled_POLL{IN,OUT}
* poll sets the pollmask if
    filp->private_data->event_seen != info->poll_count

If filps (file descriptors) are shared between apps, then I have no
idea how to fix your design.

--
    Manfred


  reply	other threads:[~2001-10-23 18:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-23 15:58 Behavior of poll() within a module Manfred Spraul
2001-10-23 17:17 ` Richard B. Johnson
2001-10-23 18:02   ` Manfred Spraul [this message]
2001-10-23 18:16     ` Richard B. Johnson
  -- strict thread matches above, loose matches on Subject: below --
2001-10-23 12:53 Richard B. Johnson
2001-10-23 13:33 ` Mike Jagdis
2001-10-23 14:13   ` Richard B. Johnson
2001-10-24  9:52     ` Mike Jagdis

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='002601c15bec$ea4ed950$010411ac@local' \
    --to=manfred@colorfullife.com \
    --cc=linux-kernel@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.