From patchwork Wed Oct 4 10:29:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nayna X-Patchwork-Id: 9984189 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4C49360365 for ; Wed, 4 Oct 2017 10:31:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E4FC28834 for ; Wed, 4 Oct 2017 10:31:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3337D28ADA; Wed, 4 Oct 2017 10:31:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3630028834 for ; Wed, 4 Oct 2017 10:31:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751548AbdJDKbp (ORCPT ); Wed, 4 Oct 2017 06:31:45 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:33092 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751474AbdJDKbL (ORCPT ); Wed, 4 Oct 2017 06:31:11 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v94ATSVO125183 for ; Wed, 4 Oct 2017 06:31:11 -0400 Received: from e23smtp06.au.ibm.com (e23smtp06.au.ibm.com [202.81.31.148]) by mx0b-001b2d01.pphosted.com with ESMTP id 2dcwessp77-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 04 Oct 2017 06:31:10 -0400 Received: from localhost by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Oct 2017 20:31:08 +1000 Received: from d23relay10.au.ibm.com (202.81.31.229) by e23smtp06.au.ibm.com (202.81.31.212) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 4 Oct 2017 20:31:06 +1000 Received: from d23av06.au.ibm.com (d23av06.au.ibm.com [9.190.235.151]) by d23relay10.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v94ATpqk41812098; Wed, 4 Oct 2017 21:29:51 +1100 Received: from d23av06.au.ibm.com (localhost [127.0.0.1]) by d23av06.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v94AToSh009850; Wed, 4 Oct 2017 21:29:51 +1100 Received: from dhcp-9-60-73-202.endicott.ibm.com (dhcp-9-60-73-202.endicott.ibm.com [9.60.73.202]) by d23av06.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v94ATZs1009465; Wed, 4 Oct 2017 21:29:47 +1100 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 v3 3/5] tpm: reduce polling delay in tpm_tis wait_for_tpm_stat() Date: Wed, 4 Oct 2017 06:29:22 -0400 X-Mailer: git-send-email 2.13.3 In-Reply-To: <20171004102924.12355-1-nayna@linux.vnet.ibm.com> References: <20171004102924.12355-1-nayna@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17100410-0040-0000-0000-000003594C3F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17100410-0041-0000-0000-00000CDA6DF9 Message-Id: <20171004102924.12355-4-nayna@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-04_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=5 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710040153 Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The existing wait_for_tpm_stat() polls for the chip status after 5msec sleep. As per TCG ddwg input, it is expected that tpm might return status in few usec. So, reducing the delay in polling to 1msec. After this change, performance on a TPM 1.2 with an 8 byte burstcount for 1000 extends improved from ~14sec to ~10sec. Signed-off-by: Nayna Jain --- drivers/char/tpm/tpm_tis_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c index 8da425e1783f..224842e06105 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -31,6 +31,8 @@ #include "tpm.h" #include "tpm_tis_core.h" +#define TPM_POLL_SLEEP 1 + static bool wait_for_tpm_stat_cond(struct tpm_chip *chip, u8 mask, bool check_cancel, bool *canceled) { @@ -82,7 +84,7 @@ static int wait_for_tpm_stat(struct tpm_chip *chip, u8 mask, } } else { do { - tpm_msleep(TPM_TIMEOUT); + tpm_msleep(TPM_POLL_SLEEP); status = chip->ops->status(chip); if ((status & mask) == mask) return 0;