All of lore.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@suse.de>
To: Ashok Raj <ashok.raj@intel.com>
Cc: X86 ML <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/microcode: Check microcode revision before updating sibling threads
Date: Fri, 16 Feb 2018 19:56:01 +0100	[thread overview]
Message-ID: <20180216185601.GB9380@pd.tnic> (raw)
In-Reply-To: <1518806808-4074-1-git-send-email-ashok.raj@intel.com>

On Fri, Feb 16, 2018 at 10:46:48AM -0800, Ashok Raj wrote:
> After updating microcode on one of the threads in the core, the
> thread sibling automatically gets the update since the microcode
> resources are shared. Check the ucode revision on the cpu before
> performing a ucode update.
> 
> Signed-off-by: Ashok Raj <ashok.raj@intel.com>
> Cc: X86 ML <x86@kernel.org>
> Cc: LKML <linux-kernel@vger.kernel.org>
> ---
>  arch/x86/kernel/cpu/microcode/intel.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
> index 09b95a7..5802c2f 100644
> --- a/arch/x86/kernel/cpu/microcode/intel.c
> +++ b/arch/x86/kernel/cpu/microcode/intel.c
> @@ -786,11 +786,21 @@ static enum ucode_state apply_microcode_intel(int cpu)
>  
>  	uci = ucode_cpu_info + cpu;
>  	mc = uci->mc;
> +
>  	if (!mc) {
>  		/* Look for a newer patch in our cache: */
>  		mc = find_patch(uci);
>  		if (!mc)
>  			return UCODE_NFOUND;
> +	} else {
> +		rev = intel_get_microcode_revision();
> +		/*
> +		 * Its possible the microcode got udpated
> +		 * because its sibling update was done earlier.
> +		 * Skip the udpate in that case.
> +		 */
> +		if (rev == mc->hdr.rev)
> +			goto done;
>  	}

Make that like the AMD version:

		/*
		 * Its possible the microcode got udpated
		 * because its sibling update was done earlier.
		 * Skip the udpate in that case.
		 */
		rev = intel_get_microcode_revision();
		if (rev >= mc->hdr.rev) {
			uci->cpu_sig.rev = rev;
			c->microcode = rev;

			return UCODE_OK;
		}

and make the subject prefix "x86/microcode/intel:" for your next
submission.

Thx.

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

  reply	other threads:[~2018-02-16 18:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-16 18:46 [PATCH] x86/microcode: Check microcode revision before updating sibling threads Ashok Raj
2018-02-16 18:56 ` Borislav Petkov [this message]
2018-02-17 13:42 ` Henrique de Moraes Holschuh
2018-02-17 14:21   ` Borislav Petkov
2018-02-17 20:09     ` Henrique de Moraes Holschuh

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=20180216185601.GB9380@pd.tnic \
    --to=bp@suse.de \
    --cc=ashok.raj@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.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.