mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@openvz.org>
To: linux-kernel@vger.kernel.org, "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>,
	Suresh Siddha <suresh.b.siddha@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Yinghai Lu <yinghai@kernel.org>, Don Zickus <dzickus@redhat.com>,
	Cyrill Gorcunov <gorcunov@openvz.org>
Subject: [rfc -tip 2/2] x86, apic: Allow to send self NMI ipi
Date: Wed, 27 Oct 2010 23:53:55 +0400	[thread overview]
Message-ID: <20101027200806.680836780@openvz.org> (raw)
In-Reply-To: <20101027195352.996250316@openvz.org>

[-- 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 = {


  parent reply	other threads:[~2010-10-27 20:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101027200806.680836780@openvz.org \
    --to=gorcunov@openvz.org \
    --cc=dzickus@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=macro@linux-mips.org \
    --cc=mingo@elte.hu \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome