From: Chao Gao <chao.gao@intel.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: andrew.cooper3@citrix.com, wei.liu2@citrix.com,
xen-devel@lists.xenproject.org, roger.pau@citrix.com
Subject: Re: [PATCH v5 2/8] microcode/intel: extend microcode_update_match()
Date: Tue, 29 Jan 2019 21:52:45 +0800 [thread overview]
Message-ID: <20190129135245.GB9095@gao-cwp> (raw)
In-Reply-To: <5C502DC5020000780014B837@prv1-mh.provo.novell.com>
On Tue, Jan 29, 2019 at 03:41:09AM -0700, Jan Beulich wrote:
>>>> Chao Gao <chao.gao@intel.com> 01/28/19 8:10 AM >>>
>>--- a/xen/arch/x86/microcode_intel.c
>>+++ b/xen/arch/x86/microcode_intel.c
>>@@ -127,14 +127,24 @@ static int collect_cpu_info(unsigned int cpu_num, struct cpu_signature *csig)
>>return 0;
>>}
> >
>>-static inline int microcode_update_match(
>>- unsigned int cpu_num, const struct microcode_header_intel *mc_header,
>>- int sig, int pf)
>>+static enum microcode_match_result microcode_update_match(
>>+ const void *mc, unsigned int sig, unsigned int pf, unsigned int rev)
>>{
>>- struct ucode_cpu_info *uci = &per_cpu(ucode_cpu_info, cpu_num);
>>+ const struct microcode_header_intel *mc_header = mc;
>>+ const struct extended_sigtable *ext_header;
>>+ const struct extended_signature *ext_sig;
>>+ unsigned int i;
>>+
>>+ if ( sigmatch(sig, mc_header->sig, pf, mc_header->pf) )
>>+ return (mc_header->rev > rev) ? NEW_UCODE : OLD_UCODE;
>
>You may want a tristate return here: I know there are systems where
>firmware updates ucode only on core 0 of every socket, in which case we'd
>very much like to apply the same microcode on the other cores in case we
>find the blob matching what is currently installed. IOW depending how later
>patches actually work, you may also want a SAME_UCODE return case.
It seems we don't need it. For CPU hot-plug, we would also meet the same
issue you described. To resolve it, a ucode patch is added to the global
cache without checking against the revision on current CPU even if the
signature is matched.
>
>>+ ext_header = mc + get_datasize(mc_header) + MC_HEADER_SIZE;
>
>On top of what Roger has said, isn't mc + MC_HEADER_SIZE the same
>as mc_header + 1?
>
>>+ ext_sig = (const void *)ext_header + EXT_HEADER_SIZE;
>
>And (const void *)ext_header + EXT_HEADER_SIZE the same as
>(const void *)(ext_header + 1)?
>
>In both cases this would eliminate unnecessary implications of certain
>two sub-terms to refer to the same types, i.e. also make the casts less
>scary / dangerous.
>
Will do.
>
>>--- a/xen/include/asm-x86/microcode.h
>>+++ b/xen/include/asm-x86/microcode.h
>>@@ -3,6 +3,12 @@
> >
>>#include <xen/percpu.h>
> >
>>+enum microcode_match_result {
>>+ OLD_UCODE, /* signature matched, but revision id isn't newer */
>>+ NEW_UCODE, /* signature matched, but revision id is newer */
>>+ MIS_UCODE, /* signature mismatched */
>>+};
>
>It's not clear at this point of the series or from the commit message whether
>this is to be used by AMD code as well. If not, it would better move into
>microcode_intel.c.
It will be used by AMD code. Will mention this in commit message.
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-01-29 13:48 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 [this message]
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
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=20190129135245.GB9095@gao-cwp \
--to=chao.gao@intel.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.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.