All of lore.kernel.org
 help / color / mirror / Atom feed
From: jarkko.sakkinen@linux.intel.com (Jarkko Sakkinen)
To: linux-security-module@vger.kernel.org
Subject: [PATCH v1 1/2] tpm: msleep() delays - replace with usleep_range() in i2c nuvoton driver
Date: Wed, 15 Mar 2017 17:52:26 +0200	[thread overview]
Message-ID: <20170315155226.xtgpttv5slej77ep@intel.com> (raw)
In-Reply-To: <1489171554-6844-1-git-send-email-nayna@linux.vnet.ibm.com>

On Fri, Mar 10, 2017 at 01:45:53PM -0500, Nayna Jain wrote:
> Commit 500462a9de65 "timers: Switch to a non-cascading wheel" replaced
> the 'classic' timer wheel, which aimed for near 'exact' expiry of the
> timers.  Their analysis was that the vast majority of timeout timers
> are used as safeguards, not as real timers, and are cancelled or
> rearmed before expiration.  The only exception noted to this were
> networking timers with a small expiry time.
> 
> Not included in the analysis was the TPM polling timer, which resulted
> in a longer normal delay and, every so often, a very long delay.  The
> non-cascading wheel delay is based on CONFIG_HZ.  For a description of
> the different rings and their delays, refer to the comments in
> kernel/time/timer.c.
> 
> Below are the delays given for rings 0 - 2, which explains the longer
> "normal" delays and the very, long delays as seen on systems with
> CONFIG_HZ 250.
> 
> * HZ 1000 steps
>  * Level Offset  Granularity            Range
>  *  0      0         1 ms                0 ms - 63 ms
>  *  1     64         8 ms               64 ms - 511 ms
>  *  2    128        64 ms              512 ms - 4095 ms (512ms - ~4s)
> 
> * HZ  250
>  * Level Offset  Granularity            Range
>  *  0      0         4 ms                0 ms - 255 ms
>  *  1     64        32 ms              256 ms - 2047 ms (256ms - ~2s)
>  *  2    128       256 ms             2048 ms - 16383 ms (~2s - ~16s)
> 
> Below is a comparison of extending the TPM with 1000 measurements,
> using msleep() vs. usleep_delay() when configured for 1000 hz vs. 250
> hz, before and after commit 500462a9de65.
> 
> linux-4.7 | msleep() usleep_range()
> 1000 hz: 0m44.628s | 1m34.497s 29.243s
> 250 hz: 1m28.510s | 4m49.269s 32.386s
> 
> linux-4.7  | min-max (msleep)  min-max (usleep_range)
> 1000 hz: 0:017 - 2:760s | 0:015 - 3:967s    0:014 - 0:418s
> 250 hz: 0:028 - 1:954s | 0:040 - 4:096s    0:016 - 0:816s
> 
> This patch replaces the msleep() with usleep_range() calls in the
> i2c nuvoton driver with a consistent max range value.
> 
> Signed-of-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
> Cc: stable at vger.kernel.org (linux-4.8)
> Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>
> ---
> Changelog v1:
> 
> - Included Jason's feedbacks related to #defines.

What was changed?

/Jarkko
--
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: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: Nayna Jain <nayna-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"linux-4.8" <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH v1 1/2] tpm: msleep() delays - replace with usleep_range() in i2c nuvoton driver
Date: Wed, 15 Mar 2017 17:52:26 +0200	[thread overview]
Message-ID: <20170315155226.xtgpttv5slej77ep@intel.com> (raw)
In-Reply-To: <1489171554-6844-1-git-send-email-nayna-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>

On Fri, Mar 10, 2017 at 01:45:53PM -0500, Nayna Jain wrote:
> Commit 500462a9de65 "timers: Switch to a non-cascading wheel" replaced
> the 'classic' timer wheel, which aimed for near 'exact' expiry of the
> timers.  Their analysis was that the vast majority of timeout timers
> are used as safeguards, not as real timers, and are cancelled or
> rearmed before expiration.  The only exception noted to this were
> networking timers with a small expiry time.
> 
> Not included in the analysis was the TPM polling timer, which resulted
> in a longer normal delay and, every so often, a very long delay.  The
> non-cascading wheel delay is based on CONFIG_HZ.  For a description of
> the different rings and their delays, refer to the comments in
> kernel/time/timer.c.
> 
> Below are the delays given for rings 0 - 2, which explains the longer
> "normal" delays and the very, long delays as seen on systems with
> CONFIG_HZ 250.
> 
> * HZ 1000 steps
>  * Level Offset  Granularity            Range
>  *  0      0         1 ms                0 ms - 63 ms
>  *  1     64         8 ms               64 ms - 511 ms
>  *  2    128        64 ms              512 ms - 4095 ms (512ms - ~4s)
> 
> * HZ  250
>  * Level Offset  Granularity            Range
>  *  0      0         4 ms                0 ms - 255 ms
>  *  1     64        32 ms              256 ms - 2047 ms (256ms - ~2s)
>  *  2    128       256 ms             2048 ms - 16383 ms (~2s - ~16s)
> 
> Below is a comparison of extending the TPM with 1000 measurements,
> using msleep() vs. usleep_delay() when configured for 1000 hz vs. 250
> hz, before and after commit 500462a9de65.
> 
> linux-4.7 | msleep() usleep_range()
> 1000 hz: 0m44.628s | 1m34.497s 29.243s
> 250 hz: 1m28.510s | 4m49.269s 32.386s
> 
> linux-4.7  | min-max (msleep)  min-max (usleep_range)
> 1000 hz: 0:017 - 2:760s | 0:015 - 3:967s    0:014 - 0:418s
> 250 hz: 0:028 - 1:954s | 0:040 - 4:096s    0:016 - 0:816s
> 
> This patch replaces the msleep() with usleep_range() calls in the
> i2c nuvoton driver with a consistent max range value.
> 
> Signed-of-by: Mimi Zohar <zohar-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
> Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org (linux-4.8)
> Signed-off-by: Nayna Jain <nayna-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
> ---
> Changelog v1:
> 
> - Included Jason's feedbacks related to #defines.

