# Hpet?

## thom_raindog

Howdie,

I found that HPET is disabled in my bios.

Now, I did find what those letters stand for, but that is about it.

Questions:

What does it really do?

Do I want it enabled? (the above question will most likely solve that)

What do I do kernelwise to really make use of HPET?

Thanks already.

----------

## kernelhacker

 *thom_raindog wrote:*   

> Howdie,
> 
> I found that HPET is disabled in my bios.
> 
> Now, I did find what those letters stand for, but that is about it.
> ...

 

The HPET is a "High Precision Event TImer", which is a lot better than the old RTC (real time clock). As it is a lot more precise than the old RTC it can be used to synchronize mediastreams etc. As the CPUs became faster and faster it was just a question of time, when a faster / more precise timer would have been invented.

Some information can be found here: [url] http://en.wikipedia.org/wiki/HPET [/url]

hth,

Stefan

----------

## energyman76b

you should really turn it on. If you have the right kernel options set, you don't need to do anything. But a lot of stuff needs a timesource.

TSC doesn't work anymore and pm-timer and rtc are very slow. HPET is a lot faster.

It is just stupid that their are mainboards delivered with hpet turned off.

----------

## depontius

Just to add to that... Since somewhere early in 2.6.2x, we've had the option of "tickless" kernels.  With the old-style timer-tick based kernel, an idle system might spend most of it's time servicing timer ticks, and waiting for you to hit a key.  With a tickless kernel, when there's nothing to be done, the CPU simply halts until an interrupt starts it up, again.  On a laptop every bit of power savings helps, and it's getting to be worth trying to save the power on desktops and servers.  At the moment, the tickless kernel works best with the HPET.

Ironically the tickless kernel was developed for the big iron, where you might have thousands of Linux VM instances running on a mainframe.  If many of those instances were doing nothing but servicing timer ticks, it added up to a fair system load, just to do nothing.  The tickless kernel cut the idle VM load to practically nothing.  Then the laptop people got hold of it, and got excited about extending battery life.

----------

## thom_raindog

 *energyman76b wrote:*   

> you should really turn it on. If you have the right kernel options set, you don't need to do anything. But a lot of stuff needs a timesource.
> 
> TSC doesn't work anymore and pm-timer and rtc are very slow. HPET is a lot faster.
> 
> It is just stupid that their are mainboards delivered with hpet turned off.

 

Well, then I shall turn it on.

But as you said, I need the right kernel options.

```

cat /usr/src/linux/.config | grep hpet

```

got me nothing, so I am an not sure at all what to turn on or what to set.. I could not find any helpful information so far...

Can you help me?

I DO have tickless activated, would that help already?

----------

## CooSee

cat /usr/src/linux/.config | grep HPET

CONFIG_HPET_TIMER=y

CONFIG_HPET=y

CONFIG_HPET_MMAP=y

CooSee ' Ya

----------

## zyko

You may need to add "hpet=force" to your boot parameters.

----------

## energyman76b

 *zyko wrote:*   

> You may need to add "hpet=force" to your boot parameters.

 

only with a broken bios.

----------

## thom_raindog

So, this:

```
CONFIG_HPET_TIMER=y

CONFIG_HPET_EMULATE_RTC=y

CONFIG_HPET=y

# CONFIG_HPET_RTC_IRQ is not set

CONFIG_HPET_MMAP=y

```

is looking good, is it?

How would I know that HPET is activated, that it does anything and, last but not least, that it actually improves anything?

Silly question I supposed, but hey..  :Smile: 

----------

## depontius

Try out "powertop" - it's in portage.  It will offer advice for reducing power, much of which is dedicated to laptops, but at the very least it will tell you if you've got hpet/tickless working right.  Or at least it'll tell you if you don't.

----------

## zyko

 *energyman76b wrote:*   

>  *zyko wrote:*   You may need to add "hpet=force" to your boot parameters. 
> 
> only with a broken bios.

 

Yepp, prominently all Intel ICH4-M Mainboards. The Intel-employee who is responsible for this was hopefully promoted into management, so he can't make any more stupid engineering decisions...

----------

## thom_raindog

Well, powertop gave me one or two tips, never a bad thing (hal polling for DVD-drives, for instance)

and it NEVER mentioned anything that looked like it had HPET in it... does that mean I am clean?

Anything else I could look into?

----------

## depontius

It probably would have mentioned it, had it been needed.  I just started powertop on my deskside and laptop.  The deskside is busy at the moment, but the laptop is idle.

Deskside:

```
     PowerTOP version 1.9       (C) 2007 Intel Corporation

                                      P-states (frequencies)

< Detailed C-state information is only available on Mobile CPUs (laptops) >

Wakeups-from-idle per second : 566.8    interval: 10.0s

Top causes for wakeups:

  25.1% (168.0)       <interrupt> : PS/2 keyboard/mouse/touchpad 

  22.4% (150.0)              java : schedule_timeout (process_timeout) 

   9.2% ( 61.9)       <interrupt> : aic7xxx, nvidia 

   7.8% ( 52.3)           firefox : schedule_timeout (process_timeout) 

   5.6% ( 37.2)      <kernel IPI> : Rescheduling interrupts 

   5.5% ( 37.1)           firefox : futex_wait (hrtimer_wakeup) 

```

Suggestion: Enable the CONFIG_ACPI_BATTERY kernel configuration option.

 This option is required to get power estimages from PowerTOP

Gee, I don't think CONFIG_ACPI_BATTERY will help, in this case.

Laptop:

```
     PowerTOP version 1.9       (C) 2007 Intel Corporation

Cn                Avg residency       P-states (frequencies)

C0 (cpu running)        ( 5.2%)         1500 Mhz     5.5%

C1                0.0ms ( 0.0%)         1000 Mhz     0.0%

C2               47.3ms (23.7%)          800 Mhz     0.0%

C3               10.0ms (71.2%)          600 Mhz    94.5%

Wakeups-from-idle per second : 76.3     interval: 20.0s

no ACPI power usage estimate available

Top causes for wakeups:

  83.0% ( 64.8)       <interrupt> : PS/2 keyboard/mouse/touchpad 

   2.6% (  2.0)       afs_rxevent : schedule_timeout (process_timeout)

   2.2% (  1.7)        gdmgreeter : schedule_timeout (process_timeout)

   2.2% (  1.7)                 X : do_setitimer (it_real_fn)

   1.5% (  1.1)       <interrupt> : ehci_hcd:usb1, uhci_hcd:usb2, uhci_hcd:usb3, uhci_hcd:usb4, ohci1394, Intel 82801DB-ICH4, yenta, Intel 82801

   1.3% (  1.0)           xfsaild : schedule_timeout (process_timeout)

```

Occasionally I get these overenthusiastic interrupts from the input devices.  The laptop is now sitting in a port replicator, and I've found that opening and shutting the lid can make them go away.  But it's on AC anyway, and they tend to come back, so I generally don't bother.  Incidentally, the laptop has ICH4-M, so I had to FORCE the HPET on the kernel line in the grub config.

In general, I think the thing to key off of is that on the laptop I've got some extended average residence times in the lower power states, 47mS in C2 and 10mS in C3.  I don't believe you can get that kind of residence time without the HPET.

----------

## thom_raindog

Well, running a desktop here, I don't get those C1 - C3 numbers...

----------

## depontius

My deskside didn't give C-state numbers either, only the laptop did.  I have one server at home that gives C0-C2 states, and the other gives no C-states.

----------

