Received: by 10.223.185.116 with SMTP id b49csp3674343wrg; Tue, 6 Mar 2018 03:08:14 -0800 (PST) X-Google-Smtp-Source: AG47ELuEPTBG+gtGujW80hfjw6IulDBomSPbC5z/ib9QuNm7XZMM78EMosgTnjqt7dn6mzuq+vdB X-Received: by 2002:a17:902:8bc3:: with SMTP id r3-v6mr16300180plo.450.1520334493954; Tue, 06 Mar 2018 03:08:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520334493; cv=none; d=google.com; s=arc-20160816; b=ddRfEutzc5oCcirx4RiEGOOxtlDPv4MDTjg/5szLaT0ahrjl6dNDrPC/lWIFI5Uudu SAE13PpstI7d2fAFDQspW+VMuWsmAcbTNlkr61BZNhmD92vKHUnN0ZofTQLRKnxt0bjE 94NG66l1qVJFNBfwIDxn/MCLZreHflqX5z7iSIyfg/3rg4AlOkj6MbZhKLFtitzd4gNn ew80H96A5Ix+GyIECFjtW1yxm5ZFCd69Ag/nCcysDOsilb+bDsbBWDCrztfdPMUIiiT7 0PkipA3Sx4rj9oKp28et2mit0/MAX8VyQ8maw7K2Le4pwZ3PYdLOBTkYLU6he0tAOCFO jqvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:date:cc:to:from:subject :message-id:arc-authentication-results; bh=7Bg8bDmDiBHRL62kTUlZpvQ/EfVe3Mjj09W8hlBSD3U=; b=ATce8HcOiaiJuGLggFbujxBe0mDcIXSXO4kzB6F+1ZYvVVPGp1AmA5D6lkHXJx6tyv ef2MNYHOXmkIBtYRxWYl5OTxhKfbD69OV8xQa2jEwAIXABasrhTfSaupL4fDJ8+7ZsDx 7Jb+Hkntrf6bXATae/himJ16photepRJXz9AtJXITcd4n6EW2dplcpfuaix7Tdiy20uW k1LhlPg5y57mZPI8u3wry+7JG9WnuKZqmknu3l4A+CK/S3XR2e00ZSfrIetCU7eJYAtX 8Xxz51ynY21L45WEsRacGMsBk3qFcrBt9phdb3o2YgRYQUqknK1X7biddO/shd3JUUNs mwgw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n18si11832159pfj.58.2018.03.06.03.07.59; Tue, 06 Mar 2018 03:08:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753524AbeCFLGU (ORCPT + 99 others); Tue, 6 Mar 2018 06:06:20 -0500 Received: from mga09.intel.com ([134.134.136.24]:10755 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753024AbeCFLGS (ORCPT ); Tue, 6 Mar 2018 06:06:18 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2018 03:06:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,431,1515484800"; d="scan'208";a="39590256" Received: from acaglaya-mobl.ger.corp.intel.com ([10.249.254.150]) by orsmga002.jf.intel.com with ESMTP; 06 Mar 2018 03:06:14 -0800 Message-ID: <1520334372.7549.2.camel@linux.intel.com> Subject: Re: [PATCH 2/3] tpm: reduce poll sleep time between send() and recv() in tpm_transmit() From: Jarkko Sakkinen To: Mimi Zohar , Nayna Jain Cc: linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, peterhuewe@gmx.de, tpmdd@selhorst.net, jgunthorpe@obsidianresearch.com, patrickc@us.ibm.com Date: Tue, 06 Mar 2018 13:06:12 +0200 In-Reply-To: <1520276852.10396.351.camel@linux.vnet.ibm.com> References: <20180228191828.20056-1-nayna@linux.vnet.ibm.com> <20180228191828.20056-2-nayna@linux.vnet.ibm.com> <20180301092222.GC29420@linux.intel.com> <6ef601be-5627-6746-bd4a-4f391aba8b04@linux.vnet.ibm.com> <20180305105633.GE25377@linux.intel.com> <20180305180144.GE5791@linux.intel.com> <1520276852.10396.351.camel@linux.vnet.ibm.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.5-1build1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2018-03-05 at 14:07 -0500, Mimi Zohar wrote: > 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: > > > On Fri, Mar 02, 2018 at 12:26:35AM +0530, Nayna Jain wrote: > > > > > > > > > > > > On 03/01/2018 02:52 PM, Jarkko Sakkinen wrote: > > > > > On Wed, Feb 28, 2018 at 02:18:27PM -0500, Nayna Jain wrote: > > > > > > 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. > > > > > > > > > > > - 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 We can move to usleep_range() in call sites where it makes sense instead of adjusting tpm_msleep() implementation... /Jarkko