public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander van Heukelum <heukelum@mailshack.com>
To: Cyrill Gorcunov <gorcunov@gmail.com>, Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCHv2 6/7] x86: traps_xx: modify default_do_nmi
Date: Wed, 2 Jul 2008 18:39:01 +0200	[thread overview]
Message-ID: <20080702163901.GA1283@mailshack.com> (raw)
In-Reply-To: <20080702161220.GA7003@cvg>

 - local caching of smp_processor_id() in default_do_nmi()
 - v2: do not split default_do_nmi over two lines

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>

---

On Wed, Jul 02, 2008 at 08:12:20PM +0400, Cyrill Gorcunov wrote:
> | -static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
> | +static notrace __kprobes void
> | +default_do_nmi(struct pt_regs *regs)
> | [ ... ]
> | -asmlinkage notrace  __kprobes void default_do_nmi(struct pt_regs *regs)
> | +asmlinkage notrace __kprobes void
> | +default_do_nmi(struct pt_regs *regs)
> 
> Hi Alexander, good done, thanks! But why did you split default_do_nmi
> definition by two lines? I think it would be better to keep them as it
> was before, ie by a single line
> 
> 	static notrace __kprobes void default_do_nmi(struct pt_regs *regs)

Thanks! Here is the replacement patch with default_do_nmi left on
a single line. Patch 7 applies with 1 line fuzz.

Greetings,
    Alexander

> 		- Cyrill -

diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index bed6e72..9e3b0c4 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -793,9 +793,12 @@ void notrace __kprobes die_nmi(char *str, struct pt_regs *regs, int do_panic)
 static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
 {
 	unsigned char reason = 0;
+	int cpu;
+
+	cpu = smp_processor_id();
 
-	/* Only the BSP gets external NMIs from the system: */
-	if (!smp_processor_id())
+	/* Only the BSP gets external NMIs from the system. */
+	if (!cpu)
 		reason = get_nmi_reason();
 
 	if (!(reason & 0xc0)) {
@@ -809,7 +812,7 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
 		 */
 		if (nmi_watchdog_tick(regs, reason))
 			return;
-		if (!do_nmi_callback(regs, smp_processor_id()))
+		if (!do_nmi_callback(regs, cpu))
 			unknown_nmi_error(reason, regs);
 #else
 		unknown_nmi_error(reason, regs);
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c
index 7511553..26ab0be 100644
--- a/arch/x86/kernel/traps_64.c
+++ b/arch/x86/kernel/traps_64.c
@@ -832,7 +832,7 @@ unknown_nmi_error(unsigned char reason, struct pt_regs * regs)
 
 /* Runs on IST stack. This code must keep interrupts off all the time.
    Nested NMIs are prevented by the CPU. */
-asmlinkage notrace  __kprobes void default_do_nmi(struct pt_regs *regs)
+asmlinkage notrace __kprobes void default_do_nmi(struct pt_regs *regs)
 {
 	unsigned char reason = 0;
 	int cpu;

  reply	other threads:[~2008-07-02 16:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-01 19:36 [PATCH] x86: Simple changes to make traps_32.c and traps_64.c more similar Alexander van Heukelum
2008-07-01 19:50 ` Ingo Molnar
2008-07-01 23:42   ` Alexander van Heukelum
2008-07-01 23:29 ` [PATCH] x86: initial changes to unify traps_32.c and traps_64.c Alexander van Heukelum
2008-07-01 23:30 ` [PATCH 2/7] x86: traps_xx: shuffle headers and globals Alexander van Heukelum
2008-07-01 23:31 ` [PATCH 3/7] x86: traps_xx: modify __die Alexander van Heukelum
2008-07-01 23:31 ` [PATCH 4/7] x86: traps_xx: modify do_trap Alexander van Heukelum
2008-07-01 23:32 ` [PATCH 5/7] x86: traps_xx: restructure do_general_protection() Alexander van Heukelum
2008-07-01 23:32 ` [PATCH] x86: traps_xx: modify default_do_nmi Alexander van Heukelum
2008-07-02 16:12   ` Cyrill Gorcunov
2008-07-02 16:39     ` Alexander van Heukelum [this message]
2008-07-02 17:16       ` [PATCHv2 6/7] " Cyrill Gorcunov
2008-07-09  6:19         ` Ingo Molnar
2008-07-01 23:33 ` [PATCH 7/7] x86: traps_xx: various small changes Alexander van Heukelum

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=20080702163901.GA1283@mailshack.com \
    --to=heukelum@mailshack.com \
    --cc=gorcunov@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /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