From: Chao Gao <chao.gao@intel.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Wei Liu <wei.liu2@citrix.com>,
xen-devel <xen-devel@lists.xenproject.org>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [PATCH v5 8/8] microcode: update microcode on cores in parallel
Date: Wed, 13 Feb 2019 16:50:03 +0800 [thread overview]
Message-ID: <20190213085000.GA9109@gao-cwp> (raw)
In-Reply-To: <5C63C55302000078002162C4@prv1-mh.provo.novell.com>
On Wed, Feb 13, 2019 at 12:20:51AM -0700, Jan Beulich wrote:
>>>> On 13.02.19 at 03:30, <chao.gao@intel.com> wrote:
>> On Tue, Feb 12, 2019 at 06:55:20AM -0700, Jan Beulich wrote:
>>>>>> On 12.02.19 at 14:25, <roger.pau@citrix.com> wrote:
>>>> On Tue, Feb 12, 2019 at 05:51:41AM -0700, Jan Beulich wrote:
>>>>> >>> On 28.01.19 at 08:06, <chao.gao@intel.com> wrote:
>>>>> > @@ -314,9 +310,7 @@ static int apply_microcode(unsigned int cpu)
>>>>> >
>>>>> > mc_intel = patch->data;
>>>>> > BUG_ON(!mc_intel);
>>>>> > -
>>>>> > - /* serialize access to the physical write to MSR 0x79 */
>>>>> > - spin_lock_irqsave(µcode_update_lock, flags);
>>>>> > + BUG_ON(local_irq_is_enabled());
>>>>> >
>>>>> > /* write microcode via MSR 0x79 */
>>>>> > wrmsrl(MSR_IA32_UCODE_WRITE, (unsigned long)mc_intel->bits);
>>>>> > @@ -329,7 +323,6 @@ static int apply_microcode(unsigned int cpu)
>>>>> > rdmsrl(MSR_IA32_UCODE_REV, msr_content);
>>>>> > val[1] = (uint32_t)(msr_content >> 32);
>>>>> >
>>>>> > - spin_unlock_irqrestore(µcode_update_lock, flags);
>>>>> > if ( val[1] != mc_intel->hdr.rev )
>>>>> > {
>>>>> > printk(KERN_ERR "microcode: CPU%d update from revision "
>>>>>
>>>>> Am I understanding right that you now rely on upper layers in the
>>>>> call tree to avoid calling into here in parallel for two hyperthreads
>>>>> of the same core? I can't see how you avoid this situation during
>>>>> AP bringup, for example. Did I overlook anything in this regard?
>>>>
>>>> IIRC microcode update is done in the serialized part of AP bringup,
>>>> before the call to smp_callin, which guarantees serialization.
>>>
>>>Hmm, yes, right now it is. But I'd call this "happens to be that way"
>>>rather than "is guaranteed to be that way" - prior to commit
>>>f97838bbd9 it did happen later.
>>
>> How about employing another lock, "early_ucode_update_lock", to
>> guarantee serialization.
>>
>> In particular, early_microcode_update_cpu() and microcode_resume_cpu()
>> will acquire this lock before ucode update.
>
>That's a (temporary) option, but would over-serialize things again.
>I was rather trying to hint towards a per-core lock.
To implement a per-core lock, a core should be conscious of its siblings.
Unfortunately, during AP bringup, ucode update is done prior to the
initialization of 'cpu_sibling_mask'.
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-02-13 8:46 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-28 7:06 [PATCH v5 0/8] improve late microcode loading Chao Gao
2019-01-28 7:06 ` [PATCH v5 1/8] microcode/intel: remove redundent check against ucode size Chao Gao
2019-01-28 16:40 ` Roger Pau Monné
2019-01-29 10:26 ` Jan Beulich
2019-01-29 13:34 ` Chao Gao
2019-01-28 7:06 ` [PATCH v5 2/8] microcode/intel: extend microcode_update_match() Chao Gao
2019-01-28 16:55 ` Roger Pau Monné
2019-01-28 17:00 ` Jan Beulich
2019-01-29 10:41 ` Jan Beulich
2019-01-29 13:52 ` Chao Gao
2019-01-28 7:06 ` [PATCH v5 3/8] microcode: introduce the global microcode cache Chao Gao
2019-01-28 17:39 ` Roger Pau Monné
2019-01-29 4:41 ` Chao Gao
2019-01-29 8:56 ` Roger Pau Monné
2019-02-08 11:41 ` Jan Beulich
2019-02-11 3:59 ` Chao Gao
2019-02-11 13:16 ` Jan Beulich
2019-01-28 7:06 ` [PATCH v5 4/8] microcode: delete 'mc' field from struct ucode_cpu_info Chao Gao
2019-01-29 9:25 ` Roger Pau Monné
2019-01-29 13:27 ` Chao Gao
2019-01-28 7:06 ` [PATCH v5 5/8] microcode: split out apply_microcode() from cpu_request_microcode() Chao Gao
2019-01-29 9:58 ` Roger Pau Monné
2019-01-29 12:47 ` Chao Gao
2019-02-08 15:58 ` Jan Beulich
2019-01-28 7:06 ` [PATCH v5 6/8] microcode: delete microcode pointer and size from microcode_info Chao Gao
2019-01-29 10:10 ` Roger Pau Monné
2019-01-29 14:11 ` Chao Gao
2019-01-28 7:06 ` [PATCH v5 7/8] x86/microcode: Synchronize late microcode loading Chao Gao
2019-01-29 10:37 ` Roger Pau Monné
2019-01-29 10:45 ` Jan Beulich
2019-01-30 13:44 ` Chao Gao
2019-02-08 16:29 ` Jan Beulich
2019-02-11 5:40 ` Chao Gao
2019-02-11 13:23 ` Jan Beulich
2019-02-11 13:35 ` Juergen Gross
2019-02-11 15:28 ` Raj, Ashok
2019-02-11 16:49 ` Jan Beulich
2019-01-28 7:06 ` [PATCH v5 8/8] microcode: update microcode on cores in parallel Chao Gao
2019-01-29 11:27 ` Roger Pau Monné
2019-01-30 13:36 ` Chao Gao
2019-02-12 12:51 ` Jan Beulich
2019-02-12 13:25 ` Roger Pau Monné
2019-02-12 13:55 ` Jan Beulich
2019-02-13 2:30 ` Chao Gao
2019-02-13 7:20 ` Jan Beulich
2019-02-13 8:50 ` Chao Gao [this message]
2019-02-13 10:05 ` Jan Beulich
2019-01-29 11:31 ` [PATCH v5 0/8] improve late microcode loading Roger Pau Monné
2019-01-29 12:11 ` Chao Gao
2019-01-29 14:17 ` Roger Pau Monné
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=20190213085000.GA9109@gao-cwp \
--to=chao.gao@intel.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=roger.pau@citrix.com \
--cc=wei.liu2@citrix.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.