Skip to contentSkip to conversation

x86: ftrace - simplify wait_for_nmi

PATCH In review Cyrill Gorcunov 3 participants 4 messages Jan 26, 2009 – Jan 27, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: ftrace - simplify wait_for_nmi

Get rid of 'waited' stack variable.

---
 arch/x86/kernel/ftrace.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
arch/x86/kernel/ftrace.c +5 -6
Index: linux-2.6.git/arch/x86/kernel/ftrace.c
===================================================================
@@ -133,15 +133,14 @@ void ftrace_nmi_exit(void)
 
 static void wait_for_nmi(void)
 {
-	int waited = 0;
+	if (!atomic_read(&in_nmi))
+		return;
 
-	while (atomic_read(&in_nmi)) {
-		waited = 1;
+	do {
 		cpu_relax();
-	}
+	} while(atomic_read(&in_nmi));
 
-	if (waited)
-		nmi_wait_count++;
+	nmi_wait_count++;
 }
 
 static int
maintainer
#1 lore raw
Quoted 3 lines · Cyrill Gorcunov

Get rid of 'waited' stack variable.

Thanks Cyrill,

Either I or Ingo will pull it in.

-- Steve

Quoted 31 lines
---
 arch/x86/kernel/ftrace.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Index: linux-2.6.git/arch/x86/kernel/ftrace.c
===================================================================

arch/x86/kernel/ftrace.c +5 -6
@@ -133,15 +133,14 @@ void ftrace_nmi_exit(void)
 
 static void wait_for_nmi(void)
 {
-	int waited = 0;
+	if (!atomic_read(&in_nmi))
+		return;
 
-	while (atomic_read(&in_nmi)) {
-		waited = 1;
+	do {
 		cpu_relax();
-	}
+	} while(atomic_read(&in_nmi));
 
-	if (waited)
-		nmi_wait_count++;
+	nmi_wait_count++;
 }
 
 static int
maintainer
#2 lore raw

Ingo,

The following patch is in:

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git

branch: tip/devel

Cyrill Gorcunov (1):
x86: ftrace - simplify wait_for_nmi

----

 arch/x86/kernel/ftrace.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
---------------------------
commit e4733771167c00aa8bf8791307ca47f1c0420f55
Author: Cyrill Gorcunov <[email protected]>
Date:   Mon Jan 26 18:28:02 2009 +0300

x86: ftrace - simplify wait_for_nmi

Get rid of 'waited' stack variable.

arch/x86/kernel/ftrace.c +5 -6
index 1b43086..4d33224 100644
@@ -133,15 +133,14 @@ void ftrace_nmi_exit(void)
 
 static void wait_for_nmi(void)
 {
-	int waited = 0;
+	if (!atomic_read(&in_nmi))
+		return;
 
-	while (atomic_read(&in_nmi)) {
-		waited = 1;
+	do {
 		cpu_relax();
-	}
+	} while(atomic_read(&in_nmi));
 
-	if (waited)
-		nmi_wait_count++;
+	nmi_wait_count++;
 }
 
 static int
#3 lore raw
Quoted 10 lines · Steven Rostedt

Ingo,

The following patch is in:

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git

branch: tip/devel

Quoted 6 lines

Cyrill Gorcunov (1):
x86: ftrace - simplify wait_for_nmi

----

 arch/x86/kernel/ftrace.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

Pulled, thanks guys!

Ingo