[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190703105917.246171169@linutronix.de>
Date: Wed, 03 Jul 2019 12:54:49 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: LKML <linux-kernel@...r.kernel.org>
Cc: x86@...nel.org, Nadav Amit <namit@...are.com>,
Ricardo Neri <ricardo.neri-calderon@...ux.intel.com>,
Stephane Eranian <eranian@...gle.com>,
Feng Tang <feng.tang@...el.com>
Subject: [patch 18/18] x86/apic/x2apic: Add conditional IPI shorthands support
Use the shorthand broadcast delivery if the static key controlling it is
enabled. If not use the regular one by one IPI mechanism.
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
---
arch/x86/kernel/apic/local.h | 1 +
arch/x86/kernel/apic/x2apic_cluster.c | 10 ++++++++--
arch/x86/kernel/apic/x2apic_phys.c | 18 ++++++++++++++++--
3 files changed, 25 insertions(+), 4 deletions(-)
--- a/arch/x86/kernel/apic/local.h
+++ b/arch/x86/kernel/apic/local.h
@@ -23,6 +23,7 @@ unsigned int x2apic_get_apic_id(unsigned
u32 x2apic_set_apic_id(unsigned int id);
int x2apic_phys_pkg_id(int initial_apicid, int index_msb);
void x2apic_send_IPI_self(int vector);
+void __x2apic_send_IPI_shorthand(int vector, u32 which);
/* IPI */
--- a/arch/x86/kernel/apic/x2apic_cluster.c
+++ b/arch/x86/kernel/apic/x2apic_cluster.c
@@ -82,12 +82,18 @@ x2apic_send_IPI_mask_allbutself(const st
static void x2apic_send_IPI_allbutself(int vector)
{
- __x2apic_send_IPI_mask(cpu_online_mask, vector, APIC_DEST_ALLBUT);
+ if (static_branch_likely(&apic_use_ipi_shorthand))
+ __x2apic_send_IPI_shorthand(vector, APIC_DEST_ALLBUT);
+ else
+ __x2apic_send_IPI_mask(cpu_online_mask, vector, APIC_DEST_ALLBUT);
}
static void x2apic_send_IPI_all(int vector)
{
- __x2apic_send_IPI_mask(cpu_online_mask, vector, APIC_DEST_ALLINC);
+ if (static_branch_likely(&apic_use_ipi_shorthand))
+ __x2apic_send_IPI_shorthand(vector, APIC_DEST_ALLINC);
+ else
+ __x2apic_send_IPI_mask(cpu_online_mask, vector, APIC_DEST_ALLINC);
}
static u32 x2apic_calc_apicid(unsigned int cpu)
--- a/arch/x86/kernel/apic/x2apic_phys.c
+++ b/arch/x86/kernel/apic/x2apic_phys.c
@@ -75,12 +75,18 @@ static void
static void x2apic_send_IPI_allbutself(int vector)
{
- __x2apic_send_IPI_mask(cpu_online_mask, vector, APIC_DEST_ALLBUT);
+ if (static_branch_likely(&apic_use_ipi_shorthand))
+ __x2apic_send_IPI_shorthand(vector, APIC_DEST_ALLBUT);
+ else
+ __x2apic_send_IPI_mask(cpu_online_mask, vector, APIC_DEST_ALLBUT);
}
static void x2apic_send_IPI_all(int vector)
{
- __x2apic_send_IPI_mask(cpu_online_mask, vector, APIC_DEST_ALLINC);
+ if (static_branch_likely(&apic_use_ipi_shorthand))
+ __x2apic_send_IPI_shorthand(vector, APIC_DEST_ALLINC);
+ else
+ __x2apic_send_IPI_mask(cpu_online_mask, vector, APIC_DEST_ALLINC);
}
static void init_x2apic_ldr(void)
@@ -112,6 +118,14 @@ void __x2apic_send_IPI_dest(unsigned int
native_x2apic_icr_write(cfg, apicid);
}
+void __x2apic_send_IPI_shorthand(int vector, u32 which)
+{
+ unsigned long cfg = __prepare_ICR(which, vector, 0);
+
+ x2apic_wrmsr_fence();
+ native_x2apic_icr_write(cfg, 0);
+}
+
unsigned int x2apic_get_apic_id(unsigned long id)
{
return id;
Powered by blists - more mailing lists