From: Clemens Ladisch <clemens@ladisch.de>
To: Magnus Lynch <maglyx@gmail.com>
Cc: venkatesh.pallipadi@intel.com, vojtech@suse.cz, bob.picco@hp.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hpet: factor timer allocate from open
Date: Mon, 01 Mar 2010 10:59:58 +0100 [thread overview]
Message-ID: <4B8B901E.4050302@ladisch.de> (raw)
In-Reply-To: <be233a491002282130m3c637cfbw6648a77548241a64@mail.gmail.com>
Magnus Lynch wrote:
> The current implementation of the /dev/hpet driver couples opening the
> device with allocating one of the (scarce) timers (aka comparators).
> This is a limitation in that the main counter may be valuable to
> applications seeking a high-resolution timer who have no use for the
> interrupt generating functionality of the comparators.
>
> This patch alters the open semantics so that when the device is
> opened, no timer is allocated. Operations that depend on a timer being
> in context implicitly attempt allocating a timer, to maintain backward
> compatibility.
Many thanks; I had planned to do something like this, but never found
the time.
> I also have changes for adding IOCTLs to get the main counter
> value--which is more straightforward than mmaping and reading the
> registers directly, and possibly necessary if mmap is ifdef'd
> away--but have separated that logically into another patch.
This driver was written before the high-resolution timer API was
available, so the only actual use case, besides backwards compatibility,
is the ability to read the timer register directly without a syscall.
A ioctl to read the main counter would just duplicate clock_gettime(),
but I cannot see any benefit over that.
> diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
Your mailer killed tabs and wrapped lines.
> @@ -438,6 +469,17 @@ hpet_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
> {
> struct hpet_dev *devp;
>
> + switch (cmd) {
> + case HPET_INFO:
> + break;
> + default:
> + {
> + int r = hpet_alloc_timer(file);
Applications might want to use HPET_INFO to find out which timer they
got, so I think the driver cannot avoid allocating a timer in this case.
Regards,
Clemens
next prev parent reply other threads:[~2010-03-01 10:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-01 5:30 [PATCH] hpet: factor timer allocate from open Magnus Lynch
2010-03-01 9:59 ` Clemens Ladisch [this message]
2010-03-01 20:24 ` Magnus Lynch
2010-03-01 20:59 ` john stultz
2010-03-03 9:07 ` Magnus Lynch
2010-03-03 16:26 ` john stultz
2010-03-10 2:47 ` Magnus Lynch
2010-03-04 2:59 ` Magnus Lynch
2010-03-04 8:43 ` Clemens Ladisch
2010-03-08 0:04 ` Magnus Lynch
2010-03-16 16:01 ` Clemens Ladisch
2010-03-18 19:11 ` Andrew Morton
2010-03-19 4:06 ` Magnus Lynch
2010-03-22 22:21 ` Andrew Morton
2010-03-23 2:02 ` Magnus Lynch
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=4B8B901E.4050302@ladisch.de \
--to=clemens@ladisch.de \
--cc=bob.picco@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maglyx@gmail.com \
--cc=venkatesh.pallipadi@intel.com \
--cc=vojtech@suse.cz \
/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