Your subject line looks wrong. This cannot be cleanly applied with git
am.

Please go through https://kernelnewbies.org/FirstKernelPatch

On Wed, Jul 12, 2017 at 12:34:19PM +0000, Attak, Hamza wrote:
> msleep() delays - replace with usleep_range() in TPM 1.2/2.0 generic drivers
> 
> The patch simply replaces all msleep function calls with usleep_range calls in
> the generic drivers.
> 
> Tested with an Infineon TPM 1.2, using the generic tpm-tis module, for a
> thousand PCR extends, we see results going from 1m57s unpatched to 40s with
> the new patch. We obtain similar results when using the original and patched
> tpm_infineon driver, which is also part of the patch. Similarly with a STM TPM
> 2.0, using the CRB driver, it takes about 20ms per extend unpatched and around
> 7ms with the new patch.
> 
> Note that the PCR consistency is untouched with this patch, each TPM has been
> tested with 10 million extends and the aggregated PCR value is continuously
> verified to be correct.
> 
> As an extension of this work, this could potentially and easily be applied to
> other vendor's drivers. Still, these changes are not included in the proposed
> patch as they are untested.
> 
> Signed-off-by: Hamza Attak <ha...@hpe.com>
> ---
>  drivers/char/tpm/tpm-interface.c | 13 ++++++++-----
>  drivers/char/tpm/tpm2-cmd.c      |  2 +-
>  drivers/char/tpm/tpm_infineon.c  |  9 ++++++---
>  drivers/char/tpm/tpm_tis_core.c  |  9 +++++----
>  4 files changed, 20 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm-interface.c 
> b/drivers/char/tpm/tpm-interface.c
> index bd2128e..513b801 100644
> --- a/drivers/char/tpm/tpm-interface.c
> +++ b/drivers/char/tpm/tpm-interface.c
> @@ -395,7 +395,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const u8 
> *buf, size_t bufsiz,
>                       goto out;
>               }
>  
> -             msleep(TPM_TIMEOUT);    /* CHECK */
> +             usleep_range(TPM_TIMEOUT * 1000, (TPM_TIMEOUT * 1000) + 300);

Plese look into.

https://patchwork.kernel.org/patch/9617823/

Now you are sprinkling magic numbers everywhere.

>               rmb();
>       } while (time_before(jiffies, stop));
>  
> @@ -862,7 +862,8 @@ int tpm_do_selftest(struct tpm_chip *chip)
>                       dev_info(
>                           &chip->dev, HW_ERR
>                           "TPM command timed out during continue self test");
> -                     msleep(delay_msec);
> +                     usleep_range(delay_msec * 1000,
> +                             (delay_msec * 1000) + 300);

The second line dooes not look properly aligned.

There's probably similar style issues elsewhere in the patch (at least
spotted one after this).

/Jarkko

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
tpmdd-devel mailing list
tpmdd-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tpmdd-devel

Reply via email to