From: Dimitri Gorokhovik <dimitri.gorokhovik@leacom.fr>
To: Clemens Ladisch <clemens@ladisch.de>
Cc: tglx@linutronix.de, linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [RFC][PATCH] HPET: register additional counter-only char device
Date: Fri, 11 Apr 2008 16:06:50 +0200 [thread overview]
Message-ID: <1207922810.26014.33.camel@laphroaig> (raw)
In-Reply-To: <47FF658E.2040808@ladisch.de>
On Fri, 2008-04-11 at 15:20 +0200, Clemens Ladisch wrote:
> Dimitri Gorokhovik wrote:
> > I need to have many processes all reading from userspace the counter register
> > of the (same) HPET hardware. Just reading counter values, not handling timers,
> > enabling/disabling interrupts etc. `/dev/hpet' doesn't allow for this, as the
> > number of times it can be opened is limited by the number of timers available.
>
> Indeed. The driver assumes that userspace wants to program its own
> timer (like an RTC device). Allowing mmap() on the hardware counter was
> more an afterthought.
>
> > What would be the right way to implement such a support? For now, I simply
> > register a new misc device, '/dev/hpetctr', along with '/dev/hpet', for the same
> > ACPI device and on the same occasion.
>
> Your patch circumvents CONFIG_HPET_MMAP.
Right. I hesitated to put it in, but multiple #ifdef/endif clutter too
much the resulting code. Something better should be devised in this
case, like separating the added code into another file, changing a
couple of symbols from static to extern etc.
However, why people wanted the original 'mmap' of /dev/hpet to be
disabled? Probably to prevent the HPET registers from poking with? Gain
in code size is too small, can't think it was the primary reason. If so,
isn't having a read-only mapping enough in itself?
> Another possibility would be to allow the device to be opened
> infinitely many times but not to allocate a hardware timer until one of
> the ioctls is called. This means that opening /dev/hpet does not
> guarantee that a timer is available, but this has already been possible
> previously because request_irq() might fail.
Good point. The patch would be much more intrusive and voluminous (and
coming from a total newcomer). Would there be an interest for such a
patch? If yes, I might find some time to spend on it.
I did try to figure out the cleanest way by myself before posting, and I
couldn't mix and match several points about HPET:
-- /dev/hpet can only be opened with O_RDONLY, but for fiddling with
interrupts IMO write perms suit much better. One could imagine opening
lots of instances under O_RDONLY. Obviously, this way is doomed now
because of legacy apps.
-- to me, /dev/hpet is primarily a timer, not just a counter. It seems
wrong to me if it, once opened, would mostly fail to its primary
function (but this of course is all subjective matter).
Thanks for your comments!
>
>
> Regards,
> Clemens
next prev parent reply other threads:[~2008-04-11 14:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-11 8:58 [RFC][PATCH] HPET: register additional counter-only char device Dimitri Gorokhovik
2008-04-11 13:20 ` Clemens Ladisch
2008-04-11 14:06 ` Dimitri Gorokhovik [this message]
2008-04-11 15:57 ` Clemens Ladisch
2008-04-13 14:40 ` Dimitri Gorokhovik
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=1207922810.26014.33.camel@laphroaig \
--to=dimitri.gorokhovik@leacom.fr \
--cc=clemens@ladisch.de \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/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