linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: Change the layout of structure trace_event_raw_fib_table_lookup
@ 2018-08-13  2:26 Zong Li
  2018-08-13 14:40 ` David Ahern
  2018-08-13 16:37 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Zong Li @ 2018-08-13  2:26 UTC (permalink / raw)
  To: rostedt, mingo, dsahern, netdev, linux-kernel; +Cc: zongbox, greentime, Zong Li

There is an unalignment access about the structure
'trace_event_raw_fib_table_lookup'.

In include/trace/events/fib.h, there is a memory operation which casting
the 'src' data member to a pointer, and then store a value to this
pointer point to.

p32 = (__be32 *) __entry->src;
*p32 = flp->saddr;

The offset of 'src' in structure trace_event_raw_fib_table_lookup is not
four bytes alignment. On some architectures, they don't permit the
unalignment access, it need to pay the price to handle this situation in
exception handler.

Adjust the layout of structure to avoid this case.

Signed-off-by: Zong Li <zong@andestech.com>
---
 include/trace/events/fib.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/trace/events/fib.h b/include/trace/events/fib.h
index 9763cddd0594..6271bab63bfb 100644
--- a/include/trace/events/fib.h
+++ b/include/trace/events/fib.h
@@ -22,6 +22,7 @@ TRACE_EVENT(fib_table_lookup,
 		__field(	int,	err		)
 		__field(	int,	oif		)
 		__field(	int,	iif		)
+		__field(	u8,	proto		)
 		__field(	__u8,	tos		)
 		__field(	__u8,	scope		)
 		__field(	__u8,	flags		)
@@ -31,7 +32,6 @@ TRACE_EVENT(fib_table_lookup,
 		__array(	__u8,	saddr,	4	)
 		__field(	u16,	sport		)
 		__field(	u16,	dport		)
-		__field(	u8,	proto		)
 		__dynamic_array(char,  name,   IFNAMSIZ )
 	),
 
-- 
2.16.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: Change the layout of structure trace_event_raw_fib_table_lookup
  2018-08-13  2:26 [PATCH] net: Change the layout of structure trace_event_raw_fib_table_lookup Zong Li
@ 2018-08-13 14:40 ` David Ahern
  2018-08-14  1:13   ` Zong Li
  2018-08-13 16:37 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: David Ahern @ 2018-08-13 14:40 UTC (permalink / raw)
  To: Zong Li, rostedt, mingo, netdev, linux-kernel; +Cc: zongbox, greentime

On 8/12/18 8:26 PM, Zong Li wrote:
> There is an unalignment access about the structure
> 'trace_event_raw_fib_table_lookup'.
> 
> In include/trace/events/fib.h, there is a memory operation which casting
> the 'src' data member to a pointer, and then store a value to this
> pointer point to.
> 
> p32 = (__be32 *) __entry->src;
> *p32 = flp->saddr;
> 
> The offset of 'src' in structure trace_event_raw_fib_table_lookup is not
> four bytes alignment. On some architectures, they don't permit the
> unalignment access, it need to pay the price to handle this situation in
> exception handler.
> 
> Adjust the layout of structure to avoid this case.
> 
> Signed-off-by: Zong Li <zong@andestech.com>
> ---
>  include/trace/events/fib.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Fixes: 9f323973c915 ("net/ipv4: Udate fib_table_lookup tracepoint")
Acked-by: David Ahern <dsahern@gmail.com>

Do you also need a similar change to fib6_table_lookup in
include/trace/events/fib6.h?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: Change the layout of structure trace_event_raw_fib_table_lookup
  2018-08-13  2:26 [PATCH] net: Change the layout of structure trace_event_raw_fib_table_lookup Zong Li
  2018-08-13 14:40 ` David Ahern
@ 2018-08-13 16:37 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2018-08-13 16:37 UTC (permalink / raw)
  To: zong; +Cc: rostedt, mingo, dsahern, netdev, linux-kernel, zongbox, greentime

From: Zong Li <zong@andestech.com>
Date: Mon, 13 Aug 2018 10:26:52 +0800

> There is an unalignment access about the structure
> 'trace_event_raw_fib_table_lookup'.
> 
> In include/trace/events/fib.h, there is a memory operation which casting
> the 'src' data member to a pointer, and then store a value to this
> pointer point to.
> 
> p32 = (__be32 *) __entry->src;
> *p32 = flp->saddr;
> 
> The offset of 'src' in structure trace_event_raw_fib_table_lookup is not
> four bytes alignment. On some architectures, they don't permit the
> unalignment access, it need to pay the price to handle this situation in
> exception handler.
> 
> Adjust the layout of structure to avoid this case.
> 
> Signed-off-by: Zong Li <zong@andestech.com>

Applied, with Fixes tag from David added.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: Change the layout of structure trace_event_raw_fib_table_lookup
  2018-08-13 14:40 ` David Ahern
@ 2018-08-14  1:13   ` Zong Li
  0 siblings, 0 replies; 4+ messages in thread
From: Zong Li @ 2018-08-14  1:13 UTC (permalink / raw)
  To: David Ahern
  Cc: Zong Li, Steven Rostedt, mingo, netdev,
	Linux Kernel Mailing List, greentime

David Ahern <dsahern@gmail.com> 於 2018年8月13日 週一 下午10:40寫道:
>
> On 8/12/18 8:26 PM, Zong Li wrote:
> > There is an unalignment access about the structure
> > 'trace_event_raw_fib_table_lookup'.
> >
> > In include/trace/events/fib.h, there is a memory operation which casting
> > the 'src' data member to a pointer, and then store a value to this
> > pointer point to.
> >
> > p32 = (__be32 *) __entry->src;
> > *p32 = flp->saddr;
> >
> > The offset of 'src' in structure trace_event_raw_fib_table_lookup is not
> > four bytes alignment. On some architectures, they don't permit the
> > unalignment access, it need to pay the price to handle this situation in
> > exception handler.
> >
> > Adjust the layout of structure to avoid this case.
> >
> > Signed-off-by: Zong Li <zong@andestech.com>
> > ---
> >  include/trace/events/fib.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
>
> Fixes: 9f323973c915 ("net/ipv4: Udate fib_table_lookup tracepoint")
> Acked-by: David Ahern <dsahern@gmail.com>
>
> Do you also need a similar change to fib6_table_lookup in
> include/trace/events/fib6.h?

Hi David,

Though I don't encounter difficulties on it for now, but I think it
has the same situation,
How do you think that also change the layout in include/trace/events/fib6.h?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-08-14  1:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-13  2:26 [PATCH] net: Change the layout of structure trace_event_raw_fib_table_lookup Zong Li
2018-08-13 14:40 ` David Ahern
2018-08-14  1:13   ` Zong Li
2018-08-13 16:37 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).