[tip:x86/cpu] x86/cpufeatures: Add EPT_AD feature bit

2018-08-03 Thread tip-bot for Peter Feiner
Commit-ID:  301d328a6f8b53bb86c5ecf72db7bc178bcf1999
Gitweb: https://git.kernel.org/tip/301d328a6f8b53bb86c5ecf72db7bc178bcf1999
Author: Peter Feiner 
AuthorDate: Wed, 1 Aug 2018 11:06:57 -0700
Committer:  Thomas Gleixner 
CommitDate: Fri, 3 Aug 2018 12:36:23 +0200

x86/cpufeatures: Add EPT_AD feature bit

Some Intel processors have an EPT feature whereby the accessed & dirty bits
in EPT entries can be updated by HW. MSR IA32_VMX_EPT_VPID_CAP exposes the
presence of this capability.

There is no point in trying to use that new feature bit in the VMX code as
VMX needs to read the MSR anyway to access other bits, but having the
feature bit for EPT_AD in place helps virtualization management as it
exposes "ept_ad" in /proc/cpuinfo/$proc/flags if the feature is present.

[ tglx: Amended changelog ]

Signed-off-by: Peter Feiner 
Signed-off-by: Peter Shier 
Signed-off-by: Thomas Gleixner 
Reviewed-by: Jim Mattson 
Cc: "H. Peter Anvin" 
Cc: Borislav Petkov 
Cc: Konrad Rzeszutek Wilk 
Cc: David Woodhouse 
Link: https://lkml.kernel.org/r/20180801180657.138051-1-psh...@google.com

---
 arch/x86/include/asm/cpufeatures.h |  2 +-
 arch/x86/kernel/cpu/intel.c| 10 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/cpufeatures.h 
b/arch/x86/include/asm/cpufeatures.h
index 5701f5cecd31..7fff98fa5855 100644
--- a/arch/x86/include/asm/cpufeatures.h
+++ b/arch/x86/include/asm/cpufeatures.h
@@ -229,7 +229,7 @@
 
 #define X86_FEATURE_VMMCALL( 8*32+15) /* Prefer VMMCALL to VMCALL 
*/
 #define X86_FEATURE_XENPV  ( 8*32+16) /* "" Xen paravirtual guest 
*/
-
+#define X86_FEATURE_EPT_AD ( 8*32+17) /* Intel Extended Page Table 
access-dirty bit */
 
 /* Intel-defined CPU features, CPUID level 0x0007:0 (EBX), word 9 */
 #define X86_FEATURE_FSGSBASE   ( 9*32+ 0) /* RDFSBASE, WRFSBASE, 
RDGSBASE, WRGSBASE instructions*/
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index eb75564f2d25..c050cd6066af 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -465,14 +465,17 @@ static void detect_vmx_virtcap(struct cpuinfo_x86 *c)
 #define X86_VMX_FEATURE_PROC_CTLS2_VIRT_APIC   0x0001
 #define X86_VMX_FEATURE_PROC_CTLS2_EPT 0x0002
 #define X86_VMX_FEATURE_PROC_CTLS2_VPID0x0020
+#define x86_VMX_FEATURE_EPT_CAP_AD 0x0020
 
u32 vmx_msr_low, vmx_msr_high, msr_ctl, msr_ctl2;
+   u32 msr_vpid_cap, msr_ept_cap;
 
clear_cpu_cap(c, X86_FEATURE_TPR_SHADOW);
clear_cpu_cap(c, X86_FEATURE_VNMI);
clear_cpu_cap(c, X86_FEATURE_FLEXPRIORITY);
clear_cpu_cap(c, X86_FEATURE_EPT);
clear_cpu_cap(c, X86_FEATURE_VPID);
+   clear_cpu_cap(c, X86_FEATURE_EPT_AD);
 
rdmsr(MSR_IA32_VMX_PROCBASED_CTLS, vmx_msr_low, vmx_msr_high);
msr_ctl = vmx_msr_high | vmx_msr_low;
@@ -487,8 +490,13 @@ static void detect_vmx_virtcap(struct cpuinfo_x86 *c)
if ((msr_ctl2 & X86_VMX_FEATURE_PROC_CTLS2_VIRT_APIC) &&
(msr_ctl & X86_VMX_FEATURE_PROC_CTLS_TPR_SHADOW))
set_cpu_cap(c, X86_FEATURE_FLEXPRIORITY);
-   if (msr_ctl2 & X86_VMX_FEATURE_PROC_CTLS2_EPT)
+   if (msr_ctl2 & X86_VMX_FEATURE_PROC_CTLS2_EPT) {
set_cpu_cap(c, X86_FEATURE_EPT);
+   rdmsr(MSR_IA32_VMX_EPT_VPID_CAP,
+ msr_ept_cap, msr_vpid_cap);
+   if (msr_ept_cap & x86_VMX_FEATURE_EPT_CAP_AD)
+   set_cpu_cap(c, X86_FEATURE_EPT_AD);
+   }
if (msr_ctl2 & X86_VMX_FEATURE_PROC_CTLS2_VPID)
set_cpu_cap(c, X86_FEATURE_VPID);
}


