Re: [Xen-devel] [PATCH v3 3/6] x86: log XPTI enabled status

2018-03-15 Thread Jan Beulich
>>> On 15.03.18 at 16:56,  wrote:
> On 13/03/18 13:48, Jan Beulich wrote:
>> At the same time also report the state of the two defined
>> ARCH_CAPABILITIES MSR bits. To avoid further complicating the
>> conditional around that printk(), drop it (it's a debug level one only
>> anyway).
>>
>> Signed-off-by: Jan Beulich 
>> Tested-by: Juergen Gross 
>> Reviewed-by: Juergen Gross 
> 
> In principle, Reviewed-by: Andrew Cooper 
> 
> However, don't we want to take the opportunity to raise the XENLOG_INFO
> to something which will be printed by default in a release build, seeing
> as that plan fell through the first time?

Well, strictly speaking I don't think this patch should alter the
BTI related printk(), and I do think the one added here should
be in sync with the other one. But I wouldn't mind making both
XENLOG_WARNING (or perhaps better omit XENLOG_* altogether
from these two). I could easily alter this before committing, but
none of these can be committed afaict without us reaching
agreement on patch 1 (the dependencies between the patches
are also the reason why I didn't re-order what is still patch 1,
other than I had first intended to do for v3).

Jan


___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH v3 3/6] x86: log XPTI enabled status

2018-03-15 Thread Andrew Cooper
On 13/03/18 13:48, Jan Beulich wrote:
> At the same time also report the state of the two defined
> ARCH_CAPABILITIES MSR bits. To avoid further complicating the
> conditional around that printk(), drop it (it's a debug level one only
> anyway).
>
> Signed-off-by: Jan Beulich 
> Tested-by: Juergen Gross 
> Reviewed-by: Juergen Gross 

In principle, Reviewed-by: Andrew Cooper 

However, don't we want to take the opportunity to raise the XENLOG_INFO
to something which will be printed by default in a release build, seeing
as that plan fell through the first time?

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

[Xen-devel] [PATCH v3 3/6] x86: log XPTI enabled status

2018-03-13 Thread Jan Beulich
At the same time also report the state of the two defined
ARCH_CAPABILITIES MSR bits. To avoid further complicating the
conditional around that printk(), drop it (it's a debug level one only
anyway).

Signed-off-by: Jan Beulich 
Tested-by: Juergen Gross 
Reviewed-by: Juergen Gross 
---
v2: Re-base over split off earlier patch. Drop MSR_ from
MSR_ARCH_CAPABILITIES_*. Drop conditional around debug printk().

--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -21,7 +21,7 @@
 #include 
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -100,23 +100,25 @@ custom_param("bti", parse_bti);
 static void __init print_details(enum ind_thunk thunk)
 {
 unsigned int _7d0 = 0, e8b = 0, tmp;
+uint64_t caps = 0;
 
 /* Collect diagnostics about available mitigations. */
 if ( boot_cpu_data.cpuid_level >= 7 )
 cpuid_count(7, 0, , , , &_7d0);
 if ( boot_cpu_data.extended_cpuid_level >= 0x8008 )
 cpuid(0x8008, , , , );
+if ( _7d0 & cpufeat_mask(X86_FEATURE_ARCH_CAPS) )
+rdmsrl(MSR_ARCH_CAPABILITIES, caps);
 
 printk(XENLOG_DEBUG "Speculative mitigation facilities:\n");
 
 /* Hardware features which pertain to speculative mitigations. */
-if ( (_7d0 & (cpufeat_mask(X86_FEATURE_IBRSB) |
-  cpufeat_mask(X86_FEATURE_STIBP))) ||
- (e8b & cpufeat_mask(X86_FEATURE_IBPB)) )
-printk(XENLOG_DEBUG "  Hardware features:%s%s%s\n",
-   (_7d0 & cpufeat_mask(X86_FEATURE_IBRSB)) ? " IBRS/IBPB" : "",
-   (_7d0 & cpufeat_mask(X86_FEATURE_STIBP)) ? " STIBP" : "",
-   (e8b  & cpufeat_mask(X86_FEATURE_IBPB))  ? " IBPB"  : "");
+printk(XENLOG_DEBUG "  Hardware features:%s%s%s%s%s\n",
+   (_7d0 & cpufeat_mask(X86_FEATURE_IBRSB)) ? " IBRS/IBPB" : "",
+   (_7d0 & cpufeat_mask(X86_FEATURE_STIBP)) ? " STIBP" : "",
+   (e8b  & cpufeat_mask(X86_FEATURE_IBPB))  ? " IBPB"  : "",
+   (caps & ARCH_CAPABILITIES_IBRS_ALL)  ? " IBRS_ALL"  : "",
+   (caps & ARCH_CAPABILITIES_RDCL_NO)   ? " RDCL_NO"   : "");
 
 /* Compiled-in support which pertains to BTI mitigations. */
 if ( IS_ENABLED(CONFIG_INDIRECT_THUNK) )
@@ -133,6 +135,9 @@ static void __init print_details(enum in
opt_ibpb  ? " IBPB"   : "",
boot_cpu_has(X86_FEATURE_RSB_NATIVE)  ? " RSB_NATIVE" : "",
boot_cpu_has(X86_FEATURE_RSB_VMEXIT)  ? " RSB_VMEXIT" : "");
+
+printk(XENLOG_INFO "XPTI: %s\n",
+   boot_cpu_has(X86_FEATURE_NO_XPTI) ? "disabled" : "enabled");
 }
 
 /* Calculate whether Retpoline is known-safe on this CPU. */




___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel