public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Mihai Carabas <mihai.carabas@oracle.com>
Cc: linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH] x86: microcode: fix return value for microcode late loading
Date: Fri, 17 Apr 2020 17:08:08 +0200	[thread overview]
Message-ID: <20200417150808.GE7322@zn.tnic> (raw)
In-Reply-To: <1586858135-29337-1-git-send-email-mihai.carabas@oracle.com>

On Tue, Apr 14, 2020 at 12:55:35PM +0300, Mihai Carabas wrote:
> The return value from stop_machine might not be consistent.
> 
> stop_machine_cpuslocked returns:
> - zero if all functions have returned 0
> - a non-zero value if at least one of the functions returned
> a non-zero value
> 
> There is no way to know if it is negative or positive. So make
> __reload_late return 0 on success, or negative otherwise.
> 
> Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com>
> ---
>  arch/x86/kernel/cpu/microcode/core.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
> index 7019d4b..336003e 100644
> --- a/arch/x86/kernel/cpu/microcode/core.c
> +++ b/arch/x86/kernel/cpu/microcode/core.c
> @@ -545,8 +545,7 @@ static int __wait_for_cpus(atomic_t *t, long long timeout)
>  /*
>   * Returns:
>   * < 0 - on error
> - *   0 - no update done
> - *   1 - microcode was updated
> + *   0 - success (no update done or microcode was updated)
>   */
>  static int __reload_late(void *info)
>  {
> @@ -573,11 +572,9 @@ static int __reload_late(void *info)
>  	else
>  		goto wait_for_siblings;
>  
> -	if (err > UCODE_NFOUND) {
> +	if (err >= UCODE_NFOUND) {

It is not an error if no microcode was found.

>  		pr_warn("Error reloading microcode on CPU %d\n", cpu);
			^^^^^^^^^^

>  		ret = -1;

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

  parent reply	other threads:[~2020-04-17 15:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-14  9:55 [PATCH] x86: microcode: fix return value for microcode late loading Mihai Carabas
2020-04-14 16:22 ` Peter Zijlstra
2020-04-17 15:08 ` Borislav Petkov [this message]
2020-04-21 19:28 ` [PATCH v2] " Mihai Carabas
2020-04-22 18:04   ` [tip: x86/microcode] x86/microcode: Fix " tip-bot2 for Mihai Carabas

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=20200417150808.GE7322@zn.tnic \
    --to=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mihai.carabas@oracle.com \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox