Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C42B3D6E for ; Fri, 21 Apr 2023 15:03:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 528E3C433EF; Fri, 21 Apr 2023 15:03:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682089424; bh=Ssl54N08hcIsL4K1OwVsyYR15G7wERqkfvdOZ49GqUg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Nqtg1DtSN9c2qm79I5pki/emr651+SWVvPrDxYxCLyXT3myuhVo6dj9IGaox7IIYO KIsEtGywhpS4Yb6Ka18RqepA4tWxJeUgQS17X5rgqqqAzAvykRPrXTIQGiDWDS4iCz 0F5ncMvRIGwDJsybytKhX1YGkzWB36N1V5yziETw+/OjEym9YQGYrogh7wMoRJ97Ei 3/nyVkAtSdHZXd1iWefNCUGOb6yMfdXtsYjKiGZH1yy2Q17B49x8TS+ie2VnJ4ciWY iaGdFZA3+KXL0ENohLFqvj2SdSVb5VvW7g6BR0UbUAHgAmwZGxyVgADJk2yvgs2fhu 5i2CtSUlrZ3Pw== Date: Fri, 21 Apr 2023 18:03:41 +0300 From: Jarkko Sakkinen To: "Jason A. Donenfeld" Cc: Thorsten Leemhuis , James Bottomley , Vlastimil Babka , Peter Huewe , Jason Gunthorpe , Jan Dabros , regressions@lists.linux.dev, LKML , linux-integrity@vger.kernel.org, Dominik Brodowski , Herbert Xu , Linus Torvalds , Johannes Altmanninger Subject: Re: [REGRESSION] suspend to ram fails in 6.2-rc1 due to tpm errors Message-ID: References: <7ebab1ff-48f1-2737-f0d3-25c72666d041@leemhuis.info> <4268d0ac-278a-28e4-66d1-e0347f011f46@leemhuis.info> Precedence: bulk X-Mailing-List: regressions@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Mar 14, 2023 at 04:23:54PM +0200, Jarkko Sakkinen wrote: > > diff --git a/drivers/char/random.c b/drivers/char/random.c > > index ce3ccd172cc8..708110c780aa 100644 > > --- a/drivers/char/random.c > > +++ b/drivers/char/random.c > > @@ -934,20 +934,20 @@ EXPORT_SYMBOL(add_device_randomness); > > void add_hwgenerator_randomness(const void *buf, size_t len, size_t entropy, bool sleep_after) > > { > > mix_pool_bytes(buf, len); > > credit_init_bits(entropy); > > > > /* > > * Throttle writing to once every reseed interval, unless we're not yet > > * initialized or no entropy is credited. > > */ > > - if (sleep_after && !kthread_should_stop() && (crng_ready() || !entropy)) > > - schedule_timeout_interruptible(crng_reseed_interval()); > > +// if (sleep_after && !kthread_should_stop() && (crng_ready() || !entropy)) > > +// schedule_timeout_interruptible(crng_reseed_interval()); > > } > > EXPORT_SYMBOL_GPL(add_hwgenerator_randomness); > > > > /* > > * Handle random seed passed by bootloader, and credit it depending > > * on the command line option 'random.trust_bootloader'. > > */ > > void __init add_bootloader_randomness(const void *buf, size_t len) > > { > > > > Then I hooked the tpm emulator up to qemu and put it in tpm1 mode. I had > > userspace `echo mem > /sys/power/state` every couple of seconds (or > > continuously maybe?), and then I used the qemu monitor interface to wake > > the system from sleep. And kaboom. > > Thanks for the tips! I'll try various patch combinations and see what > happens. I created a VM using libvirt with the following configuration [*] I do not have issues with suspend so far with unmodified v6.3-rc7. It would be nice to have a script that gives a guaranteed crash with unmodified kernel even if run for some hours. Instead of using QEMU monitor interface and /sys/power/state, I wonder if a stress test could be based on looping rtcwake for easier comparison of results? [*] full description: https://gist.github.com/jarkkojs/66ea0d8d6a927311e8abb8b35e1ddbcd BR, Jarkko