Received: by 10.223.185.116 with SMTP id b49csp2943122wrg; Mon, 5 Mar 2018 11:10:45 -0800 (PST) X-Google-Smtp-Source: AG47ELtjQWDsvT23LAWEHaSUdS7aTn7Tg9oC6N0v/4cnr7Q2yHTOrgioVbG/8TsChfYg3HtH+SHP X-Received: by 2002:a17:902:ac1:: with SMTP id 59-v6mr14038003plp.228.1520277045079; Mon, 05 Mar 2018 11:10:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520277045; cv=none; d=google.com; s=arc-20160816; b=EFCDz5TVHb+OhUzsH5+wpqWy3Pa6PvN/YrmmHvTpXAcJX9MbMdrGyITIvaS0SwfW/P mvLkawu+bakg08BuX7XodbzNyLsP0yFyC1FqKr1AsYrSp8IIr2423cwUvhMPHYCRJhgV mLiAA4ltIMOh4vbAl0ZsaE4BkuROymYXVPOTrpHG/EGzJAkp7E/WeKvUpjFF5+VrWOoO ZVL55mpP2vJYwYgz3ATI4zcNAQChZiy55kCsOX+E7Rux+TPo/z5hf453az14AX5/jD2F xAqhYJz1j5qH/1EB8tYV/PH3YxsR4bfpKSLVxA/EccJXhG6NRBJxTFgxhTVHYZOgGHWP W8Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:date:cc:to:from:subject :arc-authentication-results; bh=3nJUgLJEld7YC8J8I45E4iQ06qPsk8TxBQx+S28ddB8=; b=Tq3xq3y355QVAcD8E4orKhzXINcAnPE8p8JRw7pLR21K0l9vYmP4Yd2I5P1exhAOyA tL92pwPmBp1dUUjCkpUAZGtSYIRYMUaAqUOKe/hsb5OF64aUTlRClXv3B8NzivEiJ00p wDbnIkXULjOIHWMZ/U2ifAZ1orXsQ9xoXoeOu60S9m5coUHne94Y9iOLDTtNkfBl9/vY XfeNcqQOnlHXoWB0zjhAYAMfGBbgysRMDUna+2fqql1Hf2e5PdnbWZWa8R82GlA9hHeY vsVRojAKFC2iukeFMBFHYd09UcHyBSdQ5IKnfA1s2/UIU/7i5QQuPzWYDuHnFYuRyAdW Pb6g== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e63-v6si9698234plb.161.2018.03.05.11.10.30; Mon, 05 Mar 2018 11:10:45 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752703AbeCETHq (ORCPT + 99 others); Mon, 5 Mar 2018 14:07:46 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59274 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751462AbeCETHp (ORCPT ); Mon, 5 Mar 2018 14:07:45 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w25IwtUZ057747 for ; Mon, 5 Mar 2018 14:07:45 -0500 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0b-001b2d01.pphosted.com with ESMTP id 2gh8q3shjf-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Mon, 05 Mar 2018 14:07:44 -0500 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 5 Mar 2018 19:07:36 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 5 Mar 2018 19:07:34 -0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w25J7XWM1442132; Mon, 5 Mar 2018 19:07:33 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DB86B4204F; Mon, 5 Mar 2018 18:59:57 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F256942047; Mon, 5 Mar 2018 18:59:56 +0000 (GMT) Received: from dhcp-9-2-54-133.watson.ibm.com (unknown [9.2.54.133]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 5 Mar 2018 18:59:56 +0000 (GMT) Subject: Re: [PATCH 2/3] tpm: reduce poll sleep time between send() and recv() in tpm_transmit() From: Mimi Zohar To: Jarkko Sakkinen , 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: Mon, 05 Mar 2018 14:07:32 -0500 In-Reply-To: <20180305180144.GE5791@linux.intel.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> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 18030519-0020-0000-0000-000003FEFB05 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030519-0021-0000-0000-0000429335C4 Message-Id: <1520276852.10396.351.camel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-05_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803050219 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 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