On Wed Apr 26, 2023 at 7:07 PM EEST, Jarkko Sakkinen wrote: > On Wed Apr 26, 2023 at 4:32 AM EEST, Jason A. Donenfeld wrote: > > Nice work! Happy that you got it figured out. That trace seems > > consistent with what I was seeing in my traces, so I think you've > > spotted the right bug. > > > > Jason > > Unfortunately there might be two bugs. Unless I interpreted logs > incorrectly also hwrng can race with resume (sorry, I forgot to > save it). > > Looking at drivers/char/hw_random/core.c there seems to be no > binding to the PM so I guess that this it supports what I'm > observing [*]. > > So there's two ways to fix the issue: > > 1. Unregister hwrng for the course of suspend > 2. Add something like TPM_CHIP_SUSPENDED, which is set by suspend and > cleared by the resume. > > I try the 2nd option first because I see it less complicated. > Probably would make sense to turn chip flags as atomic while > at it. > > [*] https://elixir.bootlin.com/linux/latest/source/drivers/char/hw_random/core.c OK, so I implemented fix also for hwrng and now I get a clean resume. I'll add all necessary tags etc. and send for review. BR, Jarkko