Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753114AbdCOQXn (ORCPT ); Wed, 15 Mar 2017 12:23:43 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:47248 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752537AbdCOQWl (ORCPT ); Wed, 15 Mar 2017 12:22:41 -0400 Subject: Re: [PATCH v1 1/2] tpm: msleep() delays - replace with usleep_range() in i2c nuvoton driver To: Jarkko Sakkinen References: <1489171554-6844-1-git-send-email-nayna@linux.vnet.ibm.com> <20170315155226.xtgpttv5slej77ep@intel.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" From: Nayna Date: Wed, 15 Mar 2017 21:51:47 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20170315155226.xtgpttv5slej77ep@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 17031516-0044-0000-0000-000002D4A660 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006787; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000206; SDB=6.00834235; UDB=6.00409663; IPR=6.00611892; BA=6.00005214; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00014661; XFM=3.00000013; UTC=2017-03-15 16:22:37 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17031516-0045-0000-0000-00000702C5C6 Message-Id: <58C96A1B.3080803@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-03-15_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1703150125 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2678 Lines: 74 On 03/15/2017 09:22 PM, Jarkko Sakkinen wrote: > 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 >> Cc: stable@vger.kernel.org (linux-4.8) >> Signed-off-by: Nayna Jain >> --- >> Changelog v1: >> >> - Included Jason's feedbacks related to #defines. > > What was changed? > Changelog v1: >> >> - Included Jason's feedbacks related to #defines. Based on Jason's review: - Added () in #define - Replaced hardcoded maximum range value with defined name. Hmm.. could have included exact details. Thanks & Regards, - Nayna > /Jarkko >