What was changed?

/Jarkko

------------------------------------------------------------------------------
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: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Nayna Jain <nayna@linux.vnet.ibm.com>
Cc: tpmdd-devel@lists.sourceforge.net, peterhuewe@gmx.de,
	tpmdd@selhorst.net, jgunthorpe@obsidianresearch.com,
	dan.morav@nuvoton.com, linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"linux-4.8" <stable@vger.kernel.org>
Subject: Re: [PATCH v1 1/2] tpm: msleep() delays - replace with usleep_range() in i2c nuvoton driver
Date: Wed, 15 Mar 2017 17:52:26 +0200	[thread overview]
Message-ID: <20170315155226.xtgpttv5slej77ep@intel.com> (raw)
In-Reply-To: <1489171554-6844-1-git-send-email-nayna@linux.vnet.ibm.com>

On Fri, Mar 10, 2017 at 01:45:53PM -0500, Nayna Jain wrote:
> Commit 500462a9de65 "timers: Switch to a non-cascading wheel" replaced
> the 'classic' timer wheel, which aimed for near 'exact' expiry of the
> timers.  Their analysis was that the vast majority of timeout timers
> are used as safeguards, not as real timers, and are cancelled or
> rearmed before expiration.  The only exception noted to this were
> networking timers with a small expiry time.
> 
> Not included in the analysis was the TPM polling timer, which resulted
> in a longer normal delay and, every so often, a very long delay.  The
> non-cascading wheel delay is based on CONFIG_HZ.  For a description of
> the different rings and their delays, refer to the comments in
> kernel/time/timer.c.
> 
> Below are the delays given for rings 0 - 2, which explains the longer
> "normal" delays and the very, long delays as seen on systems with
> CONFIG_HZ 250.
> 
> * HZ 1000 steps
>  * Level Offset  Granularity            Range
>  *  0      0         1 ms                0 ms - 63 ms
>  *  1     64         8 ms               64 ms - 511 ms
>  *  2    128        64 ms              512 ms - 4095 ms (512ms - ~4s)
> 
> * HZ  250
>  * Level Offset  Granularity            Range
>  *  0      0         4 ms                0 ms - 255 ms
>  *  1     64        32 ms              256 ms - 2047 ms (256ms - ~2s)
>  *  2    128       256 ms             2048 ms - 16383 ms (~2s - ~16s)
> 
> Below is a comparison of extending the TPM with 1000 measurements,
> using msleep() vs. usleep_delay() when configured for 1000 hz vs. 250
> hz, before and after commit 500462a9de65.
> 
> linux-4.7 | msleep() usleep_range()
> 1000 hz: 0m44.628s | 1m34.497s 29.243s
> 250 hz: 1m28.510s | 4m49.269s 32.386s
> 
> linux-4.7  | min-max (msleep)  min-max (usleep_range)
> 1000 hz: 0:017 - 2:760s | 0:015 - 3:967s    0:014 - 0:418s
> 250 hz: 0:028 - 1:954s | 0:040 - 4:096s    0:016 - 0:816s
> 
> This patch replaces the msleep() with usleep_range() calls in the
> i2c nuvoton driver with a consistent max range value.
> 
> Signed-of-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
> Cc: stable@vger.kernel.org (linux-4.8)
> Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>
> ---
> Changelog v1:
> 
> - Included Jason's feedbacks related to #defines.

What was changed?

/Jarkko

  parent reply	other threads:[~2017-03-15 15:52 UTC|newest]

Thread overview: 26+ 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   ` [tpmdd-devel] " Mimi Zohar
2017-03-13 14:54     ` 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 ` Jarkko Sakkinen [this message]
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 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
  -- strict thread matches above, loose matches on Subject: below --
2017-03-10 18:15 Nayna Jain

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=20170315155226.xtgpttv5slej77ep@intel.com \
    --to=jarkko.sakkinen@linux.intel.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.