[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230810204605.GF212435@hirez.programming.kicks-ass.net>
Date: Thu, 10 Aug 2023 22:46:05 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>, x86@...nel.org,
Borislav Petkov <bp@...en8.de>,
Ashok Raj <ashok.raj@...el.com>,
Arjan van de Ven <arjan@...ux.intel.com>
Subject: Re: [patch 28/30] x86/microcode: Handle "offline" CPUs correctly
On Thu, Aug 10, 2023 at 08:38:07PM +0200, Thomas Gleixner wrote:
> for_each_cpu_and(cpu, cpu_present_mask, &cpus_booted_once_mask) {
> + /*
> + * Offline CPUs sit in one of the play_dead() functions
> + * with interrupts disabled, but they still react on NMIs
> + * and execute arbitrary code. Also MWAIT being updated
> + * while the offline CPU sits there is not necessarily safe
> + * on all CPU variants.
> + *
> + * Mark them in the offline_cpus mask which will be handled
> + * by CPU0 later in the update process.
> + *
> + * Ensure that the primary thread is online so that it is
> + * guaranteed that all cores are updated.
> + */
> if (!cpu_online(cpu)) {
> + if (topology_is_primary_thread(cpu) || !allow_smt_offline) {
> + pr_err("CPU %u not online, loading aborted\n", cpu);
We could make the NMI handler do the ucode load, no? Also, you just need
any thread online, don't particularly care about primary thread or not
afaict.
> return false;
> }
> + cpumask_set_cpu(cpu, &cpu_offline_mask);
> + per_cpu(ucode_ctrl, cpu) = ctrl;
> + continue;
> }
Powered by blists - more mailing lists