* [PATCH] x86: report use of PCID together with reporting XPTI status
@ 2018-07-16 16:45 Jan Beulich
2018-07-16 17:01 ` Andrew Cooper
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Jan Beulich @ 2018-07-16 16:45 UTC (permalink / raw)
To: xen-devel; +Cc: Andrew Cooper
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/pv/domain.c
+++ b/xen/arch/x86/pv/domain.c
@@ -288,6 +288,12 @@ int pv_domain_initialise(struct domain *
return rc;
}
+bool __init xpti_pcid_enabled(void)
+{
+ return use_invpcid && cpu_has_pcid &&
+ (opt_pcid == PCID_ALL || opt_pcid == PCID_XPTI);
+}
+
static void _toggle_guest_pt(struct vcpu *v)
{
const struct domain *d = v->domain;
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -256,9 +256,10 @@ static void __init print_details(enum in
boot_cpu_has(X86_FEATURE_SC_RSB_HVM) ? " RSB" : "",
opt_eager_fpu ? " EAGER_FPU" : "");
- printk(" XPTI (64-bit PV only): Dom0 %s, DomU %s\n",
+ printk(" XPTI (64-bit PV only): Dom0 %s, DomU %s (with%s PCID)\n",
opt_xpti & OPT_XPTI_DOM0 ? "enabled" : "disabled",
- opt_xpti & OPT_XPTI_DOMU ? "enabled" : "disabled");
+ opt_xpti & OPT_XPTI_DOMU ? "enabled" : "disabled",
+ xpti_pcid_enabled() ? "" : "out");
}
/* Calculate whether Retpoline is known-safe on this CPU. */
--- a/xen/include/asm-x86/spec_ctrl.h
+++ b/xen/include/asm-x86/spec_ctrl.h
@@ -38,6 +38,8 @@ extern uint8_t opt_xpti;
#define OPT_XPTI_DOM0 0x01
#define OPT_XPTI_DOMU 0x02
+bool xpti_pcid_enabled(void);
+
static inline void init_shadow_spec_ctrl_state(void)
{
struct cpu_info *info = get_cpu_info();
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86: report use of PCID together with reporting XPTI status
2018-07-16 16:45 [PATCH] x86: report use of PCID together with reporting XPTI status Jan Beulich
@ 2018-07-16 17:01 ` Andrew Cooper
2018-07-17 11:05 ` Roger Pau Monné
2018-07-17 20:52 ` Doug Goldstein
2 siblings, 0 replies; 6+ messages in thread
From: Andrew Cooper @ 2018-07-16 17:01 UTC (permalink / raw)
To: Jan Beulich, xen-devel
On 16/07/18 17:45, Jan Beulich wrote:
> --- a/xen/include/asm-x86/spec_ctrl.h
> +++ b/xen/include/asm-x86/spec_ctrl.h
> @@ -38,6 +38,8 @@ extern uint8_t opt_xpti;
> #define OPT_XPTI_DOM0 0x01
> #define OPT_XPTI_DOMU 0x02
>
> +bool xpti_pcid_enabled(void);
To be used in the way you want, this needs a stub for the non CONFIG_PV
case, and should probably be in pv/domain.h
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86: report use of PCID together with reporting XPTI status
2018-07-16 16:45 [PATCH] x86: report use of PCID together with reporting XPTI status Jan Beulich
2018-07-16 17:01 ` Andrew Cooper
@ 2018-07-17 11:05 ` Roger Pau Monné
2018-07-17 12:03 ` Jan Beulich
2018-07-17 20:52 ` Doug Goldstein
2 siblings, 1 reply; 6+ messages in thread
From: Roger Pau Monné @ 2018-07-17 11:05 UTC (permalink / raw)
To: Jan Beulich; +Cc: xen-devel, Andrew Cooper
On Mon, Jul 16, 2018 at 10:45:15AM -0600, Jan Beulich wrote:
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> --- a/xen/arch/x86/pv/domain.c
> +++ b/xen/arch/x86/pv/domain.c
> @@ -288,6 +288,12 @@ int pv_domain_initialise(struct domain *
> return rc;
> }
>
> +bool __init xpti_pcid_enabled(void)
> +{
> + return use_invpcid && cpu_has_pcid &&
> + (opt_pcid == PCID_ALL || opt_pcid == PCID_XPTI);
> +}
> +
> static void _toggle_guest_pt(struct vcpu *v)
> {
> const struct domain *d = v->domain;
> --- a/xen/arch/x86/spec_ctrl.c
> +++ b/xen/arch/x86/spec_ctrl.c
> @@ -256,9 +256,10 @@ static void __init print_details(enum in
> boot_cpu_has(X86_FEATURE_SC_RSB_HVM) ? " RSB" : "",
> opt_eager_fpu ? " EAGER_FPU" : "");
>
> - printk(" XPTI (64-bit PV only): Dom0 %s, DomU %s\n",
> + printk(" XPTI (64-bit PV only): Dom0 %s, DomU %s (with%s PCID)\n",
> opt_xpti & OPT_XPTI_DOM0 ? "enabled" : "disabled",
> - opt_xpti & OPT_XPTI_DOMU ? "enabled" : "disabled");
> + opt_xpti & OPT_XPTI_DOMU ? "enabled" : "disabled",
> + xpti_pcid_enabled() ? "" : "out");
> }
Maybe you could place xpti_pcid_enabled in spec_ctrl.c, or just open
code it (possibly with a bool) in print_details?
Roger.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86: report use of PCID together with reporting XPTI status
2018-07-17 11:05 ` Roger Pau Monné
@ 2018-07-17 12:03 ` Jan Beulich
0 siblings, 0 replies; 6+ messages in thread
From: Jan Beulich @ 2018-07-17 12:03 UTC (permalink / raw)
To: Roger Pau Monne; +Cc: Andrew Cooper, xen-devel
>>> On 17.07.18 at 13:05, <roger.pau@citrix.com> wrote:
> On Mon, Jul 16, 2018 at 10:45:15AM -0600, Jan Beulich wrote:
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>>
>> --- a/xen/arch/x86/pv/domain.c
>> +++ b/xen/arch/x86/pv/domain.c
>> @@ -288,6 +288,12 @@ int pv_domain_initialise(struct domain *
>> return rc;
>> }
>>
>> +bool __init xpti_pcid_enabled(void)
>> +{
>> + return use_invpcid && cpu_has_pcid &&
>> + (opt_pcid == PCID_ALL || opt_pcid == PCID_XPTI);
>> +}
>> +
>> static void _toggle_guest_pt(struct vcpu *v)
>> {
>> const struct domain *d = v->domain;
>> --- a/xen/arch/x86/spec_ctrl.c
>> +++ b/xen/arch/x86/spec_ctrl.c
>> @@ -256,9 +256,10 @@ static void __init print_details(enum in
>> boot_cpu_has(X86_FEATURE_SC_RSB_HVM) ? " RSB" : "",
>> opt_eager_fpu ? " EAGER_FPU" : "");
>>
>> - printk(" XPTI (64-bit PV only): Dom0 %s, DomU %s\n",
>> + printk(" XPTI (64-bit PV only): Dom0 %s, DomU %s (with%s PCID)\n",
>> opt_xpti & OPT_XPTI_DOM0 ? "enabled" : "disabled",
>> - opt_xpti & OPT_XPTI_DOMU ? "enabled" : "disabled");
>> + opt_xpti & OPT_XPTI_DOMU ? "enabled" : "disabled",
>> + xpti_pcid_enabled() ? "" : "out");
>> }
>
> Maybe you could place xpti_pcid_enabled in spec_ctrl.c, or just open
> code it (possibly with a bool) in print_details?
I very definitely want it to sit next to pv_domain_initialise(), so that
the similar logic can be easily seen and compared.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86: report use of PCID together with reporting XPTI status
2018-07-16 16:45 [PATCH] x86: report use of PCID together with reporting XPTI status Jan Beulich
2018-07-16 17:01 ` Andrew Cooper
2018-07-17 11:05 ` Roger Pau Monné
@ 2018-07-17 20:52 ` Doug Goldstein
2018-07-18 6:40 ` Jan Beulich
2 siblings, 1 reply; 6+ messages in thread
From: Doug Goldstein @ 2018-07-17 20:52 UTC (permalink / raw)
To: Jan Beulich; +Cc: xen-devel, Andrew Cooper
On Mon, Jul 16, 2018 at 10:45:15AM -0600, Jan Beulich wrote:
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> --- a/xen/arch/x86/pv/domain.c
> +++ b/xen/arch/x86/pv/domain.c
> @@ -288,6 +288,12 @@ int pv_domain_initialise(struct domain *
> return rc;
> }
>
> +bool __init xpti_pcid_enabled(void)
> +{
> + return use_invpcid && cpu_has_pcid &&
> + (opt_pcid == PCID_ALL || opt_pcid == PCID_XPTI);
> +}
> +
> static void _toggle_guest_pt(struct vcpu *v)
> {
> const struct domain *d = v->domain;
> --- a/xen/arch/x86/spec_ctrl.c
> +++ b/xen/arch/x86/spec_ctrl.c
> @@ -256,9 +256,10 @@ static void __init print_details(enum in
> boot_cpu_has(X86_FEATURE_SC_RSB_HVM) ? " RSB" : "",
> opt_eager_fpu ? " EAGER_FPU" : "");
>
> - printk(" XPTI (64-bit PV only): Dom0 %s, DomU %s\n",
> + printk(" XPTI (64-bit PV only): Dom0 %s, DomU %s (with%s PCID)\n",
Do you ever foresee wanting to add another flag in here? It might be
better to just have "with: %s" and do xpti_pcid_enabled ? "PCID" : "" if
you do. If not then this seems like a good addition to me and is
definitely welcome to folks wanting to know if they're using PCID.
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86: report use of PCID together with reporting XPTI status
2018-07-17 20:52 ` Doug Goldstein
@ 2018-07-18 6:40 ` Jan Beulich
0 siblings, 0 replies; 6+ messages in thread
From: Jan Beulich @ 2018-07-18 6:40 UTC (permalink / raw)
To: Doug Goldstein; +Cc: Andrew Cooper, xen-devel
>>> On 17.07.18 at 22:52, <cardoe@cardoe.com> wrote:
> On Mon, Jul 16, 2018 at 10:45:15AM -0600, Jan Beulich wrote:
>> --- a/xen/arch/x86/spec_ctrl.c
>> +++ b/xen/arch/x86/spec_ctrl.c
>> @@ -256,9 +256,10 @@ static void __init print_details(enum in
>> boot_cpu_has(X86_FEATURE_SC_RSB_HVM) ? " RSB" : "",
>> opt_eager_fpu ? " EAGER_FPU" : "");
>>
>> - printk(" XPTI (64-bit PV only): Dom0 %s, DomU %s\n",
>> + printk(" XPTI (64-bit PV only): Dom0 %s, DomU %s (with%s PCID)\n",
>
> Do you ever foresee wanting to add another flag in here? It might be
> better to just have "with: %s" and do xpti_pcid_enabled ? "PCID" : "" if
> you do. If not then this seems like a good addition to me and is
> definitely welcome to folks wanting to know if they're using PCID.
I don't foresee additions here. Re-arranging this can be done if and
when such an addition becomes necessary.
> Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
Thanks, Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-07-18 6:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-16 16:45 [PATCH] x86: report use of PCID together with reporting XPTI status Jan Beulich
2018-07-16 17:01 ` Andrew Cooper
2018-07-17 11:05 ` Roger Pau Monné
2018-07-17 12:03 ` Jan Beulich
2018-07-17 20:52 ` Doug Goldstein
2018-07-18 6:40 ` Jan Beulich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).