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


Groups > linux.kernel > #1731321 > unrolled thread

Re: [PATCH v2 3/4] tpm: reduce tpm_msleep() time in get_burstcount()

Started byJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
First post2017-09-13 03:10 +0200
Last post2017-09-15 14:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v2 3/4] tpm: reduce tpm_msleep() time in get_burstcount() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-09-13 03:10 +0200
    Re: [PATCH v2 3/4] tpm: reduce tpm_msleep() time in get_burstcount() Nayna Jain <nayna@linux.vnet.ibm.com> - 2017-09-15 14:50 +0200

#1731321 — Re: [PATCH v2 3/4] tpm: reduce tpm_msleep() time in get_burstcount()

FromJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Date2017-09-13 03:10 +0200
SubjectRe: [PATCH v2 3/4] tpm: reduce tpm_msleep() time in get_burstcount()
Message-ID<up4lI-wf-5@gated-at.bofh.it>
On Wed, Sep 06, 2017 at 08:56:38AM -0400, Nayna Jain wrote:
> Currently, get_burstcount() function sleeps for 5msec in a loop
> before retrying for next query to burstcount. However, if it takes
> lesser time for TPM to return, this 5 msec delay is longer
> than necessary.
> 
> This patch replaces the tpm_msleep time from 5msec to 1msec.
> 
> After this change, performance on a TPM 1.2 with an 8 byte
> burstcount for 1000 extends improved from ~10sec to ~9sec.
> 
> Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>
> Acked-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
> ---
>  drivers/char/tpm/tpm_tis_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> index d1eab29cb447..d710bbc4608b 100644
> --- a/drivers/char/tpm/tpm_tis_core.c
> +++ b/drivers/char/tpm/tpm_tis_core.c
> @@ -169,7 +169,7 @@ static int get_burstcount(struct tpm_chip *chip)
>  		burstcnt = (value >> 8) & 0xFFFF;
>  		if (burstcnt)
>  			return burstcnt;
> -		tpm_msleep(TPM_TIMEOUT);
> +		tpm_msleep(1);
>  	} while (time_before(jiffies, stop));
>  	return -EBUSY;
>  }
> -- 
> 2.13.3

How did you pick 1 ms delay? Should there be a constant defining it?

/Jarkko

[toc] | [next] | [standalone]


#1732871

FromNayna Jain <nayna@linux.vnet.ibm.com>
Date2017-09-15 14:50 +0200
Message-ID<upYed-2Qq-13@gated-at.bofh.it>
In reply to#1731321

On 09/13/2017 06:30 AM, Jarkko Sakkinen wrote:
> On Wed, Sep 06, 2017 at 08:56:38AM -0400, Nayna Jain wrote:
>> Currently, get_burstcount() function sleeps for 5msec in a loop
>> before retrying for next query to burstcount. However, if it takes
>> lesser time for TPM to return, this 5 msec delay is longer
>> than necessary.
>>
>> This patch replaces the tpm_msleep time from 5msec to 1msec.
>>
>> After this change, performance on a TPM 1.2 with an 8 byte
>> burstcount for 1000 extends improved from ~10sec to ~9sec.
>>
>> Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>
>> Acked-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
>> ---
>>   drivers/char/tpm/tpm_tis_core.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
>> index d1eab29cb447..d710bbc4608b 100644
>> --- a/drivers/char/tpm/tpm_tis_core.c
>> +++ b/drivers/char/tpm/tpm_tis_core.c
>> @@ -169,7 +169,7 @@ static int get_burstcount(struct tpm_chip *chip)
>>   		burstcnt = (value >> 8) & 0xFFFF;
>>   		if (burstcnt)
>>   			return burstcnt;
>> -		tpm_msleep(TPM_TIMEOUT);
>> +		tpm_msleep(1);
>>   	} while (time_before(jiffies, stop));
>>   	return -EBUSY;
>>   }
>> -- 
>> 2.13.3
> How did you pick 1 ms delay? Should there be a constant defining it?

As per ddwg input, the command may not take more than a few
microseconds. The minimum tpm_msleep() value is 1 msec, so we really
don't have a choice.  (We're working on a patch set to lower this
value even more.)

Thanks & Regards,
     - Nayna

>
> /Jarkko
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web