Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp504740ybb; Fri, 20 Mar 2020 03:09:55 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuohcYOXWBJvMk/fA8yG3PJmeJmLcgjBwS1upCnXDrO9qY+gNdnRbXOpKf006SEEXrxTzfq X-Received: by 2002:aca:b60a:: with SMTP id g10mr5577003oif.102.1584698995549; Fri, 20 Mar 2020 03:09:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584698995; cv=none; d=google.com; s=arc-20160816; b=v/fDhdtasKpqLod8HEvAD3g7+DFyrtJ2nuqhOjwbUWbhlQZ40jGp7UbCXJ3zumw3mR f+Pa6MjHJQYeEMJvd7Fl/SZH0N+gEy2fUq2n6Y/z1+hXQr64E7Zqt7FcMSKazWrvQP6y mSRLX7WitMHB7ViZ2dIt/vp0rOAO09rvAPHUGUxAQAn+Ud2z7WxoT6mZQn85JzZAgB1n 2QNvd5sNbQ1iatVEUzwoPM6sNQerJMNTt1RWtFEzOOI1gz9JukiBh15Vpx2DYMF792u0 HHGJF3dz7Wn4m9XmRoaYF1vWdaKBhvZApnKP60nQEI3pGG4SF+5J2AUewV6nl3svRrpv ee6Q== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=MRaN/jdUpsCv/vP71kaYqgVk0TzO988ZmOTR2dyqZq4=; b=ZS4EP+JT+IpyBPEtkSRVeoA2ouXX2J7vobdBN3XuBn2WG9IwZ0wYS9NFBpl35hUSeO PJ6ukTcesw49ljGe+Qt3RZAuNizFLHrulfk/sTrmlwxp1iwr3JDC8xdkfNzF+lLNoDWi LDusc4WaF1oXg/sJwc9NNQnNrcWfEoAH+XtCDwG3hNgAGrySf0gG5SGmhee7qL53KAZr llyIDqdlj+satMjF0Ot65o0wxIjoOySHt/jBYXQjFI8iDLOrylvXdQuVXOAM962YoGyF neZ8jmHgdl1x0MnagzN2SQcWJ8Bz/xo2sivs0eqJn+S1aRW45UC3qVM/2gBSS4LEJ6on 4hGA== 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 o63si2516311oih.74.2020.03.20.03.09.42; Fri, 20 Mar 2020 03:09:55 -0700 (PDT) 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 S1726954AbgCTKJA (ORCPT + 99 others); Fri, 20 Mar 2020 06:09:00 -0400 Received: from smtprelay0127.hostedemail.com ([216.40.44.127]:57604 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726527AbgCTKJA (ORCPT ); Fri, 20 Mar 2020 06:09:00 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay06.hostedemail.com (Postfix) with ESMTP id 69C4E18224D60; Fri, 20 Mar 2020 10:08:59 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,,RULES_HIT:41:355:379:599:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:2904:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3870:3871:4250:4321:5007:6119:7903:9036:10004:10400:10848:11026:11232:11473:11658:11914:12297:12679:12740:12760:12895:13069:13311:13357:13439:14659:14721:21080:21324:21627:21990:30045:30054:30055:30070:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: tent22_886f8e4967e2d X-Filterd-Recvd-Size: 2172 Received: from XPS-9350.home (unknown [47.151.143.254]) (Authenticated sender: joe@perches.com) by omf04.hostedemail.com (Postfix) with ESMTPA; Fri, 20 Mar 2020 10:08:57 +0000 (UTC) Message-ID: Subject: Re: [PATCH v2 2/2] x86/delay: Introduce TPAUSE delay From: Joe Perches To: Kyung Min Park , x86@kernel.org, linux-kernel@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, gregkh@linuxfoundation.org, ak@linux.intel.com, tony.luck@intel.com, ashok.raj@intel.com, ravi.v.shankar@intel.com, fenghua.yu@intel.com Date: Fri, 20 Mar 2020 03:07:10 -0700 In-Reply-To: <1584677604-32707-3-git-send-email-kyung.min.park@intel.com> References: <1584677604-32707-1-git-send-email-kyung.min.park@intel.com> <1584677604-32707-3-git-send-email-kyung.min.park@intel.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.34.1-2 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 Thu, 2020-03-19 at 21:13 -0700, Kyung Min Park wrote: > TPAUSE instructs the processor to enter an implementation-dependent > optimized state. The instruction execution wakes up when the time-stamp > counter reaches or exceeds the implicit EDX:EAX 64-bit input value. > The instruction execution also wakes up due to the expiration of > the operating system time-limit or by an external interrupt > or exceptions such as a debug exception or a machine check exception. [] > diff --git a/arch/x86/lib/delay.c b/arch/x86/lib/delay.c [] > @@ -97,6 +97,27 @@ static void delay_tsc(u64 cycles) > } > > /* > + * On Intel the TPAUSE instruction waits until any of: > + * 1) the TSC counter exceeds the value provided in EAX:EDX > + * 2) global timeout in IA32_UMWAIT_CONTROL is exceeded > + * 3) an external interrupt occurs > + */ > +static void delay_halt_tpause(u64 start, u64 cycles) > +{ > + u64 until = start + cycles; > + unsigned int eax, edx; > + > + eax = (unsigned int)(until & 0xffffffff); > + edx = (unsigned int)(until >> 32); trivia: perhaps lower_32_bits and upper_32_bits