Thread (13 messages) flat view 13 messages, 3 authors, 2018-03-06

Re: [PATCH 2/3] tpm: reduce poll sleep time between send() and recv() in tpm_transmit()

From: Mimi Zohar <hidden>
Date: 2018-03-05 19:07:47
Also in: linux-security-module, lkml

On Mon, 2018-03-05 at 20:01 +0200, Jarkko Sakkinen wrote:
On Mon, Mar 05, 2018 at 12:56:33PM +0200, Jarkko Sakkinen wrote:
quoted
On Fri, Mar 02, 2018 at 12:26:35AM +0530, Nayna Jain wrote:
quoted

On 03/01/2018 02:52 PM, Jarkko Sakkinen wrote:
quoted
On Wed, Feb 28, 2018 at 02:18:27PM -0500, Nayna Jain wrote:
quoted
In tpm_transmit, after send(), the code checks for status in a loop
Maybe cutting hairs now but please just use the actual function name
instead of send(). Just makes the commit log more useful asset.
Sure, will do.
quoted
quoted
-		tpm_msleep(TPM_TIMEOUT);
+		tpm_msleep(TPM_TIMEOUT_POLL);
What about just calling schedule()?
I'm not sure what you mean by "schedule()".  Are you suggesting instead of
using usleep_range(),  using something with an even finer grain construct?

Thanks & Regards,
     - Nayna
kernel/sched/core.c
The question I'm trying ask to is: is it better to sleep such a short
time or just ask scheduler to schedule something else after each
iteration?
I still don't understand why scheduling some work would be an
improvement.  We still need to loop, testing for the TPM command to
complete.

According to the schedule_hrtimeout_range() function comment,
schedule_hrtimeout_range() is both power and performance friendly.
 What we didn't realize is that the hrtimer *uses* the maximum range
to calculate the sleep time, but *may* return earlier based on the
minimum time.

This patch minimizes the tpm_msleep().  The subsequent patch in this
patch set shows that 1 msec isn't fine enough granularity.  I still
think calling usleep_range() is the right solution, but it needs to be
at a finer granularity than tpm_msleep() provides.

Mimi
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help