Re: [REGRESSION] suspend to ram fails in 6.1 due to tpm errors

From: Vlastimil Babka
Date: Mon Nov 28 2022 - 14:38:19 EST



On 11/28/22 14:35, Vlastimil Babka wrote:
> On 11/28/22 13:03, Jason A. Donenfeld wrote:
>> Hi Vlastimil,
>>
>> Thanks for CC'ing me.
>>
>> On Mon, Nov 28, 2022 at 09:15:33AM +0100, Vlastimil Babka wrote:
>>> Dominik on IRC pointed me to commit b006c439d58d ("hwrng: core - start hwrng
>>> kthread also for untrusted sources"), which could make sense if the TPM was not
>>> used at all before and now it's used for randomness. But then it probably "just"
>>> uncovered a pre-existing issue? Maybe there's a race with getting the randomness
>>> and suspend? Could it be exactly what this patch is attempting to fix?
>>> https://lore.kernel.org/all/20221103145450.1409273-2-jsd@xxxxxxxxxxxx/
>>
>> The commit you referenced just turns on some functionality that most
>> people previously didn't have (but maybe could have, manually). So this
>> is a case of a new commit unearthing a bug in some old code. We had
>> something similar happen with a raspi driver and fixed the bug there.
>
> Right, I suspected as much.
>
>> From the looks of the lore link you provided, it sounds like the same
>> thing has happened already there to tpm? That this is already fixed by
>> that commit? I think if you have a system that's readily exhibiting the
>
> Well it was a patch series where a v3 was promised with more info about the
> bug it fixes, but I haven't found a v3. So if the author or TPM maintainers
> can confirm that it does (or can) indeed fix such a bug I'm observing, I'd
> hope for it to be fasttracked to 6.1.
>
>> issue, the best thing to do would be to try that series, and report
>> back, maybe even providing your `Tested-by:` line if it works.
>
> Yeah, I have compiled rc7 with patch 1/3, without the rest as that didn't
> seem necessary, and there was some review feedback that some parts need
> fixing. So far it didn't exhibit the bug when suspending/resuming 10 times,
> but that's not yet a guarantee due to nondeterministic nature of the issue
> and usually the suspends weren't happening in such rapid succession... I'll
> keep using that kernel for now on the laptop, fwiw.

With the hack you provided on IRC I was able to more reliably reproduce this
on rc7+hack, and not reproduce anymore with rc7+hack+Jan's patch so it seems
like the proper fix to me, thanks.

#regzbot monitor: https://lore.kernel.org/all/20221103145450.1409273-2-jsd@xxxxxxxxxxxx/ fix

>> I'll play around and see if I can repro too. Looks like you have a T460?
>> I don't have exactly that but maybe something close enough.
>
> Great, thanks!
>
>> Jason
>