All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Dyasli <sergey.dyasli@citrix.com>
To: Chao Gao <chao.gao@intel.com>, xen-devel@lists.xenproject.org
Cc: "sergey.dyasli@citrix.com >> Sergey Dyasli"
	<sergey.dyasli@citrix.com>, "Wei Liu" <wei.liu2@citrix.com>,
	"Ashok Raj" <ashok.raj@intel.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [PATCH v6 04/12] microcode: introduce a global cache of ucode patch
Date: Wed, 13 Mar 2019 16:36:50 +0000	[thread overview]
Message-ID: <b761d5b1-3dc6-0e0a-e81d-b69cdcc7166d@citrix.com> (raw)
In-Reply-To: <1552291056-20286-5-git-send-email-chao.gao@intel.com>

On 11/03/2019 07:57, Chao Gao wrote:
> to replace the current per-cpu cache 'uci->mc'.
> 
> Compared to the current per-cpu cache, the benefits of the global
> microcode cache are:
> 1. It reduces the work that need to be done on each CPU. Parsing ucode
> file is done once on one CPU. Other CPUs needn't parse ucode file.
> Instead, they can find out and load the newest patch from the global
> cache.
> 2. It reduces the memory consumption on a system with many CPU cores.
> 
> Two functions, microcode_save_patch() and microcode_find_patch() are
> introduced. The former adds one given patch to the global cache. The
> latter gets a newer and matched ucode patch from the global cache.
> All operations on the cache is expected to be done with the
> 'microcode_mutex' hold.
> 
> Note that I deliberately avoid touching 'uci->mc' as I am going to
> remove it completely in the next patch.
> 
> Signed-off-by: Chao Gao <chao.gao@intel.com>
> ---
> Changes in v6:
>  - constify local variables and function parameters if possible
>  - comment that the global cache is protected by 'microcode_mutex'.
>    and add assertions to catch violations in microcode_{save/find}_patch()
> 
> Changes in v5:
>  - reword the commit description
>  - find_patch() and save_patch() are abstracted into common functions
>    with some hooks for AMD and Intel
> ---
>  xen/arch/x86/microcode.c        | 60 +++++++++++++++++++++++++++
>  xen/arch/x86/microcode_amd.c    | 91 +++++++++++++++++++++++++++++++++++++----
>  xen/arch/x86/microcode_intel.c  | 66 ++++++++++++++++++++++++++----
>  xen/include/asm-x86/microcode.h | 13 ++++++
>  4 files changed, 215 insertions(+), 15 deletions(-)

This needs the following change for the AMD part:

diff --git a/xen/arch/x86/microcode_amd.c b/xen/arch/x86/microcode_amd.c
index 4aa8fdca38..358f3c44e3 100644
--- a/xen/arch/x86/microcode_amd.c
+++ b/xen/arch/x86/microcode_amd.c
@@ -249,6 +249,7 @@ static enum microcode_match_result compare_patch(
 static int apply_microcode(void)
 {
     uint32_t rev;
+    struct microcode_amd *mc_amd;
     const struct microcode_header_amd *hdr;
     const struct microcode_patch *patch;
     int hw_err;
@@ -259,7 +260,8 @@ static int apply_microcode(void)
     if ( patch == NULL )
         return -EINVAL;

-    hdr = patch->data;
+    mc_amd = patch->data;
+    hdr = mc_amd->mpb;

     BUG_ON(local_irq_is_enabled());


Another thing to mention is that even with this fix applied, I get
early ucode update only on CPU0. With the whole series applied, secondary
CPUs also start doing early ucode update.

--
Thanks,
Sergey

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-03-13 16:37 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-11  7:57 [PATCH v6 00/12] improve late microcode loading Chao Gao
2019-03-11  7:57 ` [PATCH v6 01/12] misc/xenmicrocode: Upload a microcode blob to the hypervisor Chao Gao
2019-03-12 15:27   ` Roger Pau Monné
2019-03-13  5:05     ` Chao Gao
2019-03-13  9:24   ` Wei Liu
2019-03-25  9:38   ` Sergey Dyasli
2019-04-02  2:26     ` Chao Gao
2019-03-11  7:57 ` [PATCH v6 02/12] microcode/intel: use union to get fields without shifting and masking Chao Gao
2019-03-12 15:33   ` Roger Pau Monné
2019-03-12 16:43     ` Jan Beulich
2019-03-12 18:23       ` Wei Liu
2019-03-11  7:57 ` [PATCH v6 03/12] microcode/intel: extend microcode_update_match() Chao Gao
2019-03-11  7:57 ` [PATCH v6 04/12] microcode: introduce a global cache of ucode patch Chao Gao
2019-03-12 16:53   ` Roger Pau Monné
2019-03-12 23:31     ` Raj, Ashok
2019-03-13  5:28     ` Chao Gao
2019-03-13  7:39     ` Jan Beulich
2019-03-13 10:30       ` Andrew Cooper
2019-03-13 17:04         ` Andrew Cooper
2019-03-14  7:42           ` Jan Beulich
2019-03-13 16:36   ` Sergey Dyasli [this message]
2019-03-14  1:39     ` Chao Gao
2019-03-11  7:57 ` [PATCH v6 05/12] microcode: only save compatible ucode patches Chao Gao
2019-03-12 17:03   ` Roger Pau Monné
2019-03-13  7:45     ` Jan Beulich
2019-03-11  7:57 ` [PATCH v6 06/12] microcode: remove struct ucode_cpu_info Chao Gao
2019-03-11  7:57 ` [PATCH v6 07/12] microcode: remove pointless 'cpu' parameter Chao Gao
2019-03-11  7:57 ` [PATCH v6 08/12] microcode: split out apply_microcode() from cpu_request_microcode() Chao Gao
2019-03-11  7:57 ` [PATCH v6 09/12] microcode: remove struct microcode_info Chao Gao
2019-03-11  7:57 ` [PATCH v6 10/12] microcode/intel: Writeback and invalidate caches before updating microcode Chao Gao
2019-03-21 11:08   ` Sergey Dyasli
2019-03-11  7:57 ` [PATCH v6 11/12] x86/microcode: Synchronize late microcode loading Chao Gao
2019-03-13  0:07   ` Raj, Ashok
2019-03-13  5:02     ` Chao Gao
2019-03-13  7:54       ` Jan Beulich
2019-03-13  8:02         ` Jan Beulich
2019-03-14 12:39           ` Andrew Cooper
2019-03-14 18:57             ` Raj, Ashok
2019-03-14 20:25               ` Thomas Gleixner
2019-03-15  9:40                 ` Andrew Cooper
2019-03-15 10:44                   ` Thomas Gleixner
2019-03-14 13:01           ` Chao Gao
2019-03-14 13:08             ` Jan Beulich
2019-03-11  7:57 ` [PATCH v6 12/12] microcode: update microcode on cores in parallel Chao Gao
2019-03-21 12:24   ` [RFC PATCH v6 13/12] microcode: add sequential application policy Sergey Dyasli
2019-03-21 14:25     ` Chao Gao
2019-03-26 16:23     ` Jan Beulich
2019-03-19 20:22 ` [PATCH v6 00/12] improve late microcode loading Woods, Brian
2019-03-19 21:39   ` Woods, Brian
2019-03-20  8:58     ` Chao Gao

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=b761d5b1-3dc6-0e0a-e81d-b69cdcc7166d@citrix.com \
    --to=sergey.dyasli@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ashok.raj@intel.com \
    --cc=chao.gao@intel.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.