Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2382300rwr; Fri, 21 Apr 2023 08:09:56 -0700 (PDT) X-Google-Smtp-Source: AKy350Yb4Y4qtJD+OFyrYP542ToFWKZL5JlPHvuiULWscM6DuoO48fzT86tryUP5ZDXZLBrqyjEQ X-Received: by 2002:a05:6a20:3d20:b0:f2:15f7:a7f8 with SMTP id y32-20020a056a203d2000b000f215f7a7f8mr6260202pzi.2.1682089796063; Fri, 21 Apr 2023 08:09:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682089796; cv=none; d=google.com; s=arc-20160816; b=YG+P5cmJhQLoX0VAARO8BP2nGYjnsiCCLWWgf7J+CpyxU8pMc7X0Rz2WzydE6WNIu+ DmdIr2Gj9UeZq+0Dxz/Ud6XuAXCsOjakgOoRMv56R/S4nLSGkoF9bdvXCLqWbuxAaVCD gVixMY4GBYGXpUXO4Z3FVnX4JGeMHKdJDE60BQKruJAFm65id6ag4pf46un/p6aBjZTI c1aPhFskYXz0h9cgrO/gRtCzIC/swq4oanjf7gllJCNILOi0JSx7pSH2Sdi1EF03pv/g 7bTRy7shb8R36P8ZS6sKkrxn2Gg9y+WX9nPMGvlxHGwoOVJsxi33T75QvU05D+ev1kn7 AjJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=MZiAnxXdUVaeRk4pKJZPyBw41FCgNIVykE3Rdf0t6CI=; b=pXMFzFNs0zndw8y8iFldyBZjui/oGzWzW8MzFJghWArRfut79RY9bc+2ePY4qpOKjH QnFt6aL3w6tb2UzhGM330T/lZ2IcB9IpnkCtU6ABwRPQ9ns4/pUOoJpcrORh3xbGzgKJ m/UyGkNKeI/RdESATlJxGdHFaLw9Vh2/ybvbe6htz/9rERWtjx7fx2KPaQin30G9btCo 8OmtcOlr3f3Fb0pxxN/ZASHmNQCPF9VHk0QvKGmlCM/qPOjyqsVBHtbye68uAaSvGgo8 QL+tsrdyoyglCDcl1aeA8vB6THLJj2sKYULxpj6pmVMWJaRo5DhfsHrNHRW2k1p+TKTW IgMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Nqtg1DtS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bk13-20020a056a02028d00b00524d4b572e9si2126380pgb.370.2023.04.21.08.09.34; Fri, 21 Apr 2023 08:09:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Nqtg1DtS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232334AbjDUPDt (ORCPT + 99 others); Fri, 21 Apr 2023 11:03:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230310AbjDUPDr (ORCPT ); Fri, 21 Apr 2023 11:03:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4C5810DD; Fri, 21 Apr 2023 08:03:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4603760D33; Fri, 21 Apr 2023 15:03:45 +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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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