[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tpmdd-devel
Subject:    Re: [tpmdd-devel] [PATCH 5/6] tpm_tis: don't use IRQF_SHARED by default when probing IRQ
From:       "Wilck, Martin" <martin.wilck () ts ! fujitsu ! com>
Date:       2015-11-10 8:04:07
Message-ID: C5A28EF7B98F574C85C70238C8E9ECC04E682BF0BE () ABGEX74E ! FSC ! NET
[Download RAW message or body]

> > When probing IRQs, IRQF_SHARED may cause IRQs to be falsely
> > detected if other devices generate IRQ events while tpm_tis is
> > probing or testing. I have seen this on my test machine repeatedly.
> > 
> > Therefore, refrain from probing IRQs that are already used by
> > other devices by default. Use "interrupts=2" module parameter
> > to obtain the previous behavior.
> > 
> > Signed-off-by: Martin Wilck <Martin.Wilck@ts.fujitsu.com>
> 
> The status register is cleared before generating interrupt in the
> probing code. And it's checked right in the beginning tis_int_probe().

The sequence of events is as follows:

 1 TPM IRQ generation is enabled for IRQ X and test command sent
 2 TPM finishes command and sets data ready / IRQ flags, but the IRQ
doesn't arrive because it's not configured in the system. Normally this
would cause a timeout and the IRQ would be found not to work, but...
 3 The other device triggers an IRQ X, causing tis_int_probe() to get
called and find the IRQ flags set. Now we conclude that the IRQ seems to
work, which is wrong. (Btw, the IRQ check in tpm_tis_send can
erroneously succeed for the same reason).

> If you had a bug like that then you would fix the race condition, not
> move away from IRQF_SHARED.

I have no idea how this can be fixed. It isn't really a race condition.

The device has generated an interrupt, and the IRQ handler has been
called, but with IRQF_SHARED we can't conclude that the former was the
reason for the latter. Probing would only work reliably by temporarily
disabling the other device's IRQ, and that doesn't feel right at all.

Martin

------------------------------------------------------------------------------
_______________________________________________
tpmdd-devel mailing list
tpmdd-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tpmdd-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic