Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp944648iob; Fri, 13 May 2022 17:18:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBwjzahb7P50rbddRe4Xl0xLZbi410kGJApXhA+j64hks59uVKI/49ykDaFfl8PDEUxTXk X-Received: by 2002:a5d:4cc6:0:b0:20c:6b0b:b060 with SMTP id c6-20020a5d4cc6000000b0020c6b0bb060mr5833915wrt.50.1652487482819; Fri, 13 May 2022 17:18:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652487482; cv=none; d=google.com; s=arc-20160816; b=CS+js1ssaVckicRggjdFWCDXB9BNlaB/mErseScknVSwfLQZpkgKCeYrLSDJT6h1uB B/UzMqyOjcDmZLtioLRoLen3OxSYfN2rE3bzr70wH+3yv8VSefX9ySgxX/dNU79jvJct X82Rxh9lYHuW06mzkqUan0L+aeCXF50LdjsaUShnPASPgiXiqrukIrJoEAQS4Kv/7SLg 58jG/KEM8K/AvpgXUHlQcelpY7ySADG6SfnyBmPlNfqjwWkEzTka92KzKk79PX9ijTKo 5NZ+qL2vmluYiMCkKs1kWe+c2Ww9NZzdzsNhOaHjfVAmiePM/gFHsbMoQabgpnsgDHf7 7yNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=OXuueVf6s3X6JCfPwwHQM04N6RRuZKVbCAo/pD8gmoE=; b=qJYp0fOnHTyPKj7+7sa2Ofs416gr8MeG4mWVpW8Lq01m1COQPc10dPiui3vEwy4ZT+ 2ZB0jYSC8c7DRK43FYziIfnd+wn1EB2TvcOl2ENxM9AEfdXNuDBQFM3sE9EuguqgnaJm +MbEKeJH3HQnWtv/3Qg3Kmv9O9kN4Dmk2KZiJnxtjlyRWU7bH23N0YALstRBNDTthXQd XRg50u3TPlRI1t2kipmUQVN+Hsd7gyJKPOSngoKrl+TClR4aSO6zGoHantyrkBQMNjfi yJhU3CzGSEjd+pN77pv78TE6ScjBIpPEXAANFLKvp3rTaNZjajqoGD65w4+EequrRKjR gb/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=dEosWFIz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e7-20020a5d5947000000b0020a878263f9si3176246wri.457.2022.05.13.17.18.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 17:18:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=dEosWFIz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 18C1C9CF4F; Fri, 13 May 2022 16:16:32 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356755AbiELQ50 (ORCPT + 99 others); Thu, 12 May 2022 12:57:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356747AbiELQ5X (ORCPT ); Thu, 12 May 2022 12:57:23 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B71D527C7; Thu, 12 May 2022 09:57:22 -0700 (PDT) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24CGrGbH026828; Thu, 12 May 2022 16:57:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : content-transfer-encoding : mime-version; s=pp1; bh=OXuueVf6s3X6JCfPwwHQM04N6RRuZKVbCAo/pD8gmoE=; b=dEosWFIzVsDsbbtzhV1OnaOE9QKKGrrtJsChiEBl5p0RrQsEs1b4cyux8gVYqiE7KOk4 srho2/2gHQjf/zeTJ+1lNg0cCXYf5aUINuam4yBRjnvzFk86d6I1vOaj3AguHvLjGo// j9uEz9mXePTSHuPVflIw5ZWEoQU7sLeL0uZB8LhhgjZqhZaKoyAoo9BkIHbGgjQTnmqa N4reKmoDgBgurQfeyplQgmAXCfVLCCeJigJ9PbGwLM0e3X27Z9C4vgB6fiYbTWIC8M22 ngHgfiTFQk1UUId/cuRdndSVpaXyWvr5lDIipKOf/BrVdoJGnEBaT16TehP02SZglj4O rw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g15pm0q0f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 16:57:16 +0000 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24CGuAuQ009564; Thu, 12 May 2022 16:57:15 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g15pm0pyr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 16:57:15 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24CGnB3O011576; Thu, 12 May 2022 16:52:12 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma03ams.nl.ibm.com with ESMTP id 3fwgd8ybrp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 16:52:12 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24CGqA7k45089078 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 16:52:10 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6BB61AE058; Thu, 12 May 2022 16:52:10 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 617BEAE04D; Thu, 12 May 2022 16:52:09 +0000 (GMT) Received: from sig-9-65-70-87.ibm.com (unknown [9.65.70.87]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 16:52:09 +0000 (GMT) Message-ID: <24a84723b246c45a6525016d9cd5cd13d121a0bf.camel@linux.ibm.com> Subject: Re: [PATCH] tpm: sleep at least <...> ms in tpm_msleep() From: Mimi Zohar To: James Bottomley , Jarkko Sakkinen , Johannes Holland , Nayna Cc: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, peterhuewe@gmx.de, jgg@ziepe.ca Date: Thu, 12 May 2022 12:52:08 -0400 In-Reply-To: References: <20220510112902.23213-1-johannes.holland@infineon.com> <99541f08e8b554dea59334005cafb0af978f9a05.camel@linux.ibm.com> Content-Type: text/plain; charset="ISO-8859-15" X-Mailer: Evolution 3.28.5 (3.28.5-18.el8) X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: TIycx0oP3tEWP8P7EXEnK9UwVbyPMsgB X-Proofpoint-GUID: QLPjj_TuljSeiaS3Yn7m6pKQtgsdcwFi Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_14,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 mlxscore=0 spamscore=0 phishscore=0 impostorscore=0 mlxlogscore=999 priorityscore=1501 bulkscore=0 malwarescore=0 adultscore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120078 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Thu, 2022-05-12 at 08:32 -0400, James Bottomley wrote: > On Thu, 2022-05-12 at 08:21 -0400, Mimi Zohar wrote: > > On Wed, 2022-05-11 at 18:16 +0300, Jarkko Sakkinen wrote: > > > On Tue, May 10, 2022 at 01:29:03PM +0200, Johannes Holland wrote: > > > > To comply with protocol requirements, minimum polling times must > > > > often > > > > be adhered to. Therefore, a macro like tpm_msleep() should sleep > > > > at > > > > least the given amount of time (not up to the given period). Have > > > > tpm_msleep() sleep at least the given number of milliseconds. > > > > > > > > Signed-off-by: Johannes Holland > > > > --- > > > > drivers/char/tpm/tpm.h | 4 ++-- > > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > > > diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h > > > > index 2163c6ee0d36..0971b55fffe3 100644 > > > > --- a/drivers/char/tpm/tpm.h > > > > +++ b/drivers/char/tpm/tpm.h > > > > @@ -185,8 +185,8 @@ int tpm_pm_resume(struct device *dev); > > > > > > > > static inline void tpm_msleep(unsigned int delay_msec) > > > > { > > > > - usleep_range((delay_msec * 1000) - TPM_TIMEOUT_RANGE_US, > > > > - delay_msec * 1000); > > > > + usleep_range(delay_msec * 1000, (delay_msec * 1000) > > > > + + TPM_TIMEOUT_RANGE_US); > > > > }; > > > > > > > > int tpm_chip_start(struct tpm_chip *chip); > > > > -- > > > > 2.34.1 > > > > > > > > > > For this I would really like to hear a 2nd opinion from Nayna and > > > Mimi. > > > > This patch reverts commit 5ef924d9e2e8 ("tpm: use tpm_msleep() value > > as max delay"). Are you experiencing TPM issues that require it? > > I am: > > https://lore.kernel.org/linux-integrity/1531328689.3260.8.camel@HansenPartnership.com/ > > I'm about 24h into a soak test of the patch with no TPM failure so far. > I think it probably needs to run another 24h just to be sure, but it > does seem the theory is sound (my TPM gets annoyed by being poked too > soon) so reverting 5ef924d9e2e8 looks to be the correct action. The > only other ways I've found to fix this are either revert the > usleep_range patch altogether or increase the timings: > > https://lore.kernel.org/linux-integrity/1531329074.3260.9.camel@HansenPartnership.com/ > > Which obviously pushes the min past whatever issue my TPM is having > even with 5ef924d9e2e8 applied. > > Given that even the commit message for 5ef924d9e2e8 admits it only > shaves about 12% off the TPM response time, that would appear to be an > optimization too far if it's going to cause some TPMs to fail. I'd like to understand how pervasive the problem is and which problem Johannes Holland is trying to address. Wasn't there already a patch to limit TPM performance degradation to a single buggy TPM chip already upstreamed? thanks, Mimi