Implementing self IPI with NMI destination
Subsystems (2)
cover Implementing self IPI with NMI destination
Here is self-IPI with NMI destination implemented. Don was testing
perf NMI's and we found that we don't have a simple call for self-nmi IPI.
So there is two way of implementing such facility:
1) Make .send_IPI_self to check for NMI_VECTOR in arguments and convert this call internally to NMI IPI with self in destination.
2) Make a separate .send_IPI_self_nmi function and call it only if needed.
The series implements 1st choise but I tend to think that 2nd might
be more preferred since it would not bring overhead into .send_IPI_self and would make code a bit less messed.
Anyway, this series is not for merging yet but rather to collect
complains about this approach. And to be fair we seem don't have x2apic machine at moment so x2apic mode is not tested at all.
In short -- please check and review this two patches. Anything
is welcome ;)
Cyrill
RFC 1/2 x86, apic: Get rid of some IPI wrappers
They just hide the sameness of methods.
--- arch/x86/kernel/apic/apic_flat_64.c | 17 +++-------------- arch/x86/kernel/apic/bigsmp_32.c | 9 ++------- arch/x86/kernel/apic/es7000_32.c | 11 +++-------- arch/x86/kernel/apic/numaq_32.c | 9 ++------- arch/x86/kernel/apic/summit_32.c | 9 ++------- 5 files changed, 12 insertions(+), 43 deletions(-)
arch/x86/kernel/apic/apic_flat_64.c +3 -14
@@ -261,17 +261,6 @@ static void physflat_vector_allocation_dcpumask_set_cpu (cpu, retmask); } -static void physflat_send_IPI_mask (const struct cpumask *cpumask,int vector) -{ -default_send_IPI_mask_sequence_phys (cpumask, vector); -} - -static void physflat_send_IPI_mask_allbutself (const struct cpumask *cpumask, -int vector) -{ -default_send_IPI_mask_allbutself_phys (cpumask, vector); -} -static void physflat_send_IPI_allbutself (int vector) {default_send_IPI_mask_allbutself_phys (cpu_online_mask, vector);
@@ -279,7 +268,7 @@ static void physflat_send_IPI_allbutselfstatic void physflat_send_IPI_all (int vector) { -physflat_send_IPI_mask (cpu_online_mask, vector); +default_send_IPI_mask_sequence_phys (cpu_online_mask, vector); }static unsigned int physflat_cpu_mask_to_apicid (const struct cpumask *cpumask)
@@ -354,8 +343,8 @@ struct apic apic_physflat = { .cpu_mask_to_apicid = physflat_cpu_mask_to_apicid, .cpu_mask_to_apicid_and = physflat_cpu_mask_to_apicid_and, - .send_IPI_mask = physflat_send_IPI_mask, - .send_IPI_mask_allbutself = physflat_send_IPI_mask_allbutself, + .send_IPI_mask = default_send_IPI_mask_sequence_phys, + .send_IPI_mask_allbutself = default_send_IPI_mask_allbutself_phys, .send_IPI_allbutself = physflat_send_IPI_allbutself, .send_IPI_all = physflat_send_IPI_all, .send_IPI_self = apic_send_IPI_self,
arch/x86/kernel/apic/bigsmp_32.c +2 -7
@@ -139,11 +139,6 @@ static int bigsmp_phys_pkg_id(int cpuid_return cpuid_apic >> index_msb; } -static inline void bigsmp_send_IPI_mask (const struct cpumask *mask,int vector) -{ -default_send_IPI_mask_sequence_phys (mask, vector); -} -static void bigsmp_send_IPI_allbutself (int vector) {default_send_IPI_mask_allbutself_phys (cpu_online_mask, vector);
@@ -151,7 +146,7 @@ static void bigsmp_send_IPI_allbutself(istatic void bigsmp_send_IPI_all (int vector) { -bigsmp_send_IPI_mask (cpu_online_mask, vector); +default_send_IPI_mask_sequence_phys (cpu_online_mask, vector); }static int dmi_bigsmp;/* can be set by dmi scanners */
@@ -236,7 +231,7 @@ struct apic apic_bigsmp = { .cpu_mask_to_apicid = bigsmp_cpu_mask_to_apicid, .cpu_mask_to_apicid_and = bigsmp_cpu_mask_to_apicid_and, - .send_IPI_mask = bigsmp_send_IPI_mask, + .send_IPI_mask = default_send_IPI_mask_sequence_phys, .send_IPI_mask_allbutself = NULL, .send_IPI_allbutself = bigsmp_send_IPI_allbutself, .send_IPI_all = bigsmp_send_IPI_all,
arch/x86/kernel/apic/es7000_32.c +3 -8
@@ -420,11 +420,6 @@ static unsigned int es7000_get_apic_id(ureturn (x >>24 ) &0xFF ; } -static void es7000_send_IPI_mask (const struct cpumask *mask,int vector) -{ -default_send_IPI_mask_sequence_phys (mask, vector); -} -static void es7000_send_IPI_allbutself (int vector) {default_send_IPI_mask_allbutself_phys (cpu_online_mask, vector);
@@ -432,7 +427,7 @@ static void es7000_send_IPI_allbutself(istatic void es7000_send_IPI_all (int vector) { -es7000_send_IPI_mask (cpu_online_mask, vector); +default_send_IPI_mask_sequence_phys (cpu_online_mask, vector); }static int es7000_apic_id_registered (void )
@@ -672,7 +667,7 @@ struct apic __refdata apic_es7000_cluste .cpu_mask_to_apicid = es7000_cpu_mask_to_apicid, .cpu_mask_to_apicid_and = es7000_cpu_mask_to_apicid_and, - .send_IPI_mask = es7000_send_IPI_mask, + .send_IPI_mask = default_send_IPI_mask_sequence_phys, .send_IPI_mask_allbutself = NULL, .send_IPI_allbutself = es7000_send_IPI_allbutself, .send_IPI_all = es7000_send_IPI_all,
@@ -737,7 +732,7 @@ struct apic __refdata apic_es7000 = { .cpu_mask_to_apicid = es7000_cpu_mask_to_apicid, .cpu_mask_to_apicid_and = es7000_cpu_mask_to_apicid_and, - .send_IPI_mask = es7000_send_IPI_mask, + .send_IPI_mask = default_send_IPI_mask_sequence_phys, .send_IPI_mask_allbutself = NULL, .send_IPI_allbutself = es7000_send_IPI_allbutself, .send_IPI_all = es7000_send_IPI_all,
arch/x86/kernel/apic/numaq_32.c +2 -7
@@ -299,11 +299,6 @@ static inline unsigned int numaq_get_apireturn (x >>24 ) &0x0F ; } -static inline void numaq_send_IPI_mask (const struct cpumask *mask,int vector) -{ -default_send_IPI_mask_sequence_logical (mask, vector); -} -static inline void numaq_send_IPI_allbutself (int vector) {default_send_IPI_mask_allbutself_logical (cpu_online_mask, vector);
@@ -311,7 +306,7 @@ static inline void numaq_send_IPI_allbutstatic inline void numaq_send_IPI_all (int vector) { -numaq_send_IPI_mask (cpu_online_mask, vector); +default_send_IPI_mask_sequence_logical (cpu_online_mask, vector); }#define NUMAQ_TRAMPOLINE_PHYS_LOW (0x8)
@@ -525,7 +520,7 @@ struct apic __refdata apic_numaq = { .cpu_mask_to_apicid = numaq_cpu_mask_to_apicid, .cpu_mask_to_apicid_and = numaq_cpu_mask_to_apicid_and, - .send_IPI_mask = numaq_send_IPI_mask, + .send_IPI_mask = default_send_IPI_mask_sequence_logical, .send_IPI_mask_allbutself = NULL, .send_IPI_allbutself = numaq_send_IPI_allbutself, .send_IPI_all = numaq_send_IPI_all,
arch/x86/kernel/apic/summit_32.c +2 -7
@@ -52,11 +52,6 @@ static unsigned summit_get_apic_id(unsigreturn (x >>24 ) &0xFF ; } -static inline void summit_send_IPI_mask (const struct cpumask *mask,int vector) -{ -default_send_IPI_mask_sequence_logical (mask, vector); -} -static void summit_send_IPI_allbutself (int vector) {default_send_IPI_mask_allbutself_logical (cpu_online_mask, vector);
@@ -64,7 +59,7 @@ static void summit_send_IPI_allbutself(istatic void summit_send_IPI_all (int vector) { -summit_send_IPI_mask (cpu_online_mask, vector); +default_send_IPI_mask_sequence_logical (cpu_online_mask, vector); }#include <asm/tsc.h>
@@ -545,7 +540,7 @@ struct apic apic_summit = { .cpu_mask_to_apicid = summit_cpu_mask_to_apicid, .cpu_mask_to_apicid_and = summit_cpu_mask_to_apicid_and, - .send_IPI_mask = summit_send_IPI_mask, + .send_IPI_mask = default_send_IPI_mask_sequence_logical, .send_IPI_mask_allbutself = NULL, .send_IPI_allbutself = summit_send_IPI_allbutself, .send_IPI_all = summit_send_IPI_all,
RFC 2/2 x86, apic: Allow to send self NMI ipi
In reply to Cyrill Gorcunov--- arch/x86/include/asm/ipi.h | 6 ++++++ arch/x86/kernel/apic/ipi.c | 5 ++++- arch/x86/kernel/apic/probe_64.c | 5 ++++- arch/x86/kernel/apic/x2apic_cluster.c | 5 ++++- arch/x86/kernel/apic/x2apic_phys.c | 5 ++++- arch/x86/kernel/apic/x2apic_uv_x.c | 5 ++++- 6 files changed, 26 insertions(+), 5 deletions(-)
arch/x86/include/asm/ipi.h +6 -0
@@ -149,6 +149,12 @@ static inline void __default_local_send___default_send_IPI_shortcut (APIC_DEST_ALLINC , vector, apic->dest_logical); } +static inline void __default_send_IPI_self_nmi (void ) +{ +const struct cpumask *cpumask =cpumask_of (smp_processor_id ()); + apic->send_IPI_mask (cpumask,NMI_VECTOR ); +} +#ifdef CONFIG_X86_32 extern void default_send_IPI_mask_logical (const struct cpumask *mask,int vector);
arch/x86/kernel/apic/ipi.c +4 -1
@@ -134,7 +134,10 @@ void default_send_IPI_all(int vector)void default_send_IPI_self (int vector) { -__default_send_IPI_shortcut (APIC_DEST_SELF , vector, apic->dest_logical); +if (unlikely (vector ==NMI_VECTOR )) +__default_send_IPI_self_nmi (); +else +__default_send_IPI_shortcut (APIC_DEST_SELF , vector, apic->dest_logical); }/* must come after the send_IPI functions above for inlining */
arch/x86/kernel/apic/probe_64.c +4 -1
@@ -92,7 +92,10 @@ void __init default_setup_apic_routing(vvoid apic_send_IPI_self (int vector) { -__default_send_IPI_shortcut (APIC_DEST_SELF , vector,APIC_DEST_PHYSICAL ); +if (unlikely (vector ==NMI_VECTOR )) +__default_send_IPI_self_nmi (); +else +__default_send_IPI_shortcut (APIC_DEST_SELF , vector,APIC_DEST_PHYSICAL ); }int __init default_acpi_madt_oem_check (char *oem_id,char *oem_table_id)
arch/x86/kernel/apic/x2apic_cluster.c +4 -1
@@ -174,7 +174,10 @@ static int x2apic_cluster_phys_pkg_id(instatic void x2apic_send_IPI_self (int vector) { -apic_write (APIC_SELF_IPI , vector); +if (unlikely (vector ==NMI_VECTOR )) +__default_send_IPI_self_nmi (); +else +apic_write (APIC_SELF_IPI , vector); }static void init_x2apic_ldr (void )
arch/x86/kernel/apic/x2apic_phys.c +4 -1
@@ -166,7 +166,10 @@ static int x2apic_phys_pkg_id(int initiastatic void x2apic_send_IPI_self (int vector) { -apic_write (APIC_SELF_IPI , vector); +if (unlikely (vector ==NMI_VECTOR )) +__default_send_IPI_self_nmi (); +else +apic_write (APIC_SELF_IPI , vector); }static void init_x2apic_ldr (void )
arch/x86/kernel/apic/x2apic_uv_x.c +4 -1
@@ -274,7 +274,10 @@ static int uv_phys_pkg_id(int initial_apstatic void uv_send_IPI_self (int vector) { -apic_write (APIC_SELF_IPI , vector); +if (unlikely (vector ==NMI_VECTOR )) +__default_send_IPI_self_nmi (); +else +apic_write (APIC_SELF_IPI , vector); }struct apic __refdata apic_x2apic_uv_x = {
Quoted 2 lines · Cyrill Gorcunov
Here is self-IPI with NMI destination implemented. Don was testing
perf NMI's and we found that we don't have a simple call for self-nmi IPI.
I'm completely swamped with binutils stuff these days, and I've got a
couple of outstanding issues to deal with before the imminent 2.21 release -- I'll try to pinch some time and have a look at your patches over the weekend, but please forgive me if I don't (and ping me sometime next week then).
Maciej
Quoted 5 lines · Maciej W. Rozycki
Quoted 2 lines · Cyrill Gorcunov
Here is self-IPI with NMI destination implemented. Don was testing
perf NMI's and we found that we don't have a simple call for self-nmi IPI.
Quoted 8 lines
I'm completely swamped with binutils stuff these days, and I've got a
couple of outstanding issues to deal with before the imminent 2.21 release -- I'll try to pinch some time and have a look at your patches over the weekend, but please forgive me if I don't (and ping me sometime next week then).Maciej
No problem Maciej, it is _absolutely_ non urgent, just an early RFC.
Cyrill