From nobody Sun Feb 8 22:58:17 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 62CAF1EC01B for ; Sun, 25 Jan 2026 02:06:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769306782; cv=none; b=YE0yxvR3es5MareV825vzegOFVqOGA2bP4E8IRBxaEeYLsSy+Kq19xoWkm9OTEISFEw5b8HGxCb5DszxXEDQpPsyP82CdSoCfcUNnG8sZSFT8yLiDZqDWGAMckgGKxNkASOgsxgBg6p0YG/OTjkxJmDYPHdc2dOyvm206F9MefA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769306782; c=relaxed/simple; bh=CHB9Ms7eeyNNY3UpDmJAgGrotIksTgsGlNtRyUBMmh0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r2WLMWk31AqLlrW2MCtAJZv/5Cw5N3zzIxRu2uGMQ7g26RR7RDsnoLlgDmLcxxm6JaiEeszYgsKQeDZ1jcJKmN9RStWKGRtfW8couA8h4zl9Ryv7W6wDqCtaOxps+8KSdx7/Yo1yf0ablNqf0A/aHfuQY3L7pgmu+WHIi6vaRjs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=mq4/NCb3; arc=none smtp.client-ip=192.198.163.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mq4/NCb3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1769306781; x=1800842781; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CHB9Ms7eeyNNY3UpDmJAgGrotIksTgsGlNtRyUBMmh0=; b=mq4/NCb3z5ORP6O0wwEdW463AqAgmKX0vGE2XxXno/YLeb5komxQQ/Hu fJDOm2WbTo7Jl8D1wuczanAKr69oQnZ4JcRCu9WAjdjmexD/yAdwYv3hE 29N10FOY1mnNkEdHzijAPvMT0SvK+wtMY44ZOBXothb3jy4iomF58y6Xj knpnyyRcehDwypkJT+r1F/4QPoNqBVHCivfjLmwEmzLegyWbTu+Kks/0X speJmSUdolU/ur6kbZRZjecHbBjA4+c4fDKu+OsewIfL4W0ow1H9jjhN1 ow4d0HTe5lpJx0Ldd/3u5PBxseRAPtJZOf6XkQ9/UZk1YzEHeO8ua9OqB Q==; X-CSE-ConnectionGUID: vdjt2oDURRmsytQxKz2O7g== X-CSE-MsgGUID: YvvG07RyRuGu1OkQuB5WkQ== X-IronPort-AV: E=McAfee;i="6800,10657,11681"; a="73101902" X-IronPort-AV: E=Sophos;i="6.21,252,1763452800"; d="scan'208";a="73101902" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2026 18:06:21 -0800 X-CSE-ConnectionGUID: TuDgW7ECQ7CzVcn5p4nOZg== X-CSE-MsgGUID: DI7ncuZ8SbKC/4vz4cQ3qQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,252,1763452800"; d="scan'208";a="207783109" Received: from chang-linux-3.sc.intel.com (HELO chang-linux-3) ([172.25.66.172]) by fmviesa009.fm.intel.com with ESMTP; 24 Jan 2026 18:06:21 -0800 From: "Chang S. Bae" To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, peterz@infradead.org, david.kaplan@amd.com, chang.seok.bae@intel.com Subject: [PATCH 6/7] x86/nmi: Reference stop-machine static key for offline microcode handler Date: Sun, 25 Jan 2026 01:42:21 +0000 Message-ID: <20260125014224.249901-7-chang.seok.bae@intel.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260125014224.249901-1-chang.seok.bae@intel.com> References: <20260125014224.249901-1-chang.seok.bae@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The microcode loader now uses stop-machine facility for NMI-based loading. During the rendezvous, the stop-machine static key is enabled and can be queried via stop_machine_nmi_handler_enabled(). Reference this on the offline handling path. Previously, the microcode-specific static key helper returned false when CONFIG_MICROCODE_LATE_LOADING=3Dn. Since the offline handler is also built only with that option, the helper effectively acted as a guard to avoid referencing the handler symbol when it was not present. With the removal, to avoid build issues, introduce a one-line helper. Signed-off-by: Chang S. Bae --- Note on an alternative option: Rather than keeping this loader-specific handler, stop-machine facility could be extended further to call-back to handle offline cases. Then, the microcode loader however will be the only user of that. Instead, just switching to check the stop-machine helper looks to be simple enough. --- arch/x86/include/asm/microcode.h | 5 +++-- arch/x86/kernel/nmi.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microc= ode.h index 946b0cebed87..a4e4ea8acf99 100644 --- a/arch/x86/include/asm/microcode.h +++ b/arch/x86/include/asm/microcode.h @@ -77,15 +77,16 @@ static inline u32 intel_get_microcode_revision(void) } #endif /* !CONFIG_CPU_SUP_INTEL */ =20 -void microcode_offline_nmi_handler(void); - #ifdef CONFIG_MICROCODE_LATE_LOADING +void microcode_offline_nmi_handler(void); + DECLARE_STATIC_KEY_FALSE(microcode_nmi_handler_enable); static __always_inline bool microcode_nmi_handler_enabled(void) { return static_branch_unlikely(µcode_nmi_handler_enable); } #else +static __always_inline void microcode_offline_nmi_handler(void) { } static __always_inline bool microcode_nmi_handler_enabled(void) { return f= alse; } #endif =20 diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c index 642469f3be80..52bc844354de 100644 --- a/arch/x86/kernel/nmi.c +++ b/arch/x86/kernel/nmi.c @@ -548,7 +548,7 @@ DEFINE_IDTENTRY_RAW(exc_nmi) raw_atomic_long_inc(&nsp->idt_calls); =20 if (arch_cpu_is_offline(smp_processor_id())) { - if (microcode_nmi_handler_enabled()) + if (stop_machine_nmi_handler_enabled()) microcode_offline_nmi_handler(); return; } @@ -711,7 +711,7 @@ DEFINE_FREDENTRY_NMI(exc_nmi) irqentry_state_t irq_state; =20 if (arch_cpu_is_offline(smp_processor_id())) { - if (microcode_nmi_handler_enabled()) + if (stop_machine_nmi_handler_enabled()) microcode_offline_nmi_handler(); return; } --=20 2.51.0