Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1091605ybi; Fri, 24 May 2019 17:09:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwN7DqClYJ/7Sid8HYPAL6uzoNY5nSDPaZWP2KnTWuOjysk8+qCewtkVa4jn1Rym8P00JYU X-Received: by 2002:a17:902:8ec4:: with SMTP id x4mr9367079plo.249.1558742951968; Fri, 24 May 2019 17:09:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558742951; cv=none; d=google.com; s=arc-20160816; b=mTwriZS24AC74r+uRXadzjzgKbJmzsGV44siFgNFZ6YJLvRuZaI5LmreIRUJBsV9JP VcQXuS2AknBk8jYOuh/Vue7/KJMpfijjNhbURHrRFru07roGHh44l7YszyzbpGJV9hMB Dkz/Vg8UQ8UTodYtMX7ns2pq1hgQeCpYQU8IeSgy9AGsbS7BbanjJt/CrT1Ie9U5M5TI XoEG+piHJ0H6GbUdXwCVR34jXiOBqqdoJyBOEZimEAlpnQbu76WmGJ4JDef52Aa1+TwP 2bBbvaXvt8WxZUm59YNTWOPsb8R4KMQV7sEdHy65akDcQQjKfuFvyiAmjAfrddKMkdGn jGgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=/ccRwvMb3trCCfSlXpnY0E/RAJXEYRCEEEqAyHKeHSE=; b=H2yAngbDSWI9Yxkhd1CvcT4BhKaLMMJcfOO/+yKhs+lvSLXKSqOlUOMiq5oc1Nl7K9 Lpy+Nruyk5MzstpTMJfahfgAXNCoORizUR+SEn0xOaN7nsIyaI+aJffUO4ezdoSLalTS Y6ztKSmaDmM/as+A6q/Cl1aQ0pkV9+vz/ugIJ2zQM74rPx0oYwslTWVrHBkwOJxzgs64 CLzhWZuJaryHal3xcvzk6ONCB/rb1xMokmc5++RjZLpTbp/CrNre2W1BHQhGuQMAUqwC TW4vNV0UZ49XaKy8k6CziTPSjwZpb5+M6ZpM81bE5UywfVK15QuX9YheVZZ2eJ/1VwLr XNQA== 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 c123si6724045pfg.35.2019.05.24.17.08.56; Fri, 24 May 2019 17:09:11 -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 S1726490AbfEYAFh (ORCPT + 99 others); Fri, 24 May 2019 20:05:37 -0400 Received: from mga01.intel.com ([192.55.52.88]:36240 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726015AbfEYAFQ (ORCPT ); Fri, 24 May 2019 20:05:16 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 May 2019 17:05:15 -0700 X-ExtLoop1: 1 Received: from romley-ivt3.sc.intel.com ([172.25.110.60]) by orsmga005.jf.intel.com with ESMTP; 24 May 2019 17:05:15 -0700 From: Fenghua Yu To: "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "H Peter Anvin" , "Andy Lutomirski" , "Andrew Cooper" , "Ashok Raj" , "Tony Luck" , "Ravi V Shankar" Cc: "linux-kernel" , "x86" , Fenghua Yu Subject: [PATCH v3 1/5] x86/cpufeatures: Enumerate user wait instructions Date: Fri, 24 May 2019 16:55:58 -0700 Message-Id: <1558742162-73402-2-git-send-email-fenghua.yu@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1558742162-73402-1-git-send-email-fenghua.yu@intel.com> References: <1558742162-73402-1-git-send-email-fenghua.yu@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org umonitor, umwait, and tpause are a set of user wait instructions. umonitor arms address monitoring hardware using an address. The address range is determined by using CPUID.0x5. A store to an address within the specified address range triggers the monitoring hardware to wake up the processor waiting in umwait. umwait instructs the processor to enter an implementation-dependent optimized state while monitoring a range of addresses. The optimized state may be either a light-weight power/performance optimized state (C0.1 state) or an improved power/performance optimized state (C0.2 state). tpause instructs the processor to enter an implementation-dependent optimized state C0.1 or C0.2 state and wake up when time-stamp counter reaches specified timeout. The three instructions may be executed at any privilege level. The instructions provide power saving method while waiting in user space. Additionally, they can allow a sibling hyperthread to make faster progress while this thread is waiting. One example of an application usage of umwait is when waiting for input data from another application, such as a user level multi-threaded packet processing engine. Availability of the user wait instructions is indicated by the presence of the CPUID feature flag WAITPKG CPUID.0x07.0x0:ECX[5]. Detailed information on the instructions and CPUID feature WAITPKG flag can be found in the latest Intel Architecture Instruction Set Extensions and Future Features Programming Reference and Intel 64 and IA-32 Architectures Software Developer's Manual. Signed-off-by: Fenghua Yu Reviewed-by: Ashok Raj --- arch/x86/include/asm/cpufeatures.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 75f27ee2c263..b8bd428ae5bc 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -322,6 +322,7 @@ #define X86_FEATURE_UMIP (16*32+ 2) /* User Mode Instruction Protection */ #define X86_FEATURE_PKU (16*32+ 3) /* Protection Keys for Userspace */ #define X86_FEATURE_OSPKE (16*32+ 4) /* OS Protection Keys Enable */ +#define X86_FEATURE_WAITPKG (16*32+ 5) /* UMONITOR/UMWAIT/TPAUSE Instructions */ #define X86_FEATURE_AVX512_VBMI2 (16*32+ 6) /* Additional AVX512 Vector Bit Manipulation Instructions */ #define X86_FEATURE_GFNI (16*32+ 8) /* Galois Field New Instructions */ #define X86_FEATURE_VAES (16*32+ 9) /* Vector AES */ -- 2.19.1