xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: "Wu, Feng" <feng.wu@intel.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Cc: "tim@xen.org" <tim@xen.org>,
	"keir.xen@gmail.com" <keir.xen@gmail.com>,
	"stefano.stabellini@citrix.com" <stefano.stabellini@citrix.com>,
	"ian.campbell@citrix.com" <ian.campbell@citrix.com>,
	"JBeulich@suse.com" <JBeulich@suse.com>
Subject: Re: [PATCH v2 4/5] x86: Port the basic alternative mechanism from Linux to Xen
Date: Thu, 29 May 2014 15:59:16 +0100	[thread overview]
Message-ID: <53874B44.4040703@citrix.com> (raw)
In-Reply-To: <E959C4978C3B6342920538CF579893F001FD38C1@SHSMSX104.ccr.corp.intel.com>

On 29/05/2014 10:28, Wu, Feng wrote:
>
> 8 @@ void __init noreturn __start_xen(unsigned long
>> mbi_p)
>>>        if ( cpu_has_fsgsbase )
>>>            set_in_cr4(X86_CR4_FSGSBASE);
>>>
>>> +    alternative_instructions();
>>> +
>> Given this ordering, it might be cleaner to have an
>> ASSERT(!local_irq_enabled()) in the top of alternative_instructions(),
>> and forgo the local_irq_save/restore() in text_poke_early().
>>
>> If you can move this higher up before enabling MCEs in CR4, it might be
>> slightly more resilient.
>>
>> ~Andrew
> MCE bit in CR4 is set in identify_cpu() --> mcheck_init() --> set_in_cr4(X86_CR4_MCE), but
> apply_alternatives() needs boot_cpu_data.x86_capability being ready, since it calls boot_cpu_has().
> If we put alternative_instructions() before enabling MCEs in CR4, which place do you suggest? Thanks!
>
> Thanks,
> Feng

One option would be to temporarily disable it in cr4 at the same point 
that NMIs are nopped out, in the same way as temporarily disabling 
CR4.SMAP when building dom0.

At the end of the day, an MCE will certainly result in a crash, but at 
least it wouldn't be from a weird fault because some of the codepath in 
the MCE handler was midway through being patched.

~Andrew

  reply	other threads:[~2014-05-29 14:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-29  5:34 [PATCH v2 0/5] x86: Use alternative mechanism to define CLAC/STAC Feng Wu
2014-05-29  5:34 ` [PATCH v2 1/5] Use STR() as the only method for performing preprocessor stringificaion Feng Wu
2014-05-29  7:00   ` Andrew Cooper
2014-05-29 15:00   ` Jan Beulich
2014-05-29  5:34 ` [PATCH v2 2/5] x86: Add definitions for NOP operation Feng Wu
2014-05-29  8:43   ` Andrew Cooper
2014-05-29  5:34 ` [PATCH v2 3/5] x86: Make set_nmi_callback return the old nmi callback Feng Wu
2014-05-29  7:01   ` Andrew Cooper
2014-05-29  5:34 ` [PATCH v2 4/5] x86: Port the basic alternative mechanism from Linux to Xen Feng Wu
2014-05-29  8:55   ` Andrew Cooper
2014-05-29  9:28     ` Wu, Feng
2014-05-29 14:59       ` Andrew Cooper [this message]
2014-05-30  4:48         ` Wu, Feng
2014-05-30  7:07           ` Jan Beulich
2014-05-29  5:34 ` [PATCH v2 5/5] x86: Use alternative mechanism to define CLAC/STAC Feng Wu
2014-05-29  8:56   ` 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=53874B44.4040703@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=feng.wu@intel.com \
    --cc=ian.campbell@citrix.com \
    --cc=keir.xen@gmail.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.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 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).