From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937611AbdJQUdK (ORCPT ); Tue, 17 Oct 2017 16:33:10 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:50554 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936991AbdJQUdH (ORCPT ); Tue, 17 Oct 2017 16:33:07 -0400 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 v4 4/4] tpm: use tpm_msleep() value as max delay Date: Tue, 17 Oct 2017 16:32:32 -0400 X-Mailer: git-send-email 2.13.3 In-Reply-To: <20171017203232.2262-1-nayna@linux.vnet.ibm.com> References: <20171017203232.2262-1-nayna@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17101720-0020-0000-0000-000003C1C5E0 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17101720-0021-0000-0000-000042564E82 Message-Id: <20171017203232.2262-5-nayna@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-10-17_14:,, 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-1710170289 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, tpm_msleep() uses delay_msec as the minimum value in usleep_range. However, that is the maximum time we want to wait. The function is modified to use the delay_msec as the maximum value, not the minimum value. After this change, performance on a TPM 1.2 with an 8 byte burstcount for 1000 extends improved from ~9sec to ~8sec. Fixes: 3b9af007869("tpm: replace msleep() with usleep_range() in TPM 1.2/ 2.0 generic drivers") Signed-off-by: Nayna Jain Acked-by: Mimi Zohar Tested-by: Jarkko Sakkinen Reviewed-by: Jarkko Sakkinen --- 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 4fc83ac7abeb..644de70de2cc 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h @@ -528,8 +528,8 @@ int tpm_pm_resume(struct device *dev); static inline void tpm_msleep(unsigned int delay_msec) { - usleep_range(delay_msec * 1000, - (delay_msec * 1000) + TPM_TIMEOUT_RANGE_US); + usleep_range((delay_msec * 1000) - TPM_TIMEOUT_RANGE_US, + delay_msec * 1000); }; struct tpm_chip *tpm_chip_find_get(int chip_num); -- 2.13.3 From mboxrd@z Thu Jan 1 00:00:00 1970 From: nayna@linux.vnet.ibm.com (Nayna Jain) Date: Tue, 17 Oct 2017 16:32:32 -0400 Subject: [PATCH v4 4/4] tpm: use tpm_msleep() value as max delay In-Reply-To: <20171017203232.2262-1-nayna@linux.vnet.ibm.com> References: <20171017203232.2262-1-nayna@linux.vnet.ibm.com> Message-ID: <20171017203232.2262-5-nayna@linux.vnet.ibm.com> To: linux-security-module@vger.kernel.org List-Id: linux-security-module.vger.kernel.org Currently, tpm_msleep() uses delay_msec as the minimum value in usleep_range. However, that is the maximum time we want to wait. The function is modified to use the delay_msec as the maximum value, not the minimum value. After this change, performance on a TPM 1.2 with an 8 byte burstcount for 1000 extends improved from ~9sec to ~8sec. Fixes: 3b9af007869("tpm: replace msleep() with usleep_range() in TPM 1.2/ 2.0 generic drivers") Signed-off-by: Nayna Jain Acked-by: Mimi Zohar Tested-by: Jarkko Sakkinen Reviewed-by: Jarkko Sakkinen --- 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 4fc83ac7abeb..644de70de2cc 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h @@ -528,8 +528,8 @@ int tpm_pm_resume(struct device *dev); static inline void tpm_msleep(unsigned int delay_msec) { - usleep_range(delay_msec * 1000, - (delay_msec * 1000) + TPM_TIMEOUT_RANGE_US); + usleep_range((delay_msec * 1000) - TPM_TIMEOUT_RANGE_US, + delay_msec * 1000); }; struct tpm_chip *tpm_chip_find_get(int chip_num); -- 2.13.3 -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html