From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05DEFC7618E for ; Wed, 26 Apr 2023 17:00:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233273AbjDZRAW (ORCPT ); Wed, 26 Apr 2023 13:00:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232972AbjDZRAU (ORCPT ); Wed, 26 Apr 2023 13:00:20 -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 ABA566181; Wed, 26 Apr 2023 10:00:19 -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 4A6CA635FA; Wed, 26 Apr 2023 17:00:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEA04C433D2; Wed, 26 Apr 2023 17:00:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682528418; bh=MHqWRvkl5Cm+oF+SgyhqgDdM1Q4M/yDXHwZMMADe8N0=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=hNecQijVZZORG15ytwJCNNM5O9bn8FYhmGWYhiICBh2STfG07xDCjy46L6FysE1Bj WTaU/9GDnboVILfS0vvG0rmGoW67jP6T1Yr5GOwRD0mwbAWxW8/eFONzxAWRlu2P3r BbqJ0YrOsmuH5cNKOuQSYzQOUnVdhu08O+MMDJdLLPmB9KHvwMZXmCnvQ1FdTsl2Ri Z9G6NcIJ8ZTwVktb8NYdW6HKK4wEB+sLRqpCiknzbEVuiZVYpaDqOrsrV0quamwfLq DDUVLaCX0Zq+6bHnC8wTEzK6lYcv1KzxnUgNKCWtYzqKzovH/NNM7+8O4CnK2Vvi8s rKE54/gww4ImA== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 26 Apr 2023 20:00:14 +0300 Message-Id: Cc: "Thorsten Leemhuis" , "James Bottomley" , "Vlastimil Babka" , "Peter Huewe" , "Jason Gunthorpe" , "Jan Dabros" , , "LKML" , , "Dominik Brodowski" , "Herbert Xu" , "Linus Torvalds" , "Johannes Altmanninger" Subject: Re: [REGRESSION] suspend to ram fails in 6.2-rc1 due to tpm errors From: "Jarkko Sakkinen" To: "Jarkko Sakkinen" , "Jason A. Donenfeld" X-Mailer: aerc 0.14.0 References: <7ebab1ff-48f1-2737-f0d3-25c72666d041@leemhuis.info> <4268d0ac-278a-28e4-66d1-e0347f011f46@leemhuis.info> In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org 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