* [rfc -tip 0/2] Implementing self IPI with NMI destination
@ 2010-10-27 19:53 Cyrill Gorcunov
2010-10-27 19:53 ` [rfc -tip 1/2] x86, apic: Get rid of some IPI wrappers Cyrill Gorcunov
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Cyrill Gorcunov @ 2010-10-27 19:53 UTC (permalink / raw)
To: linux-kernel, Maciej W. Rozycki
Cc: Ingo Molnar, H. Peter Anvin, Suresh Siddha, Thomas Gleixner,
Yinghai Lu, Don Zickus
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [rfc -tip 1/2] x86, apic: Get rid of some IPI wrappers
2010-10-27 19:53 [rfc -tip 0/2] Implementing self IPI with NMI destination Cyrill Gorcunov
@ 2010-10-27 19:53 ` Cyrill Gorcunov
2010-10-27 19:53 ` [rfc -tip 2/2] x86, apic: Allow to send self NMI ipi Cyrill Gorcunov
2010-10-27 20:18 ` [rfc -tip 0/2] Implementing self IPI with NMI destination Maciej W. Rozycki
2 siblings, 0 replies; 5+ messages in thread
From: Cyrill Gorcunov @ 2010-10-27 19:53 UTC (permalink / raw)
To: linux-kernel, Maciej W. Rozycki
Cc: Ingo Molnar, H. Peter Anvin, Suresh Siddha, Thomas Gleixner,
Yinghai Lu, Don Zickus, Cyrill Gorcunov
[-- Attachment #1: x86-apic-no-ipi-wrappers --]
[-- Type: text/plain, Size: 7557 bytes --]
They just hide the sameness of methods.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Don Zickus <dzickus@redhat.com>
---
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(-)
Index: linux-2.6.git/arch/x86/kernel/apic/apic_flat_64.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic/apic_flat_64.c
+++ linux-2.6.git/arch/x86/kernel/apic/apic_flat_64.c
@@ -261,17 +261,6 @@ static void physflat_vector_allocation_d
cpumask_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_allbutself
static 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,
Index: linux-2.6.git/arch/x86/kernel/apic/bigsmp_32.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic/bigsmp_32.c
+++ linux-2.6.git/arch/x86/kernel/apic/bigsmp_32.c
@@ -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(i
static 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,
Index: linux-2.6.git/arch/x86/kernel/apic/es7000_32.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic/es7000_32.c
+++ linux-2.6.git/arch/x86/kernel/apic/es7000_32.c
@@ -420,11 +420,6 @@ static unsigned int es7000_get_apic_id(u
return (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(i
static 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,
Index: linux-2.6.git/arch/x86/kernel/apic/numaq_32.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic/numaq_32.c
+++ linux-2.6.git/arch/x86/kernel/apic/numaq_32.c
@@ -299,11 +299,6 @@ static inline unsigned int numaq_get_api
return (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_allbut
static 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,
Index: linux-2.6.git/arch/x86/kernel/apic/summit_32.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic/summit_32.c
+++ linux-2.6.git/arch/x86/kernel/apic/summit_32.c
@@ -52,11 +52,6 @@ static unsigned summit_get_apic_id(unsig
return (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(i
static 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,
^ permalink raw reply [flat|nested] 5+ messages in thread
* [rfc -tip 2/2] x86, apic: Allow to send self NMI ipi
2010-10-27 19:53 [rfc -tip 0/2] Implementing self IPI with NMI destination Cyrill Gorcunov
2010-10-27 19:53 ` [rfc -tip 1/2] x86, apic: Get rid of some IPI wrappers Cyrill Gorcunov
@ 2010-10-27 19:53 ` Cyrill Gorcunov
2010-10-27 20:18 ` [rfc -tip 0/2] Implementing self IPI with NMI destination Maciej W. Rozycki
2 siblings, 0 replies; 5+ messages in thread
From: Cyrill Gorcunov @ 2010-10-27 19:53 UTC (permalink / raw)
To: linux-kernel, Maciej W. Rozycki
Cc: Ingo Molnar, H. Peter Anvin, Suresh Siddha, Thomas Gleixner,
Yinghai Lu, Don Zickus, Cyrill Gorcunov
[-- Attachment #1: x86-apic-ipi-self-nmi --]
[-- Type: text/plain, Size: 4005 bytes --]
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Don Zickus <dzickus@redhat.com>
---
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(-)
Index: linux-2.6.git/arch/x86/include/asm/ipi.h
=====================================================================
--- linux-2.6.git.orig/arch/x86/include/asm/ipi.h
+++ linux-2.6.git/arch/x86/include/asm/ipi.h
@@ -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);
Index: linux-2.6.git/arch/x86/kernel/apic/ipi.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic/ipi.c
+++ linux-2.6.git/arch/x86/kernel/apic/ipi.c
@@ -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 */
Index: linux-2.6.git/arch/x86/kernel/apic/probe_64.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic/probe_64.c
+++ linux-2.6.git/arch/x86/kernel/apic/probe_64.c
@@ -92,7 +92,10 @@ void __init default_setup_apic_routing(v
void 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)
Index: linux-2.6.git/arch/x86/kernel/apic/x2apic_cluster.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic/x2apic_cluster.c
+++ linux-2.6.git/arch/x86/kernel/apic/x2apic_cluster.c
@@ -174,7 +174,10 @@ static int x2apic_cluster_phys_pkg_id(in
static 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)
Index: linux-2.6.git/arch/x86/kernel/apic/x2apic_phys.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic/x2apic_phys.c
+++ linux-2.6.git/arch/x86/kernel/apic/x2apic_phys.c
@@ -166,7 +166,10 @@ static int x2apic_phys_pkg_id(int initia
static 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)
Index: linux-2.6.git/arch/x86/kernel/apic/x2apic_uv_x.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic/x2apic_uv_x.c
+++ linux-2.6.git/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -274,7 +274,10 @@ static int uv_phys_pkg_id(int initial_ap
static 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 = {
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [rfc -tip 0/2] Implementing self IPI with NMI destination
2010-10-27 19:53 [rfc -tip 0/2] Implementing self IPI with NMI destination Cyrill Gorcunov
2010-10-27 19:53 ` [rfc -tip 1/2] x86, apic: Get rid of some IPI wrappers Cyrill Gorcunov
2010-10-27 19:53 ` [rfc -tip 2/2] x86, apic: Allow to send self NMI ipi Cyrill Gorcunov
@ 2010-10-27 20:18 ` Maciej W. Rozycki
2010-10-27 20:22 ` Cyrill Gorcunov
2 siblings, 1 reply; 5+ messages in thread
From: Maciej W. Rozycki @ 2010-10-27 20:18 UTC (permalink / raw)
To: Cyrill Gorcunov
Cc: linux-kernel, Ingo Molnar, H. Peter Anvin, Suresh Siddha,
Thomas Gleixner, Yinghai Lu, Don Zickus
On Wed, 27 Oct 2010, Cyrill Gorcunov wrote:
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [rfc -tip 0/2] Implementing self IPI with NMI destination
2010-10-27 20:18 ` [rfc -tip 0/2] Implementing self IPI with NMI destination Maciej W. Rozycki
@ 2010-10-27 20:22 ` Cyrill Gorcunov
0 siblings, 0 replies; 5+ messages in thread
From: Cyrill Gorcunov @ 2010-10-27 20:22 UTC (permalink / raw)
To: Maciej W. Rozycki
Cc: linux-kernel, Ingo Molnar, H. Peter Anvin, Suresh Siddha,
Thomas Gleixner, Yinghai Lu, Don Zickus
On Wed, Oct 27, 2010 at 09:18:33PM +0100, Maciej W. Rozycki wrote:
> On Wed, 27 Oct 2010, Cyrill Gorcunov wrote:
>
> > 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
>
No problem Maciej, it is _absolutely_ non urgent, just an early RFC.
Cyrill
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-10-27 20:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-27 19:53 [rfc -tip 0/2] Implementing self IPI with NMI destination Cyrill Gorcunov
2010-10-27 19:53 ` [rfc -tip 1/2] x86, apic: Get rid of some IPI wrappers Cyrill Gorcunov
2010-10-27 19:53 ` [rfc -tip 2/2] x86, apic: Allow to send self NMI ipi Cyrill Gorcunov
2010-10-27 20:18 ` [rfc -tip 0/2] Implementing self IPI with NMI destination Maciej W. Rozycki
2010-10-27 20:22 ` Cyrill Gorcunov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.