mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Sylvain Goletto" <sygoletto@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: HPET behavior and one-shot timer
Date: Sat, 9 Dec 2006 15:25:39 +0100	[thread overview]
Message-ID: <6c64c0b90612090625k473f09f7uebd56bacfcb6ed38@mail.gmail.com> (raw)

Hello all,

I am trying to use one-shot timers with the HPET as described in the
Intel specs (http://www.intel.com/hardwaredesign/hpetspec_1.pdf).
The linux hpet driver (2.6.17.13) has no API to do that (only periodic
timers at that time) an I am looking for the best way to add this
possibility to the kernel.

At this time I have developed a module that uses
hpet_register/hpet_control to get a hpet timer and uses hpet registers
to set a one-shot timer and wait for the interrupt.
My tests gave strange results : the interrupt comes as soon as I set
the interrupt enable bit for the timer.

So I made other tests with the original driver (kernel 2.6.17.13) and
the demo code in Documentation/hpet.txt and here is what I get: the
behavior is different between the first time I launch the test and the
others.
The following hpet_test polls for 2 interrupt and the frequency is set
to 1Hz so the expired time should be around 1000000us but it is only
true for the first time I use the timer after a fresh boot :

First run after fresh boot :

[HPET]# ./hpet_test poll /dev/hpet 1 2
-hpet: executing poll
hpet_poll: expired time = 1000008     <=== 1s, good
hpet_poll: revents = 1
hpet_poll: data 0x1
hpet_poll: expired time = 999997     <=== 1s, good
hpet_poll: revents = 1
hpet_poll: data 0x1

Second run :

[HPET]# ./hpet_test poll /dev/hpet 1 2
-hpet: executing poll
hpet_poll: expired time = 2     <=== 2us, BAD !!!
hpet_poll: revents = 1
hpet_poll: data 0x1
hpet_poll: expired time = 999992     <=== 1s, good
hpet_poll: revents = 1
hpet_poll: data 0x1

As you can see, the first run gives 1s for expiration time for the all
IT, but all other runs give 2/3 us for first IT !!!
If I want to reproduce, I have to reboot.

Is this the normal behavior ?
It looks like something (driver value, hpet register, ...) is not
re-set to the initial parameters.

I am trying to find what's wrong in the hpet.c file but I can't figure
out at the moment.

I also want to add aperiodic/one-shot interrupt possibility to the
driver so the the user can tell the hpet timer to send one IT in XXX
us from now or from a timeval parameter. But this will only be
possible if the previous problem is solved. I have a working module
the sets the comparator register with the right value for but the
interrupt fires immediately so it is unusable at the time.

Thank you in advance for the help.

- Sylvain

                 reply	other threads:[~2006-12-09 14:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=6c64c0b90612090625k473f09f7uebd56bacfcb6ed38@mail.gmail.com \
    --to=sygoletto@gmail.com \
    --cc=linux-kernel@vger.kernel.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®