xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [Xen-devel] [PATCH] x86: properly gate clearing of PKU feature
@ 2019-08-29  9:27 Jan Beulich
  2019-08-29 10:46 ` Andrew Cooper
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2019-08-29  9:27 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Wei Liu, Roger Pau Monné

setup_clear_cpu_cap() is __init and hence may not be called post-boot.
Note that opt_pku nevertheless is not getting __initdata added - see
e.g. commit 43fa95ae6a ("mm: make opt_bootscrub non-init").

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -466,7 +466,7 @@ void identify_cpu(struct cpuinfo_x86 *c)
 		this_cpu->c_init(c);
 
 
-   	if ( !opt_pku )
+   	if (c == &boot_cpu_data && !opt_pku)
 		setup_clear_cpu_cap(X86_FEATURE_PKU);
 
 	/*

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Xen-devel] [PATCH] x86: properly gate clearing of PKU feature
  2019-08-29  9:27 [Xen-devel] [PATCH] x86: properly gate clearing of PKU feature Jan Beulich
@ 2019-08-29 10:46 ` Andrew Cooper
  2019-08-29 13:13   ` Jan Beulich
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cooper @ 2019-08-29 10:46 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: Wei Liu, Roger Pau Monné

On 29/08/2019 10:27, Jan Beulich wrote:
> setup_clear_cpu_cap() is __init and hence may not be called post-boot.
> Note that opt_pku nevertheless is not getting __initdata added - see
> e.g. commit 43fa95ae6a ("mm: make opt_bootscrub non-init").
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

However, I'm tempted to suggest that this logic disappears entirely. 
Given that we don't support it for PV guests, and can't without taking a
CR4 write on toggle_kernel_mode(), all this actually controls is whether
the bit finds its way into the HVM max policy.

~Andrew

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Xen-devel] [PATCH] x86: properly gate clearing of PKU feature
  2019-08-29 10:46 ` Andrew Cooper
@ 2019-08-29 13:13   ` Jan Beulich
  2019-08-29 13:21     ` Andrew Cooper
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2019-08-29 13:13 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: xen-devel, Wei Liu, Roger Pau Monné

On 29.08.2019 12:46, Andrew Cooper wrote:
> On 29/08/2019 10:27, Jan Beulich wrote:
>> setup_clear_cpu_cap() is __init and hence may not be called post-boot.
>> Note that opt_pku nevertheless is not getting __initdata added - see
>> e.g. commit 43fa95ae6a ("mm: make opt_bootscrub non-init").
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
> 
> However, I'm tempted to suggest that this logic disappears entirely. 
> Given that we don't support it for PV guests, and can't without taking a
> CR4 write on toggle_kernel_mode(), all this actually controls is whether
> the bit finds its way into the HVM max policy.

Well, if you mean replacing opt_pku by an addition to
parse_xen_cpuid(), then I'll be happy to do that as a follow-on.
If there is another direction you've been considering, then
you'd have to at least outline it.

Jan

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Xen-devel] [PATCH] x86: properly gate clearing of PKU feature
  2019-08-29 13:13   ` Jan Beulich
@ 2019-08-29 13:21     ` Andrew Cooper
  2019-08-29 13:41       ` Jan Beulich
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cooper @ 2019-08-29 13:21 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel, Wei Liu, Roger Pau Monné

On 29/08/2019 14:13, Jan Beulich wrote:
> On 29.08.2019 12:46, Andrew Cooper wrote:
>> On 29/08/2019 10:27, Jan Beulich wrote:
>>> setup_clear_cpu_cap() is __init and hence may not be called post-boot.
>>> Note that opt_pku nevertheless is not getting __initdata added - see
>>> e.g. commit 43fa95ae6a ("mm: make opt_bootscrub non-init").
>>>
>>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
>>
>> However, I'm tempted to suggest that this logic disappears entirely. 
>> Given that we don't support it for PV guests, and can't without taking a
>> CR4 write on toggle_kernel_mode(), all this actually controls is whether
>> the bit finds its way into the HVM max policy.
> Well, if you mean replacing opt_pku by an addition to
> parse_xen_cpuid(), then I'll be happy to do that as a follow-on.
> If there is another direction you've been considering, then
> you'd have to at least outline it.

Well - I did say "disappear entirely".  I don't see it as having, or
liable to gain, any useful purpose.

In reality, it was subsumed into cpuid= by my patch to allow all bits to
be tweak-able.

~Andrew

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Xen-devel] [PATCH] x86: properly gate clearing of PKU feature
  2019-08-29 13:21     ` Andrew Cooper
@ 2019-08-29 13:41       ` Jan Beulich
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2019-08-29 13:41 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: xen-devel, Wei Liu, Roger Pau Monné

On 29.08.2019 15:21, Andrew Cooper wrote:
> On 29/08/2019 14:13, Jan Beulich wrote:
>> On 29.08.2019 12:46, Andrew Cooper wrote:
>>> On 29/08/2019 10:27, Jan Beulich wrote:
>>>> setup_clear_cpu_cap() is __init and hence may not be called post-boot.
>>>> Note that opt_pku nevertheless is not getting __initdata added - see
>>>> e.g. commit 43fa95ae6a ("mm: make opt_bootscrub non-init").
>>>>
>>>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>>> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
>>>
>>> However, I'm tempted to suggest that this logic disappears entirely. 
>>> Given that we don't support it for PV guests, and can't without taking a
>>> CR4 write on toggle_kernel_mode(), all this actually controls is whether
>>> the bit finds its way into the HVM max policy.
>> Well, if you mean replacing opt_pku by an addition to
>> parse_xen_cpuid(), then I'll be happy to do that as a follow-on.
>> If there is another direction you've been considering, then
>> you'd have to at least outline it.
> 
> Well - I did say "disappear entirely".  I don't see it as having, or
> liable to gain, any useful purpose.
> 
> In reality, it was subsumed into cpuid= by my patch to allow all bits to
> be tweak-able.

Did you post this patch already (I don't seem to recall; I only recall
there being the plan to do this)?

Jan

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-08-29 13:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-29  9:27 [Xen-devel] [PATCH] x86: properly gate clearing of PKU feature Jan Beulich
2019-08-29 10:46 ` Andrew Cooper
2019-08-29 13:13   ` Jan Beulich
2019-08-29 13:21     ` Andrew Cooper
2019-08-29 13:41       ` 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).