public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Baron <jbaron@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Frederic Weisbecker <fweisbec@gmail.com>
Subject: Re: [PATCH 0/9] [GIT PULL] tracing: updates for 2.6.37
Date: Wed, 13 Oct 2010 17:46:15 -0400	[thread overview]
Message-ID: <20101013214614.GC2878@redhat.com> (raw)
In-Reply-To: <1286596787.23994.1285.camel@gandalf.stny.rr.com>

On Fri, Oct 08, 2010 at 11:59:47PM -0400, Steven Rostedt wrote:
> On Fri, 2010-10-08 at 10:45 +0200, Ingo Molnar wrote:
> > hm, i'm getting:
> > 
> > arch/x86/kernel/alternative.c: Assembler messages:
> > arch/x86/kernel/alternative.c:674: Error: symbol `ftrace_test_jmp' is already defined
> > arch/x86/kernel/alternative.c:678: Error: symbol `ftrace_test_p6nop' is already defined
> > arch/x86/kernel/alternative.c:680: Error: symbol `ftrace_test_nop5' is already defined
> > 
> > Config attached.
> 
> I'll see if I can get to this early next week. I'll be leaving to NYC on
> Monday for the End Users Summit. I'll try to look at this while there.
> 
> Thanks!
> 
> -- Steve
> 

just saw this...looks like this is broken for gcc < 4.5. Anyways, the
patch below fixes the compilation by making arch_init_ideal_nop5()
static (and moving its definition ahead of its usage). I'm not quite
sure why this makes the compiler happy...applies on top of this series.

thanks,

-Jason


make arch_init_ideal_nop5() static. fixes compilation error:

arch/x86/kernel/alternative.c: Assembler messages:
arch/x86/kernel/alternative.c:674: Error: symbol `ftrace_test_jmp' is already defined
arch/x86/kernel/alternative.c:678: Error: symbol `ftrace_test_p6nop' is already defined
arch/x86/kernel/alternative.c:680: Error: symbol `ftrace_test_nop5' is already defined

Signed-off-by: Jason Baron <jbaron@redhat.com>
---
 arch/x86/include/asm/alternative.h |    1 -
 arch/x86/kernel/alternative.c      |  130 ++++++++++++++++++------------------
 2 files changed, 65 insertions(+), 66 deletions(-)

diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h
index 76561d2..2a7f618 100644
--- a/arch/x86/include/asm/alternative.h
+++ b/arch/x86/include/asm/alternative.h
@@ -186,7 +186,6 @@ extern void *text_poke_smp(void *addr, const void *opcode, size_t len);
 #if defined(CONFIG_DYNAMIC_FTRACE) || defined(HAVE_JUMP_LABEL)
 #define IDEAL_NOP_SIZE_5 5
 extern unsigned char ideal_nop5[IDEAL_NOP_SIZE_5];
-extern void arch_init_ideal_nop5(void);
 #else
 static inline void arch_init_ideal_nop5(void) {}
 #endif
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index d8b5b21..2331b68 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -452,6 +452,71 @@ extern struct paravirt_patch_site __start_parainstructions[],
 	__stop_parainstructions[];
 #endif	/* CONFIG_PARAVIRT */
 
+#if defined(CONFIG_DYNAMIC_FTRACE) || defined(HAVE_JUMP_LABEL)
+
+unsigned char ideal_nop5[IDEAL_NOP_SIZE_5];
+
+static void __init arch_init_ideal_nop5(void)
+{
+	extern const unsigned char ftrace_test_p6nop[];
+	extern const unsigned char ftrace_test_nop5[];
+	extern const unsigned char ftrace_test_jmp[];
+	int faulted = 0;
+
+	/*
+	 * There is no good nop for all x86 archs.
+	 * We will default to using the P6_NOP5, but first we
+	 * will test to make sure that the nop will actually
+	 * work on this CPU. If it faults, we will then
+	 * go to a lesser efficient 5 byte nop. If that fails
+	 * we then just use a jmp as our nop. This isn't the most
+	 * efficient nop, but we can not use a multi part nop
+	 * since we would then risk being preempted in the middle
+	 * of that nop, and if we enabled tracing then, it might
+	 * cause a system crash.
+	 *
+	 * TODO: check the cpuid to determine the best nop.
+	 */
+	asm volatile (
+		"ftrace_test_jmp:"
+		"jmp ftrace_test_p6nop\n"
+		"nop\n"
+		"nop\n"
+		"nop\n"  /* 2 byte jmp + 3 bytes */
+		"ftrace_test_p6nop:"
+		P6_NOP5
+		"jmp 1f\n"
+		"ftrace_test_nop5:"
+		".byte 0x66,0x66,0x66,0x66,0x90\n"
+		"1:"
+		".section .fixup, \"ax\"\n"
+		"2:	movl $1, %0\n"
+		"	jmp ftrace_test_nop5\n"
+		"3:	movl $2, %0\n"
+		"	jmp 1b\n"
+		".previous\n"
+		_ASM_EXTABLE(ftrace_test_p6nop, 2b)
+		_ASM_EXTABLE(ftrace_test_nop5, 3b)
+		: "=r"(faulted) : "0" (faulted));
+
+	switch (faulted) {
+	case 0:
+		pr_info("converting mcount calls to 0f 1f 44 00 00\n");
+		memcpy(ideal_nop5, ftrace_test_p6nop, IDEAL_NOP_SIZE_5);
+		break;
+	case 1:
+		pr_info("converting mcount calls to 66 66 66 66 90\n");
+		memcpy(ideal_nop5, ftrace_test_nop5, IDEAL_NOP_SIZE_5);
+		break;
+	case 2:
+		pr_info("converting mcount calls to jmp . + 5\n");
+		memcpy(ideal_nop5, ftrace_test_jmp, IDEAL_NOP_SIZE_5);
+		break;
+	}
+
+}
+#endif
+
 void __init alternative_instructions(void)
 {
 	unsigned long flags;
@@ -645,68 +710,3 @@ void *__kprobes text_poke_smp(void *addr, const void *opcode, size_t len)
 	stop_machine(stop_machine_text_poke, (void *)&tpp, NULL);
 	return addr;
 }
