Received: by 10.223.185.116 with SMTP id b49csp6549657wrg; Wed, 28 Feb 2018 11:20:48 -0800 (PST) X-Google-Smtp-Source: AH8x226NB0n9w8iZOszmXGcuKjkI/hYpIZJDpuuH5M+CRMl2yFiGTWpGzOJiSKOJAqOVNeck67Qr X-Received: by 10.101.93.82 with SMTP id e18mr14872478pgt.371.1519845648561; Wed, 28 Feb 2018 11:20:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519845648; cv=none; d=google.com; s=arc-20160816; b=lIAm9kIQMnM2n2kzsXbt03ZHk5OcIXeWymp1jl8CTQs+lknJDh3nhpXgHLP6dS4QDQ 3Dnesum7ri6j86UO6o2QevbrlYTF/3ipKzwOHkk5pLF3q6X6kFfORMxJSdt1NONxRFQK W6Ffi4dW43GFXGBS/OaiCXCl599XuVbIjA4YRMKuHyjGnTTEaVr2WxDTO53oJ3FEISbX Mp30famxu3/H2iB/py3nADl1cVHzs96xTDL3brjsEGZR/PerwktbazVAMuKnCJv/bAhC DR5kY4aSBx46npNcr3Z9fnnpKjs7Hq0TdESfQb1Rddy8gt6a1PSZh/r24xGtQvStIZLS j/VQ== 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=iNAz6AiqkEYNndgB8XnD9djmyjl+h6JIivQO5joyFh0=; b=G7OcOUsXXtstdmsoX3MPQ2hoMTweLjB2jrc16BQ3e8Ktx1OkNCGhS7kTBYN7v04U3t dJLVNACur00fcdFzrNQ5hmmU+MK0ooEdXJJB1Cnc/fmZ+FiOQ+5F7IH0qITBzRy2q4Te XCGBpXl0/lnPThec6zgyMYk+XXo2ilZ3U/iKBDZ3I1Oi7moi02FE9J5EF7VRdxO241cU kF++9JsmuqLg+5KhZu/0RU5mTT5nPPw0iKRJeWQ81f0OEpXPmddMy6+pmrYf199ik35F T9koufzpWwICRt7Et4/M30ub4OP/V0yWFMVusK2MGbDyScm7EwQ0WHl/EXfuuD9pQBuX P1pg== 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 u82si1649774pfg.389.2018.02.28.11.20.34; Wed, 28 Feb 2018 11:20:48 -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 S933636AbeB1TTW (ORCPT + 99 others); Wed, 28 Feb 2018 14:19:22 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:47626 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933606AbeB1TTO (ORCPT ); Wed, 28 Feb 2018 14:19:14 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1SJJARh018378 for ; Wed, 28 Feb 2018 14:19:13 -0500 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ge0n6vsr4-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 28 Feb 2018 14:19:13 -0500 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Feb 2018 19:18:57 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 28 Feb 2018 19:18:55 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w1SJItu046006360; Wed, 28 Feb 2018 19:18:55 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D366211C04C; Wed, 28 Feb 2018 19:11:47 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AF00A11C058; Wed, 28 Feb 2018 19:11:46 +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:46 +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: [RFC PATCH 3/3] tpm: tpm_msleep() with finer granularity improves performance Date: Wed, 28 Feb 2018 14:18:28 -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-0016-0000-0000-0000052B1E78 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18022819-0017-0000-0000-000028681FA3 Message-Id: <20180228191828.20056-3-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-1802280235 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When 'commit 9f3fc7bcddcb ("tpm: replace msleep() with usleep_range() in TPM 1.2/2.0 generic drivers")' was upstreamed, it replaced the msleep() calls with usleep_range(), but did not change the granularity of the calls. They're still defined in terms of msec. Test results show that refining the granularity further improves the performance. We're posting this patch as an RFC to show that there needs to be another function which allows finer granularity. After this change, performance on a TPM 1.2 with an 8 byte burstcount for 1000 extends improved from ~10.7sec to ~6.9sec. Signed-off-by: Nayna Jain --- drivers/char/tpm/tpm.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index 7e797377e1eb..8cad6bfc5f46 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h @@ -522,8 +522,7 @@ 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) / 10, (delay_msec * 1000) / 2); }; struct tpm_chip *tpm_chip_find_get(struct tpm_chip *chip); -- 2.13.3