All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Oleksii Kurochko <oleksii.kurochko@gmail.com>
Subject: Re: [PATCH for 4.19?] x86/Intel: unlock CPUID earlier for the BSP
Date: Thu, 13 Jun 2024 18:04:04 +0200	[thread overview]
Message-ID: <ZmsYdA6uwR4nGEYp@macbook> (raw)
In-Reply-To: <4cb42dae-430b-4740-bddd-df5c4c783724@suse.com>

On Thu, Jun 13, 2024 at 05:53:02PM +0200, Jan Beulich wrote:
> On 13.06.2024 17:16, Roger Pau Monné wrote:
> > On Thu, Jun 13, 2024 at 10:19:30AM +0200, Jan Beulich wrote:
> >> @@ -315,16 +329,7 @@ static void cf_check early_init_intel(st
> >>  	    bootsym(trampoline_misc_enable_off) & MSR_IA32_MISC_ENABLE_XD_DISABLE)
> >>  		printk(KERN_INFO "re-enabled NX (Execute Disable) protection\n");
> >>  
> >> -	/* Unmask CPUID levels and NX if masked: */
> >> -	rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
> >> -
> >> -	disable = misc_enable & MSR_IA32_MISC_ENABLE_LIMIT_CPUID;
> >> -	if (disable) {
> >> -		wrmsrl(MSR_IA32_MISC_ENABLE, misc_enable & ~disable);
> >> -		bootsym(trampoline_misc_enable_off) |= disable;
> >> -		printk(KERN_INFO "revised cpuid level: %d\n",
> >> -		       cpuid_eax(0));
> >> -	}
> >> +	intel_unlock_cpuid_leaves(c);
> > 
> > Do you really need to call intel_unlock_cpuid_leaves() here?
> > 
> > For the BSP it will be taken care in early_cpu_init(), and for the APs
> > MSR_IA32_MISC_ENABLE it will be set as part of the trampoline with the
> > disables from trampoline_misc_enable_off.
> 
> The way the original code works, it allows to deal with the BSP having the
> bit clear, but some or all of the APs having it set. I simply didn't want
> to break that property.

Oh, I see.  This looks like something we would unconditionally like to
set in trampoline_misc_enable_off?  Except that would trigger an
unnecessary write to the MSR if the CPU already has it disabled.

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

I think the printk could be made a printk_once, since it doesn't even
print the CPU where the bit has been seen as set, but anyway, that
would be further adjustments.

Thanks, Roger.


  reply	other threads:[~2024-06-13 16:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13  8:19 [PATCH for 4.19?] x86/Intel: unlock CPUID earlier for the BSP Jan Beulich
2024-06-13 14:35 ` Oleksii K.
2024-06-13 15:16 ` Roger Pau Monné
2024-06-13 15:53   ` Jan Beulich
2024-06-13 16:04     ` Roger Pau Monné [this message]
2024-06-13 16:12       ` Jan Beulich
2024-06-13 16:17 ` Andrew Cooper
2024-06-14  6:27   ` Jan Beulich
2024-06-14 10:14     ` Andrew Cooper
2024-06-14 11:12       ` Jan Beulich
2024-06-18 12:46         ` Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZmsYdA6uwR4nGEYp@macbook \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=oleksii.kurochko@gmail.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.