[tip:x86/cpu] x86/cpufeatures: Add EPT_AD feature bit

2018-08-03 Thread tip-bot for Peter Feiner
Commit-ID:  301d328a6f8b53bb86c5ecf72db7bc178bcf1999
Gitweb: https://git.kernel.org/tip/301d328a6f8b53bb86c5ecf72db7bc178bcf1999
Author: Peter Feiner 
AuthorDate: Wed, 1 Aug 2018 11:06:57 -0700
Committer:  Thomas Gleixner 
CommitDate: Fri, 3 Aug 2018 12:36:23 +0200

x86/cpufeatures: Add EPT_AD feature bit

Some Intel processors have an EPT feature whereby the accessed & dirty bits
in EPT entries can be updated by HW. MSR IA32_VMX_EPT_VPID_CAP exposes the
presence of this capability.

There is no point in trying to use that new feature bit in the VMX code as
VMX needs to read the MSR anyway to access other bits, but having the
feature bit for EPT_AD in place helps virtualization management as it
exposes "ept_ad" in /proc/cpuinfo/$proc/flags if the feature is present.

[ tglx: Amended changelog ]

Signed-off-by: Peter Feiner 
Signed-off-by: Peter Shier 
Signed-off-by: Thomas Gleixner 
Reviewed-by: Jim Mattson 
Cc: "H. Peter Anvin" 
Cc: Borislav Petkov 
Cc: Konrad Rzeszutek Wilk 
Cc: David Woodhouse 
Link: https://lkml.kernel.org/r/20180801180657.138051-1-psh...@google.com

---
 arch/x86/include/asm/cpufeatures.h |  2 +-
 arch/x86/kernel/cpu/intel.c| 10 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/cpufeatures.h 
b/arch/x86/include/asm/cpufeatures.h
index 5701f5cecd31..7fff98fa5855 100644
--- a/arch/x86/include/asm/cpufeatures.h
+++ b/arch/x86/include/asm/cpufeatures.h
@@ -229,7 +229,7 @@
 
 #define X86_FEATURE_VMMCALL( 8*32+15) /* Prefer VMMCALL to VMCALL 
*/
 #define X86_FEATURE_XENPV  ( 8*32+16) /* "" Xen paravirtual guest 
*/
-
+#define X86_FEATURE_EPT_AD ( 8*32+17) /* Intel Extended Page Table 
access-dirty bit */
 
 /* Intel-defined CPU features, CPUID level 0x0007:0 (EBX), word 9 */
 #define X86_FEATURE_FSGSBASE   ( 9*32+ 0) /* RDFSBASE, WRFSBASE, 
RDGSBASE, WRGSBASE instructions*/
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index eb75564f2d25..c050cd6066af 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -465,14 +465,17 @@ static void detect_vmx_virtcap(struct cpuinfo_x86 *c)
 #define X86_VMX_FEATURE_PROC_CTLS2_VIRT_APIC   0x0001
 #define X86_VMX_FEATURE_PROC_CTLS2_EPT 0x0002
 #define X86_VMX_FEATURE_PROC_CTLS2_VPID0x0020
+#define x86_VMX_FEATURE_EPT_CAP_AD 0x0020
 
u32 vmx_msr_low, vmx_msr_high, msr_ctl, msr_ctl2;
+   u32 msr_vpid_cap, msr_ept_cap;
 
clear_cpu_cap(c, X86_FEATURE_TPR_SHADOW);
clear_cpu_cap(c, X86_FEATURE_VNMI);
clear_cpu_cap(c, X86_FEATURE_FLEXPRIORITY);
clear_cpu_cap(c, X86_FEATURE_EPT);
clear_cpu_cap(c, X86_FEATURE_VPID);
+   clear_cpu_cap(c, X86_FEATURE_EPT_AD);
 