-
-#if defined(CONFIG_DYNAMIC_FTRACE) || defined(HAVE_JUMP_LABEL)
-
-unsigned char ideal_nop5[IDEAL_NOP_SIZE_5];
-
-void __init arch_init_ideal_nop5(void)
-{
-	extern const unsigned char ftrace_test_p6nop[];
-	extern const unsigned char ftrace_test_nop5[];
-	extern const unsigned char ftrace_test_jmp[];
-	int faulted = 0;
-
-	/*
-	 * There is no good nop for all x86 archs.
-	 * We will default to using the P6_NOP5, but first we
-	 * will test to make sure that the nop will actually
-	 * work on this CPU. If it faults, we will then
-	 * go to a lesser efficient 5 byte nop. If that fails
-	 * we then just use a jmp as our nop. This isn't the most
-	 * efficient nop, but we can not use a multi part nop
-	 * since we would then risk being preempted in the middle
-	 * of that nop, and if we enabled tracing then, it might
-	 * cause a system crash.
-	 *
-	 * TODO: check the cpuid to determine the best nop.
-	 */
-	asm volatile (
-		"ftrace_test_jmp:"
-		"jmp ftrace_test_p6nop\n"
-		"nop\n"
-		"nop\n"
-		"nop\n"  /* 2 byte jmp + 3 bytes */
-		"ftrace_test_p6nop:"
-		P6_NOP5
-		"jmp 1f\n"
-		"ftrace_test_nop5:"
-		".byte 0x66,0x66,0x66,0x66,0x90\n"
-		"1:"
-		".section .fixup, \"ax\"\n"
-		"2:	movl $1, %0\n"
-		"	jmp ftrace_test_nop5\n"
-		"3:	movl $2, %0\n"
-		"	jmp 1b\n"
-		".previous\n"
-		_ASM_EXTABLE(ftrace_test_p6nop, 2b)
-		_ASM_EXTABLE(ftrace_test_nop5, 3b)
-		: "=r"(faulted) : "0" (faulted));
-
-	switch (faulted) {
-	case 0:
-		pr_info("converting mcount calls to 0f 1f 44 00 00\n");
-		memcpy(ideal_nop5, ftrace_test_p6nop, IDEAL_NOP_SIZE_5);
-		break;
-	case 1:
-		pr_info("converting mcount calls to 66 66 66 66 90\n");
-		memcpy(ideal_nop5, ftrace_test_nop5, IDEAL_NOP_SIZE_5);
-		break;
-	case 2:
-		pr_info("converting mcount calls to jmp . + 5\n");
-		memcpy(ideal_nop5, ftrace_test_jmp, IDEAL_NOP_SIZE_5);
-		break;
-	}
-
-}
-#endif
-- 
1.7.0.1


  reply	other threads:[~2010-10-13 21:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-06  3:34 [PATCH 0/9] [GIT PULL] tracing: updates for 2.6.37 Steven Rostedt
2010-10-06  3:34 ` [PATCH 1/9] tracing/trivial: Remove cast from void* Steven Rostedt
2010-10-06  3:34 ` [PATCH 2/9] jump label/x86: Move arch_init_ideal_nop5 later Steven Rostedt
2010-10-06  3:34 ` [PATCH 3/9] tracing/x86: No need to disable interrupts when calling arch_init_ideal_nop5 Steven Rostedt
2010-10-06  3:34 ` [PATCH 4/9] tracing: Add proper check for irq_depth routines Steven Rostedt
2010-10-06  3:34 ` [PATCH 5/9] tracing: Make graph related irqs/preemptsoff functions global Steven Rostedt
2010-10-06  3:34 ` [PATCH 6/9] tracing: Graph support for wakeup tracer Steven Rostedt
2010-10-06  3:34 ` [PATCH 7/9] tracing: Use one prologue for the wakeup tracer function tracers Steven Rostedt
2010-10-06  3:34 ` [PATCH 8/9] tracing: Use one prologue for the preempt irqs off " Steven Rostedt
2010-10-06  3:34 ` [PATCH 9/9] tracing: Remove parent recording in latency tracer graph options Steven Rostedt
2010-10-08  8:16 ` [PATCH 0/9] [GIT PULL] tracing: updates for 2.6.37 Ingo Molnar
2010-10-08  8:45   ` Ingo Molnar
2010-10-09  3:59     ` Steven Rostedt
2010-10-13 21:46       ` Jason Baron [this message]
2010-10-16  2:03         ` 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=20101013214614.GC2878@redhat.com \
    --to=jbaron@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.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