Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1114996ybi; Wed, 17 Jul 2019 09:44:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfzgWPVVG1fJFR3FY7aQFn4o9ZtoG2qBrmljqMFP2xRO+qum+yn+pcUWZz5qIZ4iGXOd2T X-Received: by 2002:a17:90a:b394:: with SMTP id e20mr44819469pjr.76.1563381846261; Wed, 17 Jul 2019 09:44:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563381846; cv=none; d=google.com; s=arc-20160816; b=rK+P5lLbu7qzO9NGvQThnZosQeNbBNnIaZQHMRFpHFMjG0l9SN42pL9ijq2UV8OQ4Y OriN3xvpIop9cCzRYvfYH7LLAUQG9b56vtu4Tg+SOU44ZlT8GFRPqwYuku7mYWmk9mwy gHT9G2TrfgHJ9/b9ibjtPZX1WtKl/uNwxpAgBXLOScbHeEK1HcFUR7uNeSaCxviJq95O G2H+ajE5KWB/If0Az2VfFr5Em2j2mWZQmrNbAlz/rZ8OIp9Fuf4n8k/SMMlX5zy6EWrK kNokNVAHxayu0/3IabxSFIzCpjEfQA9usQiu8WeXDYA7kwxkm35lVCwVIPCXSV8sC4oS g4ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:user-agent:from:cc:to:subject :references:in-reply-to:content-transfer-encoding:mime-version :message-id:dkim-signature; bh=1AorsIxKukv4QHmBEQpBYg3oWB5yXI20Vjy+qfW9lkc=; b=tHhIsML7tbm9o82jmFv/El3bDbzOYy1V60W1PST2oM6xnU9XBD+hZU6maMyFFs+cnD THdarBxTfKk9hzpQWXLrJ4YEsN7rK1M1zpmCgnKnMkWJZcafAdwxanJjmanSWEfFSxNN CusoYZAxvHUybH+sW+FCXsVAb1pNjyl6CmDmmNI+LwiR0X0hjZ9aSyu4fPAgqdAHIdpQ Ok6rqSbvv0D4mjr+TQrhrvaqtuhUKpqC4fu0AtBSuqPyZKuBGCcityUvlMxmy5w8sMEO i1N3u8ex2n65OFgh2o77EwjdtC32YE/f4VV3oLF0BFm3xaqIrMfUEzUB0OPtnCdRt2Sd gi5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=aPBwkLHR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k193si22936620pge.330.2019.07.17.09.43.49; Wed, 17 Jul 2019 09:44:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=aPBwkLHR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727196AbfGQQme (ORCPT + 99 others); Wed, 17 Jul 2019 12:42:34 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:38491 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725873AbfGQQme (ORCPT ); Wed, 17 Jul 2019 12:42:34 -0400 Received: by mail-pf1-f195.google.com with SMTP id y15so11113687pfn.5 for ; Wed, 17 Jul 2019 09:42:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=message-id:mime-version:content-transfer-encoding:in-reply-to :references:subject:to:cc:from:user-agent:date; bh=1AorsIxKukv4QHmBEQpBYg3oWB5yXI20Vjy+qfW9lkc=; b=aPBwkLHRyP3zBfKz3S3KZH+l1+ZuRHEihIf2pUKXtkCweo+Ivk/jGG+X/fvdZIAoSM ZVu2DoZFhluTMuDDK3FJB7NZs0E5xyrn51mWlvLtQgjKe6f7kE46St5/G8CznBdRPtnz 2XTizW1TMIpWX99cp06TCUJwuHnGHkuegzNLo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:mime-version :content-transfer-encoding:in-reply-to:references:subject:to:cc:from :user-agent:date; bh=1AorsIxKukv4QHmBEQpBYg3oWB5yXI20Vjy+qfW9lkc=; b=N+2om2oaJLpc6bgSjXkJPMe1TEuFB3fJ+eaqcTGRLQX5N7mINj8lj6rM/+oIVhnR0I Lit8zYZbcqFjQ0e+y9NN8h0zBl5kqOzpekMqR6h2Hl8zjlfyFCmGirPsT4/WEWc78oxa QLFsqiNSDWrZKE3Y28RWlvvMqmcYpN9qvMgr0GbkjZclhishMaqkm+CBPLS6f4EYewXw n48bS3l1PJd1h0ZylDRXPeglR+FHchDqdN/71zJRa0CeHnA0rFdky7nwC4qUCUHaKL03 YMOOsyGw7xKwjxQqrly0nUBD5rLyar0M4S2b/YMl7i1WYg/YRexHDp7CdK36eH0PIYyd 5CzQ== X-Gm-Message-State: APjAAAU9aeqrcI9L73Xj8tKUMP3y/+FVWIiwNNIJOVBaKMq+lQFVRrCA BMtrRele9CtIRp9EVNw8ckcIuA== X-Received: by 2002:a63:d950:: with SMTP id e16mr44043545pgj.271.1563381753703; Wed, 17 Jul 2019 09:42:33 -0700 (PDT) Received: from chromium.org ([2620:15c:202:1:fa53:7765:582b:82b9]) by smtp.gmail.com with ESMTPSA id a20sm20571581pjo.0.2019.07.17.09.42.32 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 17 Jul 2019 09:42:33 -0700 (PDT) Message-ID: <5d2f4ff9.1c69fb81.3c314.ab00@mx.google.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20190717113956.GA12119@ziepe.ca> References: <20190716224518.62556-1-swboyd@chromium.org> <20190716224518.62556-2-swboyd@chromium.org> <20190717113956.GA12119@ziepe.ca> Subject: Re: [PATCH v2 1/6] hwrng: core: Freeze khwrng thread during suspend To: Jason Gunthorpe Cc: Peter Huewe , Jarkko Sakkinen , linux-kernel@vger.kernel.org, Arnd Bergmann , Greg Kroah-Hartman , linux-integrity@vger.kernel.org, Andrey Pronin , Duncan Laurie , Guenter Roeck , Herbert Xu From: Stephen Boyd User-Agent: alot/0.8.1 Date: Wed, 17 Jul 2019 09:42:32 -0700 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Jason Gunthorpe (2019-07-17 04:39:56) > On Tue, Jul 16, 2019 at 03:45:13PM -0700, Stephen Boyd wrote: > > The hwrng_fill() function can run while devices are suspending and > > resuming. If the hwrng is behind a bus such as i2c or SPI and that bus > > is suspended, the hwrng may hang the bus while attempting to add some > > randomness. It's been observed on ChromeOS devices with suspend-to-idle > > (s2idle) and an i2c based hwrng that this kthread may run and ask the > > hwrng device for randomness before the i2c bus has been resumed. >=20 > You mean the TPM here right? In my case yes, but in general it isn't the TPM. >=20 > Should we be more careful in the TPM code to check if the TPM is > suspended before trying to use it, rather than muck up callers? >=20 Given that it's not just a TPM issue I don't see how checking in the TPM is going to fix this problem. It's better to not try to get random bytes from the hwrng when the device could be suspended.