From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964940AbeAXRUd (ORCPT ); Wed, 24 Jan 2018 12:20:33 -0500 Received: from mga06.intel.com ([134.134.136.31]:29097 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964790AbeAXRUc (ORCPT ); Wed, 24 Jan 2018 12:20:32 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,408,1511856000"; d="scan'208";a="24405737" From: "Sun, Ning" To: Jia-Ju Bai , Thomas Gleixner CC: "mingo@redhat.com" , "hpa@zytor.com" , "x86@kernel.org" , "tboot-devel@lists.sourceforge.net" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] kernel: x86: tboot: Replace mdelay with usleep_range in tboot_wait_for_aps Thread-Topic: [PATCH] kernel: x86: tboot: Replace mdelay with usleep_range in tboot_wait_for_aps Thread-Index: AQHTlLYyaQNQgTFBT06BHlNCfoq9rKODbuSAgAAe1QD//7Zd0A== Date: Wed, 24 Jan 2018 17:20:30 +0000 Message-ID: <83BE7A8C0111FD48951B68B36BEFDFD40D135D39@ORSMSX107.amr.corp.intel.com> References: <1516759102-17549-1-git-send-email-baijiaju1990@gmail.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYjE0MDRjMDQtNTYyNS00MTZkLWE4NjEtNGRhYjI3YTg2ZmMwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJFbnUxNW9VeUZZWjhuY2tMZ1wvVG9NU295ZlVIdXZ6N1N3eTZxXC9UeEZpT3g4RTZHMDJxNGpjVWJmdnpjUUY5UG4ifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.22.254.140] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id w0OHKi5R012227 It looks like tboot_wait_for_aps(...) is not called in atomic context . mdelay(1) delays exactly 1msecs, I understand udelay(...) may not be appropriate, as it is used for delay around 20usecs. In terms of reducing busy wait, how can we determine the range in usleep_range(...) is 1000 to 2000, not from 20 to 1000? Thanks, -ning -----Original Message----- From: Jia-Ju Bai [mailto:baijiaju1990@gmail.com] Sent: Wednesday, January 24, 2018 5:38 AM To: Thomas Gleixner Cc: Sun, Ning ; mingo@redhat.com; hpa@zytor.com; x86@kernel.org; tboot-devel@lists.sourceforge.net; linux-kernel@vger.kernel.org Subject: Re: [PATCH] kernel: x86: tboot: Replace mdelay with usleep_range in tboot_wait_for_aps On 2018/1/24 19:47, Thomas Gleixner wrote: > On Wed, 24 Jan 2018, Jia-Ju Bai wrote: > >> The function tboot_wait_for_aps is not called in atomic context. >> Thus mdelay can be replaced with usleep_range, to reduce busy wait. > And how did you establish that it's not called in atomic context? > > Thanks, > > tglx It is reported by a static analysis tool written by myself. This tool finds that mdelay in tboot_wait_for_aps is not called by holding a spinlock or in an interrupt handler, thus mdelay can be replaced. Thanks, Jia-Ju Bai