Patchwork Bug#609371: linux-image-2.6.37-trunk-sparc64: module scsi_mod: Unknown relocation: 36

login
register
mail settings
Submitter Mathieu Desnoyers
Date Jan. 18, 2011, 4:46 p.m.
Message ID <20110118164633.GA12872@Krystal>
Download mbox | patch
Permalink /patch/79329/
State RFC
Delegated to: David Miller
Headers show

Comments

Mathieu Desnoyers - Jan. 18, 2011, 4:46 p.m.
* David Miller (davem@davemloft.net) wrote:
> From: David Miller <davem@davemloft.net>
> Date: Mon, 17 Jan 2011 22:00:39 -0800 (PST)
> 
> > ftrace: Remove unnecessary alignment tag from ftrace_event_call.
> > 
> > It's completely unnecessary and causes problems on platforms
> > where this tag down-aligns the structure's alignment.
> > 
> > Signed-off-by: David S. Miller <davem@davemloft.net>
>  ...
> 
> Ok, unless we can explain why these alignments are needed at all, we
> should kill all of them:

ftrace: linker script add missing struct align

We should add the missing "STRUCT_ALIGN();" in
include/asm-generic/vmlinux.lds.h as a preliminary step to remove the ftrace
bogus structure alignments. Moving all STRUCT_ALIGN() for FTRACE_EVENTS()
and TRACE_SYSCALLS() into the definitions, so the alignment is only done if
these infrastructures are configured in. 

Also align TRACE_PRINTKS on 8 bytes to make sure the beginning of the section is
aligned on pointer size.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
---
 include/asm-generic/vmlinux.lds.h |   19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
Steven Rostedt - Jan. 18, 2011, 5:33 p.m.
On Tue, 2011-01-18 at 11:46 -0500, Mathieu Desnoyers wrote:
> * David Miller (davem@davemloft.net) wrote:
> > From: David Miller <davem@davemloft.net>
> > Date: Mon, 17 Jan 2011 22:00:39 -0800 (PST)
> > 
> > > ftrace: Remove unnecessary alignment tag from ftrace_event_call.
> > > 
> > > It's completely unnecessary and causes problems on platforms
> > > where this tag down-aligns the structure's alignment.
> > > 
> > > Signed-off-by: David S. Miller <davem@davemloft.net>
> >  ...
> > 
> > Ok, unless we can explain why these alignments are needed at all, we
> > should kill all of them:
> 
> ftrace: linker script add missing struct align
> 
> We should add the missing "STRUCT_ALIGN();" in
> include/asm-generic/vmlinux.lds.h as a preliminary step to remove the ftrace
> bogus structure alignments. Moving all STRUCT_ALIGN() for FTRACE_EVENTS()
> and TRACE_SYSCALLS() into the definitions, so the alignment is only done if
> these infrastructures are configured in. 
> 
> Also align TRACE_PRINTKS on 8 bytes to make sure the beginning of the section is
> aligned on pointer size.

If I can make it crash without the alignments and this fixes the issue,
I'll apply both patches.

Thanks,

-- Steve

