From nobody Sat Feb 7 10:44:36 2026 Received: from mail-qk1-f201.google.com (mail-qk1-f201.google.com [209.85.222.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6868339855 for ; Mon, 22 Dec 2025 20:14:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766434452; cv=none; b=L7nM3omcI1Toc2j50SWoyzPoc7bYMtyrD2myfdmutNoSKXVT0RMmbgxhFKtdHi7LNhnYgxGjmIsLBY6X2/HTY+R1hiN3AhR6RFYwabYDCMrbJOKnWVMpXWOyV81jtWieDqOJiikXrTK6JrNh7o8n94jwdVIqv8Vltz/71IRWpRo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766434452; c=relaxed/simple; bh=Pz2I4zawA6T3/Om1fTAF7nPVngGvZ2LQ79Ck0d3hwUE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=RwgpHHxpQx1sJS3NCLbCWTXmfMTnj2PJn4WoasKCkE8j3jCFWndADajxuA19RydjZotGYrsCg68qrspoL/sP2UH8SIDlvpaI4a0WjL9E3Chgi0+IwesDivQK1XwwxdTbUl2ridhaGTV5JRYfQofJk8dg8GXy0Z4d5AoXj+n7y6w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=tCSUd19R; arc=none smtp.client-ip=209.85.222.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="tCSUd19R" Received: by mail-qk1-f201.google.com with SMTP id af79cd13be357-8b2de6600c0so1105290085a.1 for ; Mon, 22 Dec 2025 12:14:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1766434450; x=1767039250; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=9v/BvE4gdEcBJVpSeZvgTpqOO9wT/iCYZlNytrlEoRI=; b=tCSUd19RIE8qH5FRUUy4iJ0itF/IuZFtY5QXy85VgZbzqDZWNFc73ptb4V90YqVD45 5bqKjLRor1BaWaJmOk4oghMn75iwla+CibRuqTi1FVxig+CVYljuvVCBJnUuofnh769t 2F/Cbl5lt8CwFxNsAeubdekGACZzFGupDOXVpIVlT4eSPVkJjudUPMAqqsv+JFeH9yD+ 48WnbEfQPFRVYXQLc/DlYu88XZ4wofidcOuvdEIRwTlPOOExriIeUqhvBcoSeW/Kvt4V yMXzxJc7RSm0AoHtwuiBcQ5uNeGkcNMbh7cegnoFE3hOtDK2NDcakrpBC4Ij2o3llezV Xmew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766434450; x=1767039250; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9v/BvE4gdEcBJVpSeZvgTpqOO9wT/iCYZlNytrlEoRI=; b=Vg8Mzpy4PotMBHQXDGE8aX/EukKrDQKMIpporrq6vIeV0V6Mfczfd2n10Lf13dAgI+ 2pY45Tfl6W/D3RkQEEwXYWJrLyuPorH43xSqkU62UDCoUIcEtmhqJkbCne5dKjnFi8Dj A98EARO2+GWyP8cr5i6VfKsJUDVjo1msYaG3F77fsHiWa+v8UT3zhmTUPpHVO6E5/GIU GKq2JMs/vT7z9szpN/gP5x/zm2fKE1HHUXe9XxAqXG/uxS93M+MTtM0NpVhl0aXkol6D 5m3LSl8HNkYeC8wtrEHYSyoghGabQNl0Pou7Y2S8G+P/4Hv9wLzJWLC6oV+QcTGDO0FN 7o1A== X-Gm-Message-State: AOJu0Yy8lcjh6edS/SViHUr8NodABRHNXgezGLfXEDM3WYKM1kjwcJwl B8RIEwaBNdvrN9yHXfq7m2Jo3k62KN6nluqw7kkz8HpAV+5/yONVxwREejyinRT2qL6n/0pdM6H 9eKVE0LBM7dqzPg== X-Google-Smtp-Source: AGHT+IFm8Y8nLu0MFvmToYnhaT57dlp2NrwzignjBOGoax/uIgybE8soD6UjwGXP1dsO+6pGrG26w1EWU2MDWQ== X-Received: from qknpa47.prod.google.com ([2002:a05:620a:832f:b0:8b2:e5f1:71c4]) (user=edumazet job=prod-delivery.src-stubby-dispatcher) by 2002:a05:620a:4009:b0:8b2:e17a:2a with SMTP id af79cd13be357-8c08f651200mr1920146785a.10.1766434449519; Mon, 22 Dec 2025 12:14:09 -0800 (PST) Date: Mon, 22 Dec 2025 20:14:04 +0000 In-Reply-To: <20251222201406.3725665-1-edumazet@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251222201406.3725665-1-edumazet@google.com> X-Mailer: git-send-email 2.52.0.351.gbe84eed79e-goog Message-ID: <20251222201406.3725665-2-edumazet@google.com> Subject: [PATCH 1/3] x86/smp: Use static_call for arch_send_call_function_single_ipi() From: Eric Dumazet To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Peter Zijlstra , x86@kernel.org, "H . Peter Anvin" Cc: linux-kernel , Eric Dumazet , Eric Dumazet Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use static_call to avoid an indirect call, especially expensive with retpoline. Signed-off-by: Eric Dumazet --- arch/x86/include/asm/smp.h | 10 ++++++++-- arch/x86/kernel/smp.c | 10 ++++++++++ arch/x86/xen/smp_hvm.c | 1 + arch/x86/xen/smp_pv.c | 1 + 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h index 84951572ab8170578ca5c4a3437c66e9809f34c2..891a5d16bcd52d2da0b71d928d3= 728afe3d15ade 100644 --- a/arch/x86/include/asm/smp.h +++ b/arch/x86/include/asm/smp.h @@ -4,6 +4,7 @@ #ifndef __ASSEMBLER__ #include #include +#include =20 #include =20 @@ -42,6 +43,12 @@ struct smp_ops { void (*send_call_func_single_ipi)(int cpu); }; =20 +void x86_smp_ops_static_call_update(void); + +void native_send_call_func_single_ipi(int cpu); +DECLARE_STATIC_CALL(x86_send_call_func_single_ipi, + native_send_call_func_single_ipi); + /* Globals due to paravirt */ extern void set_cpu_sibling_map(int cpu); =20 @@ -92,7 +99,7 @@ static inline void arch_smp_send_reschedule(int cpu) =20 static inline void arch_send_call_function_single_ipi(int cpu) { - smp_ops.send_call_func_single_ipi(cpu); + static_call(x86_send_call_func_single_ipi)(cpu); } =20 static inline void arch_send_call_function_ipi_mask(const struct cpumask *= mask) @@ -122,7 +129,6 @@ void __noreturn mwait_play_dead(unsigned int eax_hint); =20 void native_smp_send_reschedule(int cpu); void native_send_call_func_ipi(const struct cpumask *mask); -void native_send_call_func_single_ipi(int cpu); =20 asmlinkage __visible void smp_reboot_interrupt(void); __visible void smp_reschedule_interrupt(struct pt_regs *regs); diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c index b014e6d229f9519add6f3fb315f1a2f375675a50..2c8fdf1f59d953e49a6beeba8f7= 6f5fe62bd5db7 100644 --- a/arch/x86/kernel/smp.c +++ b/arch/x86/kernel/smp.c @@ -300,6 +300,16 @@ struct smp_ops smp_ops =3D { }; EXPORT_SYMBOL_GPL(smp_ops); =20 +DEFINE_STATIC_CALL(x86_send_call_func_single_ipi, + native_send_call_func_single_ipi); + +void x86_smp_ops_static_call_update(void) +{ + static_call_update(x86_send_call_func_single_ipi, + smp_ops.send_call_func_single_ipi); +} +EXPORT_SYMBOL_GPL(x86_smp_ops_static_call_update); + int arch_cpu_rescan_dead_smt_siblings(void) { enum cpuhp_smt_control old =3D cpu_smt_control; diff --git a/arch/x86/xen/smp_hvm.c b/arch/x86/xen/smp_hvm.c index 485c1d8804f739fbbb7980c98ed56eab59ad8b37..5ea0f53e4ea3f6cd4ad24fedbe2= ef28d2dc444b9 100644 --- a/arch/x86/xen/smp_hvm.c +++ b/arch/x86/xen/smp_hvm.c @@ -85,4 +85,5 @@ void __init xen_hvm_smp_init(void) smp_ops.smp_send_reschedule =3D xen_smp_send_reschedule; smp_ops.send_call_func_ipi =3D xen_smp_send_call_function_ipi; smp_ops.send_call_func_single_ipi =3D xen_smp_send_call_function_single_i= pi; + x86_smp_ops_static_call_update(); } diff --git a/arch/x86/xen/smp_pv.c b/arch/x86/xen/smp_pv.c index 9bb8ff8bff30a6d13a186609e40346203d4feb25..91f9d6854f7448bd1ffcb4e1946= 15ce6336827bb 100644 --- a/arch/x86/xen/smp_pv.c +++ b/arch/x86/xen/smp_pv.c @@ -442,6 +442,7 @@ static const struct smp_ops xen_smp_ops __initconst =3D= { void __init xen_smp_init(void) { smp_ops =3D xen_smp_ops; + x86_smp_ops_static_call_update(); =20 /* Avoid searching for BIOS MP tables */ x86_init.mpparse.find_mptable =3D x86_init_noop; --=20 2.52.0.351.gbe84eed79e-goog