Re: [PATCH] tpm: fix interrupt timeouts

From: Jason Gunthorpe
Date: Mon Aug 25 2014 - 14:04:10 EST

On Mon, Aug 25, 2014 at 07:14:03AM +0000, Scot Doyle wrote:
> commit 4c663cfc523a88d97a8309b04a089c27dc57fd7e
> wait: fix false timeouts when using wait_event_timeout()
> changed the semantics of wait_event_interruptible_timeout so that a
> condition check is performed after timeout and 1 is returned if true.
> The TPM chip may not send interrupts even though the tpm module is
> attempting to receive interrupts. In this case, after the module
> sends a command to the TPM chip it performs a blocking wait on the
> interrupt queue. No interrupts are sent from the chip, the queue is
> not woken up and the blocking wait times out. Despite timing out,
> the command has completed and the condition check performed by
> wait_event_interruptible_timeout after timeout is true, resulting in
> a return value of 1. Since the expected return value on timeout is 0
> the timeout is not detected.
> To fix, assume a return value of 1 or less indicates an elapsed
> timeout. It is possible for the return value to be 1 after receiving
> an interrupt, but this should be rare. The condition is not double-
> checked because of possible side effects.

Hum.. Okay, so I see what you are trying to fix here, but the code is
actually using wait_event_interruptible_timeout correctly as is.

The TPM actually did complete the operation, and the test sentinal
checks directly at the TPM - which makes sense to me..

I think you'll have to directly test in the tis driver if the
interrupt is working.

The ordering in the TIS driver is wrong, interrupts should be turned
on before any TPM commands are issued. This is what other drivers are

If you fix this, tis can then just count interrupts recieved and check
if that is 0 to detect failure and then turn them off.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at