From: zohar@linux.vnet.ibm.com (Mimi Zohar)
To: linux-security-module@vger.kernel.org
Subject: [tpmdd-devel] [PATCH 2/2] tpm: add sleep only for retry in i2c_nuvoton_write_status()
Date: Mon, 13 Mar 2017 10:54:22 -0400 [thread overview]
Message-ID: <1489416862.28954.156.camel@linux.vnet.ibm.com> (raw)
In-Reply-To: <1489171554-6844-2-git-send-email-nayna@linux.vnet.ibm.com>
Hi Jarkko,
On Fri, 2017-03-10 at 13:45 -0500, Nayna Jain wrote:
> Currently, there is an unnecessary 1 msec delay added in
> i2c_nuvoton_write_status() for the successful case. This
> function is called multiple times during send() and recv(),
> which implies adding multiple extra delays for every TPM
> operation.
>
> This patch calls usleep_range() only if retry is to be done.
>
> Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>
> Cc: stable at vger.kernel.org (linux-4.8)
> Reviewed-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Either Reviewed-by/Acked-by is fine.
Can you pick up this patch and replace the original version of "tpm:
msleep() delays - replace with usleep_range()" with the one Nayna
posted?
Thanks!
Mimi
> ---
> drivers/char/tpm/tpm_i2c_nuvoton.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
> index 0c98c42..c642877 100644
> --- a/drivers/char/tpm/tpm_i2c_nuvoton.c
> +++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
> @@ -124,8 +124,9 @@ static s32 i2c_nuvoton_write_status(struct i2c_client *client, u8 data)
> /* this causes the current command to be aborted */
> for (i = 0, status = -1; i < TPM_I2C_RETRY_COUNT && status < 0; i++) {
> status = i2c_nuvoton_write_buf(client, TPM_STS, 1, &data);
> - usleep_range(TPM_I2C_BUS_DELAY, TPM_I2C_BUS_DELAY
> - + TPM_I2C_DELAY_RANGE);
> + if (status < 0)
> + usleep_range(TPM_I2C_BUS_DELAY, TPM_I2C_BUS_DELAY
> + + TPM_I2C_DELAY_RANGE);
> }
> return status;
> }
--
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
WARNING: multiple messages have this Message-ID (diff)
From: Mimi Zohar <zohar-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
To: Jarkko Sakkinen
<jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Cc: linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
"linux-4.8" <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 2/2] tpm: add sleep only for retry in i2c_nuvoton_write_status()
Date: Mon, 13 Mar 2017 10:54:22 -0400 [thread overview]
Message-ID: <1489416862.28954.156.camel@linux.vnet.ibm.com> (raw)
In-Reply-To: <1489171554-6844-2-git-send-email-nayna-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Hi Jarkko,
On Fri, 2017-03-10 at 13:45 -0500, Nayna Jain wrote:
> Currently, there is an unnecessary 1 msec delay added in
> i2c_nuvoton_write_status() for the successful case. This
> function is called multiple times during send() and recv(),
> which implies adding multiple extra delays for every TPM
> operation.
>
> This patch calls usleep_range() only if retry is to be done.
>
> Signed-off-by: Nayna Jain <nayna-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
> Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org (linux-4.8)
> Reviewed-by: Mimi Zohar <zohar-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Either Reviewed-by/Acked-by is fine.
Can you pick up this patch and replace the original version of "tpm:
msleep() delays - replace with usleep_range()" with the one Nayna
posted?
Thanks!
Mimi
> ---
> drivers/char/tpm/tpm_i2c_nuvoton.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
> index 0c98c42..c642877 100644
> --- a/drivers/char/tpm/tpm_i2c_nuvoton.c
> +++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
> @@ -124,8 +124,9 @@ static s32 i2c_nuvoton_write_status(struct i2c_client *client, u8 data)
> /* this causes the current command to be aborted */
> for (i = 0, status = -1; i < TPM_I2C_RETRY_COUNT && status < 0; i++) {
> status = i2c_nuvoton_write_buf(client, TPM_STS, 1, &data);
> - usleep_range(TPM_I2C_BUS_DELAY, TPM_I2C_BUS_DELAY
> - + TPM_I2C_DELAY_RANGE);
> + if (status < 0)
> + usleep_range(TPM_I2C_BUS_DELAY, TPM_I2C_BUS_DELAY
> + + TPM_I2C_DELAY_RANGE);
> }
> return status;
> }
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
WARNING: multiple messages have this Message-ID (diff)
From: Mimi Zohar <zohar@linux.vnet.ibm.com>
To: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org,
"linux-4.8" <stable@vger.kernel.org>,
Nayna Jain <nayna@linux.vnet.ibm.com>
Subject: Re: [tpmdd-devel] [PATCH 2/2] tpm: add sleep only for retry in i2c_nuvoton_write_status()
Date: Mon, 13 Mar 2017 10:54:22 -0400 [thread overview]
Message-ID: <1489416862.28954.156.camel@linux.vnet.ibm.com> (raw)
In-Reply-To: <1489171554-6844-2-git-send-email-nayna@linux.vnet.ibm.com>
Hi Jarkko,
On Fri, 2017-03-10 at 13:45 -0500, Nayna Jain wrote:
> Currently, there is an unnecessary 1 msec delay added in
> i2c_nuvoton_write_status() for the successful case. This
> function is called multiple times during send() and recv(),
> which implies adding multiple extra delays for every TPM
> operation.
>
> This patch calls usleep_range() only if retry is to be done.
>
> Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>
> Cc: stable@vger.kernel.org (linux-4.8)
> Reviewed-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Either Reviewed-by/Acked-by is fine.
Can you pick up this patch and replace the original version of "tpm:
msleep() delays - replace with usleep_range()" with the one Nayna
posted?
Thanks!
Mimi
> ---
> drivers/char/tpm/tpm_i2c_nuvoton.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
> index 0c98c42..c642877 100644
> --- a/drivers/char/tpm/tpm_i2c_nuvoton.c
> +++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
> @@ -124,8 +124,9 @@ static s32 i2c_nuvoton_write_status(struct i2c_client *client, u8 data)
> /* this causes the current command to be aborted */
> for (i = 0, status = -1; i < TPM_I2C_RETRY_COUNT && status < 0; i++) {
> status = i2c_nuvoton_write_buf(client, TPM_STS, 1, &data);
> - usleep_range(TPM_I2C_BUS_DELAY, TPM_I2C_BUS_DELAY
> - + TPM_I2C_DELAY_RANGE);
> + if (status < 0)
> + usleep_range(TPM_I2C_BUS_DELAY, TPM_I2C_BUS_DELAY
> + + TPM_I2C_DELAY_RANGE);
> }
> return status;
> }
next prev parent reply other threads:[~2017-03-13 14:54 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-10 18:45 [PATCH v1 1/2] tpm: msleep() delays - replace with usleep_range() in i2c nuvoton driver Nayna Jain
2017-03-10 18:45 ` Nayna Jain
2017-03-10 18:45 ` Nayna Jain
2017-03-10 18:45 ` [PATCH 2/2] tpm: add sleep only for retry in i2c_nuvoton_write_status() Nayna Jain
2017-03-10 18:45 ` Nayna Jain
2017-03-10 18:45 ` Nayna Jain
2017-03-13 14:54 ` Mimi Zohar [this message]
2017-03-13 14:54 ` [tpmdd-devel] " Mimi Zohar
2017-03-13 14:54 ` Mimi Zohar
2017-03-13 18:26 ` [tpmdd-devel] " Jarkko Sakkinen
2017-03-13 18:26 ` Jarkko Sakkinen
2017-03-17 19:02 ` Jarkko Sakkinen
2017-03-17 19:02 ` Jarkko Sakkinen
2017-03-17 19:02 ` Jarkko Sakkinen
2017-03-15 15:52 ` [PATCH v1 1/2] tpm: msleep() delays - replace with usleep_range() in i2c nuvoton driver Jarkko Sakkinen
2017-03-15 15:52 ` Jarkko Sakkinen
2017-03-15 15:52 ` Jarkko Sakkinen
2017-03-15 16:21 ` Nayna
2017-03-15 16:21 ` Nayna
2017-03-15 16:21 ` Nayna
2017-03-15 17:59 ` Jarkko Sakkinen
2017-03-15 17:59 ` Jarkko Sakkinen
2017-03-17 18:57 ` Jarkko Sakkinen
2017-03-17 18:57 ` Jarkko Sakkinen
2017-03-17 18:57 ` Jarkko Sakkinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1489416862.28954.156.camel@linux.vnet.ibm.com \
--to=zohar@linux.vnet.ibm.com \
--cc=linux-security-module@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.