Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3348413ybb; Sun, 22 Mar 2020 22:19:56 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsexQDanLINPb4CaHK+lZTkXgMke5OZqjcVWGWsVsWAlGysheNWTL/Guc3oWjrBhuMdzReL X-Received: by 2002:a9d:53c2:: with SMTP id i2mr16756088oth.11.1584940796701; Sun, 22 Mar 2020 22:19:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584940796; cv=none; d=google.com; s=arc-20160816; b=ry7NevBcTLrtI7v0l7TEJW/SpdCIabdY489CoTg7KOE1s4Kx4dBBdHEFT4cLU1/GlZ 0YUfdmeaBVyeie/KfbBKyOoz+yfqX0cFEmmT2VfD5rHA3ooFlZS7AewUnmy0X6lZiM96 xeIeFnh/H7f9vGgZau18oh5XJdtRbIb9Iz9T0Tj5KHUwBL0jGbuj+MKpeOtAuEQTZMu8 CiCdisYMZ06hSte+jQNPIwTpO6QFbE4hG2WgI1ULVnUPXs2ADjHPGG7CVWJvqQpEx8ih UILe3+sNhRpzXPmQ7SKMq0nCt8EwzR6GSIrH6jCHf5oMWQVfCA81FSfulNzyYnNGWABE pcvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=IcgbjzKowUkCupaNXAnzQueajHe92nzVfeSmuLjmB8o=; b=WdP/ku75oBL73fWR0gXvwwoTNpmSxHw4J7+EjG+Gdav1zPqXSbM4YgvajThEiEL+51 MLZ4JgO3gj6l2b4YoRMhFmPVN0vf0OhLW5NHJrFAuc1FoXIUW00CKdhpb+Fv2EYbDGxW FsGGYRxFruzGDirLUvQJ52f2abWLhXXuETSTJqmkt2InyR/bRvmQkZ/TyqJFTI7DbN2K w/hy+CWjBWCXVKfsWZGQfpcAPHfOBM4DkdVyP2h18k2svU8gvcZKrxshp5WujXtZGLq0 /HiF7Nvln0kfky+tXbXvhB2bb9f63fg2odLOURGwkqc9oU5OsLiGQ4iHjqAyxcu/CY/s EQUA== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w81si7261836oia.48.2020.03.22.22.19.42; Sun, 22 Mar 2020 22:19:56 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725955AbgCWFSj convert rfc822-to-8bit (ORCPT + 99 others); Mon, 23 Mar 2020 01:18:39 -0400 Received: from mga03.intel.com ([134.134.136.65]:60909 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725858AbgCWFSj (ORCPT ); Mon, 23 Mar 2020 01:18:39 -0400 IronPort-SDR: STbwYfMLrHKV0pI/X1HDn2OQoIuCM+ENUnWcAHpYaI/m3dpjlb88twFzb7QNTvoafu/CCgBiT0 Tfj9xvU87YZg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2020 22:18:38 -0700 IronPort-SDR: fts42I0y1TuKNVMM2x1NrRG1/XQgMfJPU8+xcVHSzopzA/cWRcLZx3o4YeiOAwWiCq3bkJp6+H cgD1/N6jlhJg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,295,1580803200"; d="scan'208";a="292471725" Received: from orsmsx106.amr.corp.intel.com ([10.22.225.133]) by FMSMGA003.fm.intel.com with ESMTP; 22 Mar 2020 22:18:37 -0700 Received: from orsmsx155.amr.corp.intel.com (10.22.240.21) by ORSMSX106.amr.corp.intel.com (10.22.225.133) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 22 Mar 2020 22:18:37 -0700 Received: from orsmsx102.amr.corp.intel.com ([169.254.3.165]) by ORSMSX155.amr.corp.intel.com ([169.254.7.107]) with mapi id 14.03.0439.000; Sun, 22 Mar 2020 22:18:36 -0700 From: "Park, Kyung Min" To: Joe Perches , "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" , "Luck, Tony" , "Raj, Ashok" , "Shankar, Ravi V" , "Yu, Fenghua" Subject: RE: [PATCH v2 2/2] x86/delay: Introduce TPAUSE delay Thread-Topic: [PATCH v2 2/2] x86/delay: Introduce TPAUSE delay Thread-Index: AQHV/m3yCORYmsI3CkqI0RgzexuEG6hRtyAAgAPw2LA= Date: Mon, 23 Mar 2020 05:18:36 +0000 Message-ID: <3658BA65DD26AF4BA909BEB2C6DF6181A2A624C9@ORSMSX102.amr.corp.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> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.22.254.139] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Joe, > -----Original Message----- > From: Joe Perches > Sent: Friday, March 20, 2020 3:07 AM > To: Park, Kyung Min ; 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; Luck, Tony > ; Raj, Ashok ; Shankar, Ravi V > ; Yu, Fenghua > Subject: Re: [PATCH v2 2/2] x86/delay: Introduce TPAUSE delay > > 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 Thank you for your comment. I'll update in the next patch.