Received: by 10.223.185.116 with SMTP id b49csp6549205wrg; Wed, 28 Feb 2018 11:20:15 -0800 (PST) X-Google-Smtp-Source: AG47ELs5E78qokWLg9CbglvYFyLF30TMArt9U3aEFGOl+D9nDmBo1ccu2ziKzkwzpkIEfm1NEgnt X-Received: by 2002:a17:902:52ca:: with SMTP id a68-v6mr2807517pli.179.1519845615198; Wed, 28 Feb 2018 11:20:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519845615; cv=none; d=google.com; s=arc-20160816; b=EnwH1U+6pDBp+dvVVM/5Qchm7oZuO3wFjQi6I+C85knXB/DH+Tmt9baiwuylAJC++T 0UzJ7DwdOuErj+TCevv3wU/WtYZzOHaOTj5lGRCFIF4HafiRrEpdUieVY9+GuEkuhM5e zkC8h3cm96vWqSF/bH+xI0IZrnt+N/+lucdyHBgOdZl/V048mfNTBLKY0C5kB1y7qyYt 9gm4QsjWPILDunsR6hlj2VLq6RG3Ey+oc92K6G+fAZ7w3nSCV7Qikmi+5L7SAmqGhVKd O2cKbTlIS1I70p8iUbGYhWX+BoN23iWXNs7FIbO0ILQKCRkLq7mZzVUL64IGGDbe1InR bJXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from:arc-authentication-results; bh=d5JMHquoDAVg7llKIn4nl04UKXDdig/Lqi8DSeQlzMI=; b=vqF8TonI5VwXntJEWbyh+nW5ZUcOmw7k0Xi2StfTOoewB/L9EeJvoFy7aJPhNV3Nod Z+42M+BCjFyPMJeMHFnCgD3SmwmWijUPtadzah8Fb/K4HnJcbUmzxzc3HfjDFIS5NGWs ryNU+MwsuVRdx0DiLpiDPl8vd8wnCdJmS56W3fhG3NEAR1Zw9bUtmQzLmFGQ5ic7qLpX q9T8+bt+La1Xcur3d1aNjbnMeGvz+ULQUt1+Ytr/X0ZcP4B7+U2sEXQ/Q5bBSZcOFE6i x4fxdYI3ljijZw+lmw9ZDPG9/LC1rq0HqRmvxzXiiRC/UqmScfn1T2jaXFCkBBkDlYMp +3tg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si1697258pll.585.2018.02.28.11.20.00; Wed, 28 Feb 2018 11:20:15 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933579AbeB1TS4 (ORCPT + 99 others); Wed, 28 Feb 2018 14:18:56 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:39582 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932780AbeB1TSx (ORCPT ); Wed, 28 Feb 2018 14:18:53 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1SJEUmt054109 for ; Wed, 28 Feb 2018 14:18:52 -0500 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ge29x0e92-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 28 Feb 2018 14:18:52 -0500 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Feb 2018 19:18:50 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 28 Feb 2018 19:18:47 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w1SJIlH444957900; Wed, 28 Feb 2018 19:18:47 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C376C11C050; Wed, 28 Feb 2018 19:11:39 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A092D11C04A; Wed, 28 Feb 2018 19:11:38 +0000 (GMT) Received: from localhost.endicott.ibm.com (unknown [9.60.15.245]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Feb 2018 19:11:38 +0000 (GMT) From: Nayna Jain To: linux-integrity@vger.kernel.org Cc: zohar@linux.vnet.ibm.com, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, peterhuewe@gmx.de, jarkko.sakkinen@linux.intel.com, tpmdd@selhorst.net, jgunthorpe@obsidianresearch.com, patrickc@us.ibm.com, Nayna Jain Subject: [PATCH 2/3] tpm: reduce poll sleep time between send() and recv() in tpm_transmit() Date: Wed, 28 Feb 2018 14:18:27 -0500 X-Mailer: git-send-email 2.13.3 In-Reply-To: <20180228191828.20056-1-nayna@linux.vnet.ibm.com> References: <20180228191828.20056-1-nayna@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18022819-0040-0000-0000-000004191E60 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18022819-0041-0000-0000-0000261C1F6A Message-Id: <20180228191828.20056-2-nayna@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-02-28_11:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1802280234 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In tpm_transmit, after send(), the code checks for status in a loop with polling every 5msec. It is expected that the tpm might return earlier than 5msec, so it might be adding to unnecessary delay. This patch reduces the polling sleep time from 5msec to 1msec. After this change, performance on a TPM 1.2 with an 8 byte burstcount for 1000 extends improved from ~14sec to ~10.7sec. Signed-off-by: Nayna Jain --- drivers/char/tpm/tpm-interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c index 76df4fbcf089..2d22f981f0c9 100644 --- a/drivers/char/tpm/tpm-interface.c +++ b/drivers/char/tpm/tpm-interface.c @@ -470,7 +470,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space, goto out; } - tpm_msleep(TPM_TIMEOUT); + tpm_msleep(TPM_TIMEOUT_POLL); rmb(); } while (time_before(jiffies, stop)); -- 2.13.3