public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Steven Rostedt <srostedt@redhat.com>
Subject: [PATCH 4/8] ftrace, x86: rename in_nmi variable
Date: Sun, 08 Feb 2009 00:49:59 -0500	[thread overview]
Message-ID: <20090208055341.238277922@goodmis.org> (raw)
In-Reply-To: 20090208054955.777429253@goodmis.org

[-- Attachment #1: 0004-ftrace-x86-rename-in_nmi-variable.patch --]
[-- Type: text/plain, Size: 2698 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

Impact: clean up

The in_nmi variable in x86 arch ftrace.c is a misnomer.
Andrew Morton pointed out that the in_nmi variable is incremented
by all CPUS. It can be set when another CPU is running an NMI.

Since this is actually intentional, the fix is to rename it to
what it really is: "nmi_running"

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
 arch/x86/kernel/ftrace.c |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index 4c68358..e3fad2e 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -82,7 +82,7 @@ static unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
  * are the same as what exists.
  */
 
-static atomic_t in_nmi = ATOMIC_INIT(0);
+static atomic_t nmi_running = ATOMIC_INIT(0);
 static int mod_code_status;		/* holds return value of text write */
 static int mod_code_write;		/* set when NMI should do the write */
 static void *mod_code_ip;		/* holds the IP to write to */
@@ -115,8 +115,8 @@ static void ftrace_mod_code(void)
 
 void arch_ftrace_nmi_enter(void)
 {
-	atomic_inc(&in_nmi);
-	/* Must have in_nmi seen before reading write flag */
+	atomic_inc(&nmi_running);
+	/* Must have nmi_running seen before reading write flag */
 	smp_mb();
 	if (mod_code_write) {
 		ftrace_mod_code();
@@ -126,19 +126,19 @@ void arch_ftrace_nmi_enter(void)
 
 void arch_ftrace_nmi_exit(void)
 {
-	/* Finish all executions before clearing in_nmi */
+	/* Finish all executions before clearing nmi_running */
 	smp_wmb();
-	atomic_dec(&in_nmi);
+	atomic_dec(&nmi_running);
 }
 
 static void wait_for_nmi(void)
 {
-	if (!atomic_read(&in_nmi))
+	if (!atomic_read(&nmi_running))
 		return;
 
 	do {
 		cpu_relax();
-	} while(atomic_read(&in_nmi));
+	} while (atomic_read(&nmi_running));
 
 	nmi_wait_count++;
 }
@@ -374,16 +374,16 @@ int ftrace_disable_ftrace_graph_caller(void)
  * this page for dynamic ftrace. They have been
  * simplified to ignore all traces in NMI context.
  */
-static atomic_t in_nmi;
+static atomic_t nmi_running;
 
 void arch_ftrace_nmi_enter(void)
 {
-	atomic_inc(&in_nmi);
+	atomic_inc(&nmi_running);
 }
 
 void arch_ftrace_nmi_exit(void)
 {
-	atomic_dec(&in_nmi);
+	atomic_dec(&nmi_running);
 }
 
 #endif /* !CONFIG_DYNAMIC_FTRACE */
@@ -475,7 +475,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
 				&return_to_handler;
 
 	/* Nmi's are currently unsupported */
-	if (unlikely(atomic_read(&in_nmi)))
+	if (unlikely(atomic_read(&nmi_running)))
 		return;
 
 	if (unlikely(atomic_read(&current->tracing_graph_pause)))
-- 
1.5.6.5

-- 

  parent reply	other threads:[~2009-02-08  5:54 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-08  5:49 [PATCH 0/8] git pull request for tip/tracing/core Steven Rostedt
2009-02-08  5:49 ` [PATCH 1/8] trace: remove deprecated entry->cpu Steven Rostedt
2009-02-08 12:29   ` Frederic Weisbecker
2009-02-08  5:49 ` [PATCH 2/8] ring-buffer: add NMI protection for spinlocks Steven Rostedt
2009-02-08  5:49 ` [PATCH 3/8] ring-buffer: allow tracing_off to be used in core kernel code Steven Rostedt
2009-02-08  5:49 ` Steven Rostedt [this message]
2009-02-08  5:50 ` [PATCH 5/8] nmi: add generic nmi tracking state Steven Rostedt
2009-02-08  5:50 ` [PATCH 6/8] ftrace: change function graph tracer to use new in_nmi Steven Rostedt
2009-02-08  5:50 ` [PATCH 7/8] ring-buffer: use generic version of in_nmi Steven Rostedt
2009-02-08  5:50 ` [PATCH 8/8] trace: trivial fixes in comment typos Steven Rostedt
2009-02-09  9:37 ` [PATCH 0/8] git pull request for tip/tracing/core Ingo Molnar
2009-02-11 15:36   ` Ingo Molnar
2009-02-11 15:46     ` Steven Rostedt
2009-02-11 16:25       ` Ingo Molnar
2009-02-11 16:33         ` Steven Rostedt
2009-02-11 16:49     ` Steven Rostedt
2009-02-11 16:59       ` Steven Rostedt
2009-02-11 17:16         ` Ingo Molnar
2009-02-11 17:30           ` Steven Rostedt
2009-02-11 17:31             ` Ingo Molnar
2009-02-11 17:57               ` Luck, Tony
2009-02-11 18:23                 ` Steven Rostedt
2009-02-11 18:34                   ` Luck, Tony
2009-02-11 18:42                     ` Steven Rostedt
2009-02-11 20:20                       ` Ingo Molnar
2009-02-11 20:39                 ` Jack Steiner
2009-02-12  2:39                 ` Kenji Kaneshige
2009-02-12  2:43                   ` Steven Rostedt
2009-02-12  3:15                     ` Kenji Kaneshige
2009-02-12  3:22                       ` Steven Rostedt

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=20090208055341.238277922@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=acme@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=srostedt@redhat.com \
    --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