rdmsr(MSR_IA32_VMX_PROCBASED_CTLS, vmx_msr_low, vmx_msr_high);
msr_ctl = vmx_msr_high | vmx_msr_low;
@@ -487,8 +490,13 @@ static void detect_vmx_virtcap(struct cpuinfo_x86 *c)
if ((msr_ctl2 & X86_VMX_FEATURE_PROC_CTLS2_VIRT_APIC) &&
(msr_ctl & X86_VMX_FEATURE_PROC_CTLS_TPR_SHADOW))
set_cpu_cap(c, X86_FEATURE_FLEXPRIORITY);
-   if (msr_ctl2 & X86_VMX_FEATURE_PROC_CTLS2_EPT)
+   if (msr_ctl2 & X86_VMX_FEATURE_PROC_CTLS2_EPT) {
set_cpu_cap(c, X86_FEATURE_EPT);
+   rdmsr(MSR_IA32_VMX_EPT_VPID_CAP,
+ msr_ept_cap, msr_vpid_cap);
+   if (msr_ept_cap & x86_VMX_FEATURE_EPT_CAP_AD)
+   set_cpu_cap(c, X86_FEATURE_EPT_AD);
+   }
if (msr_ctl2 & X86_VMX_FEATURE_PROC_CTLS2_VPID)
set_cpu_cap(c, X86_FEATURE_VPID);
}


[tip:perf/urgent] perf trace: Fix documentation for -i

2015-11-07 Thread tip-bot for Peter Feiner
Commit-ID:  956959f6b7a982b2e789a7a8fa1de437074a5eb9
Gitweb: http://git.kernel.org/tip/956959f6b7a982b2e789a7a8fa1de437074a5eb9
Author: Peter Feiner 
AuthorDate: Wed, 4 Nov 2015 09:21:46 -0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Thu, 5 Nov 2015 12:47:51 -0300

perf trace: Fix documentation for -i

The -i flag was incorrectly listed as a short flag for --no-inherit.  It
should have only been listed as a short flag for --input.

This documentation error has existed since the --input flag was
introduced in 6810fc915f7a89d8134edb3996dbbf8eac386c26 (perf trace: Add
option to analyze events in a file versus live).

Signed-off-by: Peter Feiner 
Cc: David Ahern 
Link: 
http://lkml.kernel.org/r/1446657706-14518-1-git-send-email-pfei...@google.com
Fixes: 6810fc915f7a ("perf trace: Add option to analyze events in a file versus 
live")
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/Documentation/perf-trace.txt | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/perf/Documentation/perf-trace.txt 
b/tools/perf/Documentation/perf-trace.txt
index 7ea0786..13293de 100644
--- a/tools/perf/Documentation/perf-trace.txt
+++ b/tools/perf/Documentation/perf-trace.txt
@@ -62,7 +62,6 @@ OPTIONS
 --verbose=::
 Verbosity level.
 
--i::
 --no-inherit::
Child tasks do not inherit counters.
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/urgent] perf trace: Fix documentation for -i

2015-11-07 Thread tip-bot for Peter Feiner
Commit-ID:  956959f6b7a982b2e789a7a8fa1de437074a5eb9
Gitweb: http://git.kernel.org/tip/956959f6b7a982b2e789a7a8fa1de437074a5eb9
Author: Peter Feiner 
AuthorDate: Wed, 4 Nov 2015 09:21:46 -0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Thu, 5 Nov 2015 12:47:51 -0300

perf trace: Fix documentation for -i

The -i flag was incorrectly listed as a short flag for --no-inherit.  It
should have only been listed as a short flag for --input.

This documentation error has existed since the --input flag was
introduced in 6810fc915f7a89d8134edb3996dbbf8eac386c26 (perf trace: Add
option to analyze events in a file versus live).

Signed-off-by: Peter Feiner 
Cc: David Ahern 
Link: 
http://lkml.kernel.org/r/1446657706-14518-1-git-send-email-pfei...@google.com
Fixes: 6810fc915f7a ("perf trace: Add option to analyze events in a file versus 
live")
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/Documentation/perf-trace.txt | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/perf/Documentation/perf-trace.txt 
b/tools/perf/Documentation/perf-trace.txt
index 7ea0786..13293de 100644
--- a/tools/perf/Documentation/perf-trace.txt
+++ b/tools/perf/Documentation/perf-trace.txt
@@ -62,7 +62,6 @@ OPTIONS
 --verbose=::
 Verbosity level.
 
--i::
 --no-inherit::
Child tasks do not inherit counters.
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/