> 
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> ---
>  include/asm-generic/vmlinux.lds.h |   19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> Index: linux-2.6-lttng/include/asm-generic/vmlinux.lds.h
> ===================================================================
> --- linux-2.6-lttng.orig/include/asm-generic/vmlinux.lds.h
> +++ linux-2.6-lttng/include/asm-generic/vmlinux.lds.h
> @@ -107,7 +107,8 @@
>  #endif
>  
>  #ifdef CONFIG_TRACE_BRANCH_PROFILING
> -#define LIKELY_PROFILE()	VMLINUX_SYMBOL(__start_annotated_branch_profile) = .; \
> +#define LIKELY_PROFILE()	STRUCT_ALIGN();					      \
> +				VMLINUX_SYMBOL(__start_annotated_branch_profile) = .; \
>  				*(_ftrace_annotated_branch)			      \
>  				VMLINUX_SYMBOL(__stop_annotated_branch_profile) = .;
>  #else
> @@ -115,7 +116,8 @@
>  #endif
>  
>  #ifdef CONFIG_PROFILE_ALL_BRANCHES
> -#define BRANCH_PROFILE()	VMLINUX_SYMBOL(__start_branch_profile) = .;   \
> +#define BRANCH_PROFILE()	STRUCT_ALIGN();				      \
> +				VMLINUX_SYMBOL(__start_branch_profile) = .;   \
>  				*(_ftrace_branch)			      \
>  				VMLINUX_SYMBOL(__stop_branch_profile) = .;
>  #else
> @@ -123,7 +125,8 @@
>  #endif
>  
>  #ifdef CONFIG_EVENT_TRACING
> -#define FTRACE_EVENTS()	VMLINUX_SYMBOL(__start_ftrace_events) = .;	\
> +#define FTRACE_EVENTS()	STRUCT_ALIGN();					\
> +			VMLINUX_SYMBOL(__start_ftrace_events) = .;	\
>  			*(_ftrace_events)				\
>  			VMLINUX_SYMBOL(__stop_ftrace_events) = .;
>  #else
> @@ -131,7 +134,8 @@
>  #endif
>  
>  #ifdef CONFIG_TRACING
> -#define TRACE_PRINTKS() VMLINUX_SYMBOL(__start___trace_bprintk_fmt) = .;      \
> +#define TRACE_PRINTKS()  . = ALIGN(8);					       \
> +			 VMLINUX_SYMBOL(__start___trace_bprintk_fmt) = .;      \
>  			 *(__trace_printk_fmt) /* Trace_printk fmt' pointer */ \
>  			 VMLINUX_SYMBOL(__stop___trace_bprintk_fmt) = .;
>  #else
> @@ -139,7 +143,8 @@
>  #endif
>  
>  #ifdef CONFIG_FTRACE_SYSCALLS
> -#define TRACE_SYSCALLS() VMLINUX_SYMBOL(__start_syscalls_metadata) = .;	\
> +#define TRACE_SYSCALLS() STRUCT_ALIGN();				\
> +			 VMLINUX_SYMBOL(__start_syscalls_metadata) = .;	\
>  			 *(__syscalls_metadata)				\
>  			 VMLINUX_SYMBOL(__stop_syscalls_metadata) = .;
>  #else
> @@ -169,11 +174,7 @@
>  	LIKELY_PROFILE()		       				\
>  	BRANCH_PROFILE()						\
>  	TRACE_PRINTKS()							\
> -									\
> -	STRUCT_ALIGN();							\
>  	FTRACE_EVENTS()							\
> -									\
> -	STRUCT_ALIGN();							\
>  	TRACE_SYSCALLS()
>  
>  /*
> 
> 
> 


--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steven Rostedt - Jan. 18, 2011, 6:16 p.m.
On Tue, 2011-01-18 at 12:33 -0500, Steven Rostedt wrote:
> On Tue, 2011-01-18 at 11:46 -0500, Mathieu Desnoyers wrote:

> > Also align TRACE_PRINTKS on 8 bytes to make sure the beginning of the section is
> > aligned on pointer size.
> 
> If I can make it crash without the alignments and this fixes the issue,
> I'll apply both patches.

After applying David's patch, I do indeed get a crash. I'll now apply
yours and see if it fixes the issue.

-- Steve


--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steven Rostedt - Jan. 18, 2011, 6:26 p.m.
On Tue, 2011-01-18 at 13:16 -0500, Steven Rostedt wrote:
> On Tue, 2011-01-18 at 12:33 -0500, Steven Rostedt wrote:
> > On Tue, 2011-01-18 at 11:46 -0500, Mathieu Desnoyers wrote:
> 
> > > Also align TRACE_PRINTKS on 8 bytes to make sure the beginning of the section is
> > > aligned on pointer size.
> > 
> > If I can make it crash without the alignments and this fixes the issue,
> > I'll apply both patches.
> 
> After applying David's patch, I do indeed get a crash. I'll now apply
> yours and see if it fixes the issue.

Your patch doesn't seem to fix it either. I'll investigate this further.

-- Steve


--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mathieu Desnoyers - Jan. 18, 2011, 8:13 p.m.
* Steven Rostedt (rostedt@goodmis.org) wrote:
> On Tue, 2011-01-18 at 13:16 -0500, Steven Rostedt wrote:
> > On Tue, 2011-01-18 at 12:33 -0500, Steven Rostedt wrote:
> > > On Tue, 2011-01-18 at 11:46 -0500, Mathieu Desnoyers wrote:
> > 
> > > > Also align TRACE_PRINTKS on 8 bytes to make sure the beginning of the section is
> > > > aligned on pointer size.
> > > 
> > > If I can make it crash without the alignments and this fixes the issue,
> > > I'll apply both patches.
> > 
> > After applying David's patch, I do indeed get a crash. I'll now apply
> > yours and see if it fixes the issue.
> 
> Your patch doesn't seem to fix it either. I'll investigate this further.

I think David's patch missed kernel/trace/trace_export.c

struct ftrace_event_call __used                                         \
__attribute__((__aligned__(4)))                                         \
__attribute__((section("_ftrace_events"))) event_##call = {             \

and kernel/trace/trace.h:

#define FTRACE_ENTRY(call, struct_name, id, tstruct, print)             \
        extern struct ftrace_event_call                                 \
        __attribute__((__aligned__(4))) event_##call;

does it help if you remove these ?

Mathieu


> 
> -- Steve
> 
>
Steven Rostedt - Jan. 18, 2011, 8:22 p.m.
On Tue, 2011-01-18 at 15:13 -0500, Mathieu Desnoyers wrote:
> * Steven Rostedt (rostedt@goodmis.org) wrote:
> > On Tue, 2011-01-18 at 13:16 -0500, Steven Rostedt wrote:
> > > On Tue, 2011-01-18 at 12:33 -0500, Steven Rostedt wrote:
> > > > On Tue, 2011-01-18 at 11:46 -0500, Mathieu Desnoyers wrote:
> > > 
> > > > > Also align TRACE_PRINTKS on 8 bytes to make sure the beginning of the section is
> > > > > aligned on pointer size.
> > > > 
> > > > If I can make it crash without the alignments and this fixes the issue,
> > > > I'll apply both patches.
> > > 
> > > After applying David's patch, I do indeed get a crash. I'll now apply
> > > yours and see if it fixes the issue.
> > 
> > Your patch doesn't seem to fix it either. I'll investigate this further.
> 
> I think David's patch missed kernel/trace/trace_export.c
> 
> struct ftrace_event_call __used                                         \
> __attribute__((__aligned__(4)))                                         \
> __attribute__((section("_ftrace_events"))) event_##call = {             \
> 
> and kernel/trace/trace.h:
> 
> #define FTRACE_ENTRY(call, struct_name, id, tstruct, print)             \
>         extern struct ftrace_event_call                                 \
>         __attribute__((__aligned__(4))) event_##call;
> 
> does it help if you remove these ?

I doubt it, but I'll try it anyway.

-- Steve



--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

Index: linux-2.6-lttng/include/asm-generic/vmlinux.lds.h
===================================================================
--- linux-2.6-lttng.orig/include/asm-generic/vmlinux.lds.h
+++ linux-2.6-lttng/include/asm-generic/vmlinux.lds.h
@@ -107,7 +107,8 @@ 
 #endif
 
 #ifdef CONFIG_TRACE_BRANCH_PROFILING
-#define LIKELY_PROFILE()	VMLINUX_SYMBOL(__start_annotated_branch_profile) = .; \
+#define LIKELY_PROFILE()	STRUCT_ALIGN();					      \
+				VMLINUX_SYMBOL(__start_annotated_branch_profile) = .; \
 				*(_ftrace_annotated_branch)			      \
 				VMLINUX_SYMBOL(__stop_annotated_branch_profile) = .;
 #else
@@ -115,7 +116,8 @@ 
 #endif
 
 #ifdef CONFIG_PROFILE_ALL_BRANCHES
-#define BRANCH_PROFILE()	VMLINUX_SYMBOL(__start_branch_profile) = .;   \
+#define BRANCH_PROFILE()	STRUCT_ALIGN();				      \
+				VMLINUX_SYMBOL(__start_branch_profile) = .;   \
 				*(_ftrace_branch)			      \
 				VMLINUX_SYMBOL(__stop_branch_profile) = .;
 #else
@@ -123,7 +125,8 @@ 
 #endif
 
 #ifdef CONFIG_EVENT_TRACING
-#define FTRACE_EVENTS()	VMLINUX_SYMBOL(__start_ftrace_events) = .;	\
+#define FTRACE_EVENTS()	STRUCT_ALIGN();					\
+			VMLINUX_SYMBOL(__start_ftrace_events) = .;	\
 			*(_ftrace_events)				\
 			VMLINUX_SYMBOL(__stop_ftrace_events) = .;
 #else
@@ -131,7 +134,8 @@ 
 #endif
 
 #ifdef CONFIG_TRACING
-#define TRACE_PRINTKS() VMLINUX_SYMBOL(__start___trace_bprintk_fmt) = .;      \
+#define TRACE_PRINTKS()  . = ALIGN(8);					       \
+			 VMLINUX_SYMBOL(__start___trace_bprintk_fmt) = .;      \
 			 *(__trace_printk_fmt) /* Trace_printk fmt' pointer */ \
 			 VMLINUX_SYMBOL(__stop___trace_bprintk_fmt) = .;
 #else
@@ -139,7 +143,8 @@ 
 #endif
 
 #ifdef CONFIG_FTRACE_SYSCALLS
-#define TRACE_SYSCALLS() VMLINUX_SYMBOL(__start_syscalls_metadata) = .;	\
+#define TRACE_SYSCALLS() STRUCT_ALIGN();				\
+			 VMLINUX_SYMBOL(__start_syscalls_metadata) = .;	\
 			 *(__syscalls_metadata)				\
 			 VMLINUX_SYMBOL(__stop_syscalls_metadata) = .;
 #else
@@ -169,11 +174,7 @@ 
 	LIKELY_PROFILE()		       				\
 	BRANCH_PROFILE()						\
 	TRACE_PRINTKS()							\
-									\
-	STRUCT_ALIGN();							\
 	FTRACE_EVENTS()							\
-									\
-	STRUCT_ALIGN();							\
 	TRACE_SYSCALLS()
 
 /*