Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1727441

[PATCH v2 4/4] tpm: use tpm_msleep() value as max delay

From Nayna Jain <nayna@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject [PATCH v2 4/4] tpm: use tpm_msleep() value as max delay
Date 2017-09-06 15:10 +0200
Message-ID <umIfF-2cQ-33@gated-at.bofh.it> (permalink)
References <umI5X-1TZ-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>
Acked-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
---
 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 eb2f8818eded..ff5a8b7b80b9 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -533,8 +533,8 @@ int wait_for_tpm_stat(struct tpm_chip *chip, u8 mask, unsigned long timeout,
 
 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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/4] additional TPM performance improvements  Nayna Jain <nayna@linux.vnet.ibm.com> - 2017-09-06 15:10 +0200
  [PATCH v2 4/4] tpm: use tpm_msleep() value as max delay Nayna Jain <nayna@linux.vnet.ibm.com> - 2017-09-06 15:10 +0200
  Re: [PATCH v2 0/4] additional TPM performance improvements Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-09-07 18:20 +0200

csiph-web