From: "Shem Multinymous" <multinymous@gmail.com>
To: linux-thinkpad@linux-thinkpad.org,
LKML <linux-kernel@vger.kernel.org>,
linux-acpi@vger.kernel.org
Subject: Re: [ltp] Re: Generic battery interface
Date: Tue, 1 Aug 2006 01:45:27 +0300 [thread overview]
Message-ID: <41840b750607311545h72cd5b1dq730c35b084c43db7@mail.gmail.com> (raw)
In-Reply-To: <20060731183719.GB22081@creature.apm.etc.tu-bs.de>
Hi Michael,
Please do a Reply to All. I've restored the mailing list CCs.
On 7/31/06, Michael Olbrich <michael.olbrich@gmx.net> wrote:
> On Mon, Jul 31, 2006 at 06:18:12PM +0300, Shem Multinymous wrote:
> > On 7/31/06, Michael Olbrich <michael.olbrich@gmx.net> wrote:
> > >Hmmm, that looks good for most cases. But how would you handle
> > >starting/stoping laoding/draining the battery?
> > >That usually results in values jumping from/to 0. A gui would want to
> > >show such a change immediately while otherwise keeping a slow update
> > >rate. Maybe some kind of threshhold parameter? "send an input-ready
> > >immediatelly if the value changes by more than x%".
> >
> > Changes by more than x% compared to what?
> >
> > The value at the time of the ioctl()? This might completely miss a
> > change that happened between the previous read() and the ioctl().
> >
> > The value at the time of the last read()? Then the kernel
> > driver+infrastructure will need to keep track of the latest readout
> > done by each app. That's pretty heavy.
> >
> > So what semantics make sense?
>
> Well, the kernel is polling the hardware and caches the last value for
> O_NONBLOCKing anyway. So we already have two values to compare.
It's caching *one* value, not one value per polling app (i.e., opened file).
Also, if querying the hardware is very cheap, the driver is at freedom
to do that instead of caching.
> And keeping the latest readout for each app isn't that heavy. After all
> we already have to keep track of the timeouts for each app.
The timeouts bookkeeping will normally be done by some infrastructure,
and can often be (in principle) be optimized to less than on value per
app. Also, it's just one timestamp. By contrast, what you're asking
for requires explicit handling by every driver, and the attribute
value may take significant amount of storage -- per app.
> Another way to handle this:
> A lot of applications are interrested in changes. It would be perfectly
> reasonable for a poll() to block for over 1 minute while the value
> fluctuates with changes less than e.g. 1%. As soon as the change
> (compared to the last readout) exceds this threshhold poll() returns
> immediatelly. This could of course be combined with the proposed
> timeouts.
The app can do this itself by polling and checking the value, with a
(not too) small value of dupeq.min_wait. In the case of a
polling-based data source, the resulting hardware queries and timer
interrupts are exactly the same as an in-kernel implementation which
does the polling and comparions itself. If the data source is
event-based then the comparison in userspace does have a drawback: the
comparions are done just dupeq.min_wait apart even if the event rate
happens to be higher. Can you think of a case where this matters?
Shem
next prev parent reply other threads:[~2006-07-31 22:45 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-27 20:06 Brown, Len
2006-07-27 20:32 ` Shem Multinymous
2006-07-27 23:24 ` Vojtech Pavlik
2006-07-28 0:27 ` Shem Multinymous
2006-07-28 0:36 ` Matthew Garrett
2006-07-28 7:42 ` Vojtech Pavlik
2006-07-28 12:25 ` Pavel Machek
2006-07-28 13:43 ` Vojtech Pavlik
2006-07-28 15:38 ` Shem Multinymous
2006-07-28 15:57 ` Valdis.Kletnieks
2006-07-28 22:10 ` Shem Multinymous
2006-07-28 23:14 ` Valdis.Kletnieks
2006-07-29 9:48 ` Shem Multinymous
2006-07-29 10:17 ` Vojtech Pavlik
2006-07-29 10:30 ` Shem Multinymous
2006-07-29 10:37 ` Mark Underwood
2006-07-29 11:35 ` Shem Multinymous
2006-07-30 8:35 ` Valdis.Kletnieks
2006-07-30 11:44 ` Vojtech Pavlik
2006-07-30 11:48 ` Shem Multinymous
2006-07-31 0:58 ` Valdis.Kletnieks
2006-07-31 1:34 ` Shem Multinymous
2006-07-30 9:18 ` Pavel Machek
2006-07-30 10:14 ` Shem Multinymous
2006-07-30 11:33 ` Shem Multinymous
2006-07-28 12:25 ` Dmitry Torokhov
2006-07-28 13:44 ` Vojtech Pavlik
2006-07-28 15:19 ` Shem Multinymous
2006-07-28 16:10 ` Dmitry Torokhov
2006-07-30 8:55 ` Greg KH
2006-07-30 9:52 ` Shem Multinymous
2006-07-30 11:47 ` Vojtech Pavlik
2006-07-30 12:50 ` Shem Multinymous
2006-07-30 14:29 ` Tomasz Torcz
2006-07-30 14:48 ` Shem Multinymous
2006-07-30 11:46 ` Vojtech Pavlik
2006-07-28 15:14 ` Shem Multinymous
2006-07-28 20:23 ` Vojtech Pavlik
2006-07-28 22:48 ` Shem Multinymous
2006-07-28 23:17 ` Pavel Machek
2006-07-29 10:36 ` Vojtech Pavlik
2006-07-29 11:32 ` Shem Multinymous
2006-07-29 12:04 ` Vojtech Pavlik
2006-07-29 12:51 ` Shem Multinymous
2006-07-29 13:42 ` Vojtech Pavlik
2006-07-30 9:00 ` Greg KH
2006-07-29 21:06 ` Shem Multinymous
2006-07-30 10:05 ` Pavel Machek
2006-07-30 10:34 ` Shem Multinymous
2006-07-30 10:37 ` Pavel Machek
2006-07-30 18:37 ` Shem Multinymous
[not found] ` <20060731113735.GA22081@creature.apm.etc.tu-bs.de>
2006-07-31 15:18 ` [ltp] " Shem Multinymous
[not found] ` <20060731183719.GB22081@creature.apm.etc.tu-bs.de>
2006-07-31 22:45 ` Shem Multinymous [this message]
[not found] ` <20060801114303.GA13000@creature.apm.etc.tu-bs.de>
2006-08-02 21:59 ` Shem Multinymous
2006-07-31 21:35 ` Jean Delvare
2006-07-31 22:34 ` Shem Multinymous
2006-07-31 23:01 ` Pavel Machek
2006-08-02 7:18 ` Jean Delvare
2006-08-02 7:46 ` Marek Wawrzyczny
2006-08-03 11:29 ` Thomas Renninger
2006-08-03 16:33 ` Pavel Machek
2006-07-27 22:16 ` Pavel Machek
2006-07-27 22:56 ` Shem Multinymous
2006-07-27 23:08 ` Greg KH
2006-07-27 23:24 ` Pavel Machek
2006-07-30 12:29 ` Jean Delvare
2006-08-02 19:51 ` Pavel Machek
2006-08-03 9:20 ` Jean Delvare
2006-07-27 22:56 ` Greg KH
2006-07-27 23:31 ` Vojtech Pavlik
2006-07-28 0:35 ` Shem Multinymous
2006-07-28 10:11 ` Vojtech Pavlik
-- strict thread matches above, loose matches on Subject: below --
2006-07-27 0:20 Pavel Machek
2006-07-27 14:05 ` Matthew Garrett
2006-07-27 14:39 ` Shem Multinymous
2006-07-27 15:23 ` [ltp] " Henrique de Moraes Holschuh
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=41840b750607311545h72cd5b1dq730c35b084c43db7@mail.gmail.com \
--to=multinymous@gmail.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-thinkpad@linux-thinkpad.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
all inboxes | Powered by JetHome®