Re: [PATCH] Fix periodic-emulation in HPET for delayed interrupts

From: Andrew Morton
Date: Wed Jun 08 2011 - 17:38:44 EST


On Wed, 1 Jun 2011 13:58:50 +0200
Nils Carlson <nils.carlson@xxxxxxxxxxxx> wrote:

> When interrupts are delayed due to interrupt masking or due
> to other interrupts being serviced the HPET periodic-emuation
> would fail. This happened because given an interval t and
> a time for the current interrupt m we would compute the next
> time as t + m. This works until we are delayed for > t, in
> which case we would be writing a new value which is in fact
> in the past.
>
> This can be solved by computing the next time instead as
> (k * t) + m where k is large enough to be in the future.
> The exact computation of k is described in a comment to
> the code.
>
> ...
>
> + /* The time for the next interrupt would logically be t + m,
> + * however, if we are very unlucky and the interrupt is delayed
> + * for longer than t then we will completely miss the next
> + * interrupt if we set t + m and an application will hang.

Strange. Normally when hardware generates an interrupt it doesn't get
"missed". It just sits there pending until the CPU accepts it.

What exactly causes this interrupt to be "delayed"? Are you referring
to the CPU disabling local interrupts for too long, or something else?

And why does this delay cause the interrupt to be completely missed?

IOW, is the hpet hardware as busted as it sounds? ;)

And how serious is this bug? Can the fix be delayed until 3.1, or is it
needed in 3.0? 2.6.x.y?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/