From: Chao Gao <chao.gao@intel.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Sergey Dyasli" <sergey.dyasli@citrix.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Ashok Raj" <ashok.raj@intel.com>, "Wei Liu" <wl@xen.org>,
"Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>,
"George Dunlap" <George.Dunlap@eu.citrix.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Ian Jackson" <ian.jackson@eu.citrix.com>,
"Tim Deegan" <tim@xen.org>, "Julien Grall" <julien.grall@arm.com>,
xen-devel@lists.xenproject.org,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH v11 6/7] microcode: rendezvous CPUs in NMI handler and load ucode
Date: Fri, 27 Sep 2019 22:15:38 +0800 [thread overview]
Message-ID: <20190927141536.GA9071@gao-cwp> (raw)
In-Reply-To: <1cc3a02b-c73a-d2bd-e96a-3bfa28ddc925@suse.com>
On Fri, Sep 27, 2019 at 03:55:00PM +0200, Jan Beulich wrote:
>On 27.09.2019 15:53, Chao Gao wrote:
>> On Fri, Sep 27, 2019 at 12:19:22PM +0200, Jan Beulich wrote:
>>> On 26.09.2019 15:53, Chao Gao wrote:
>>>> @@ -420,14 +498,23 @@ static int control_thread_fn(const struct microcode_patch *patch)
>>>> return ret;
>>>> }
>>>>
>>>> - /* Let primary threads load the given ucode update */
>>>> - set_state(LOADING_ENTER);
>>>> -
>>>> + /* Control thread loads ucode first while others are in NMI handler. */
>>>> ret = microcode_ops->apply_microcode(patch);
>>>> if ( !ret )
>>>> atomic_inc(&cpu_updated);
>>>> atomic_inc(&cpu_out);
>>>>
>>>> + if ( ret == -EIO )
>>>> + {
>>>> + printk(XENLOG_ERR
>>>> + "Late loading aborted: CPU%u failed to update ucode\n", cpu);
>>>> + set_state(LOADING_EXIT);
>>>> + return ret;
>>>> + }
>>>> +
>>>> + /* Let primary threads load the given ucode update */
>>>> + set_state(LOADING_ENTER);
>>>
>>> While the description goes to some lengths to explain this ordering of
>>> updates, I still don't really see the point: How is it better for the
>>> control CPU to have updated its ucode early and then hit an NMI before
>>> the other CPUs have even started updating, than the other way around
>>> in the opposite case?
>>
>> We want to be conservative here. If an ucode is to update something
>> shared by a whole socket, for the latter case, control thread may
>> be accessing things that are being updating by the ucode loading on
>> other cores. It is not safe, just like sibling thread isn't expected
>> to access features exposed by the old ucode when primary thread is
>> loading ucode.
>
>Ah yes, considering a socket-wide effect didn't occur to me (although
>it should have). So if you mention this aspect in the description, I
>think I'm going to be fine with the change in this regard. Yet (as so
>often) this raises another question: What about "secondary" sockets?
>Shouldn't we entertain a similar two-step approach there then?
No. The two-step approach is because control thread cannot call
self_nmi() in case of triggering unknown_nmi_error() and what is done
in the main NMI handler isn't well controlled. All cores on other
sockets will rendezvous in NMI handler. It means every core's behavior
on other sockets is well controlled.
Thanks
Chao
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-09-27 14:12 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-26 13:53 [Xen-devel] [PATCH v11 0/7] improve late microcode loading Chao Gao
2019-09-26 13:53 ` [Xen-devel] [PATCH v11 1/7] microcode: split out apply_microcode() from cpu_request_microcode() Chao Gao
2019-09-27 9:38 ` Jan Beulich
2019-09-26 13:53 ` [Xen-devel] [PATCH v11 2/7] microcode: unify ucode loading during system bootup and resuming Chao Gao
2019-09-26 13:53 ` [Xen-devel] [PATCH v11 3/7] microcode: reduce memory allocation and copy when creating a patch Chao Gao
2019-09-26 13:53 ` [Xen-devel] [PATCH v11 4/7] x86/microcode: Synchronize late microcode loading Chao Gao
2019-09-27 9:51 ` Jan Beulich
2019-09-26 13:53 ` [Xen-devel] [PATCH v11 5/7] microcode: remove microcode_update_lock Chao Gao
2019-09-26 13:53 ` [Xen-devel] [PATCH v11 6/7] microcode: rendezvous CPUs in NMI handler and load ucode Chao Gao
2019-09-27 10:19 ` Jan Beulich
2019-09-27 13:53 ` Chao Gao
2019-09-27 13:55 ` Jan Beulich
2019-09-27 14:15 ` Chao Gao [this message]
2019-09-26 13:53 ` [Xen-devel] [PATCH v11 7/7] microcode: reject late ucode loading if any core is parked Chao Gao
2019-09-27 11:19 ` Jan Beulich
2019-09-30 6:43 ` Chao Gao
2019-09-30 8:12 ` Jan Beulich
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=20190927141536.GA9071@gao-cwp \
--to=chao.gao@intel.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=ashok.raj@intel.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=julien.grall@arm.com \
--cc=konrad.wilk@oracle.com \
--cc=roger.pau@citrix.com \
--cc=sergey.dyasli@citrix.com \
--cc=sstabellini@kernel.org \
--cc=tim@xen.org \
--cc=wl@xen.org \
--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.