Received: by 10.192.165.156 with SMTP id m28csp42278imm; Tue, 17 Apr 2018 06:17:10 -0700 (PDT) X-Google-Smtp-Source: AIpwx48Plpocc18j/uXbYU8dgBjGANE1ZsnuW4PEjxH0VRB4ud9vhNN8J/rYESnbSOs411TbaR3+ X-Received: by 10.99.47.4 with SMTP id v4mr1852349pgv.42.1523971030243; Tue, 17 Apr 2018 06:17:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523971030; cv=none; d=google.com; s=arc-20160816; b=DazKl0YCH0MkAV/IQZzaaxTIOUij7soi8F5zqfpeAE7cDbHqCdRnCIpUNI3krsSwqC +SZMzST0C/93WeFB/MtiF6aVOmmNiGNPkLpWat6VTgsIq0wKnHou5ZvnIG5GjsrK9ATa wkGVFywMcWt7rQfQtXQirCGUMFtlTg1P+dsmo5sZFC0xbgcoPLfo4MlVdMxU3jtN4+kc RfNVjq6PnJ9PTbMtNdF4b6ddX4KqqwevcF1Bmf3qIkK2eDIYF4PssvhPLxScG9WCi6Rs BZWh9UX2D2NhQJXw39+DoxOgv4p7ysnYNbWZPZBouzfLtez+oAlsuDmrYT5Itmw7PkzN gyBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Lfd4RVXT9XEbSqii0L3fGMhSepzba8lL4EJtndcXK3Q=; b=0amxMqbZRvrUhHRNiTw3npNDLfv4mhW7JnzqcbiDKYbiuMG4SSykR3AkM2DLf3EEIU OH2o8lzULRx3t/CVAI2Hm1jFVj4+iLlAa7Jvl1Wc/5XB5ZUV7aMYna3aKGorSxJyNzS5 WTg/YuHk2n/AA2k7lvceCY+Qrea3Lwi8TME33NzQF3qwofi29teGmC5kdSmAGzZsEtuS ql2Gwpl/CEtA6kttQ6ySW7Eou1YB9Xpb+1wJqA8POIQeFuCOGsZdHZLDWnRTWgC4NXhY Qnd0qMoF3Q577KTObVDU/TcUBxIU+mzLvarRkdLz7bATQKiuDLAtk1llZScB9SHwpfrZ Zl8g== 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 n2si11703382pgs.31.2018.04.17.06.16.55; Tue, 17 Apr 2018 06:17:10 -0700 (PDT) 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 S1753812AbeDQNNq (ORCPT + 99 others); Tue, 17 Apr 2018 09:13:46 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:50008 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753223AbeDQNNA (ORCPT ); Tue, 17 Apr 2018 09:13:00 -0400 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 w3HD9Tb6005203 for ; Tue, 17 Apr 2018 09:12:59 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hdevbqjnr-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 17 Apr 2018 09:12:55 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Apr 2018 14:12:52 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 17 Apr 2018 14:12:50 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3HDCnY958130590; Tue, 17 Apr 2018 13:12:49 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DD08FA4057; Tue, 17 Apr 2018 14:04:58 +0100 (BST) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6F2E2A405B; Tue, 17 Apr 2018 14:04:57 +0100 (BST) Received: from localhost.endicott.ibm.com (unknown [9.60.15.245]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 17 Apr 2018 14:04:57 +0100 (BST) 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 v2 0/2] tpm: improving granularity in poll sleep times Date: Tue, 17 Apr 2018 09:12:44 -0400 X-Mailer: git-send-email 2.13.3 X-TM-AS-GCONF: 00 x-cbid: 18041713-0040-0000-0000-0000044E8609 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041713-0041-0000-0000-000020F2CE5D Message-Id: <20180417131246.434-1-nayna@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-17_07:,, 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=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804170119 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The existing TPM polling code sleeps in each loop iteration for time in msecs ranging from 1 msecs to 5 msecs. However, many of the TPM commands complete much faster, resulting in unnecessary delays. This set of patches identifies such iterations and optimizes the sleep time. The first patch replaces TPM_POLL_SLEEP with TPM_TIMEOUT_POLL and moves it from tpm_tis_core.c to tpm.h as an enum with value 1 msecs. The second patch further reduces the TPM poll sleep time in get_burstcount() and wait_for_tpm_stat() in tpm_tis_core.c by calling usleep_range() directly. The change is only in the polling time, and the maximum timeout is still maintained the same. Thus, it should not affect the overall existing behavior. Changelog: v2: tpm: reduce poll sleep time in tpm_transmit() * merged previously defined two patches into this. * updated patch description as per Jarkko's feedback tpm: reduce polling time to usecs for even finer granularity * directly use usleep_range with finer granularity less than 1msec Nayna Jain (2): tpm: reduce poll sleep time in tpm_transmit() tpm: reduce polling time to usecs for even finer granularity drivers/char/tpm/tpm-interface.c | 2 +- drivers/char/tpm/tpm.h | 5 ++++- drivers/char/tpm/tpm_tis_core.c | 11 +++-------- 3 files changed, 8 insertions(+), 10 deletions(-) -- 2.13.3