[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 27 Aug 2015 22:27:38 -0700
From: David Ahern <dsa@...ulusnetworks.com>
To: David Miller <davem@...emloft.net>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH net-next] net: FIB tracepoints
On 8/27/15 10:16 PM, David Miller wrote:
> From: David Ahern <dsa@...ulusnetworks.com>
> Date: Thu, 27 Aug 2015 22:07:30 -0700
>
>> On 8/27/15 10:05 PM, David Miller wrote:
>>> From: David Ahern <dsa@...ulusnetworks.com>
>>> Date: Thu, 27 Aug 2015 21:59:32 -0700
>>>
>>>> + __array( __u8, src, 4 )
>>>> + __array( __u8, dst, 4 )
>>> ...
>>>> + __array( __u8, src, 4 )
>>>
>>> Maybe there is something I don't understand about tracing, but why not
>>> use __u32? If endianness types are the issue, just force cast it as
>>> needed.
>>>
>>> Using a memcpy() on a 4-byte array is kinda excessive.
>>>
>>
>> Silly trick need to use %pI4. ie., printing the addresses as strings
>> vs. hex.
>
> %pI4 doesn't care what kind of pointer you give it, &__entry->src will
> work just fine if you used __u32.
>
$ git diff
diff --git a/include/trace/events/fib.h b/include/trace/events/fib.h
index 1fd7cfeb36ff..07687b93a4f0 100644
--- a/include/trace/events/fib.h
+++ b/include/trace/events/fib.h
@@ -22,7 +22,7 @@ TRACE_EVENT(fib_table_lookup,
__field( __u8, tos )
__field( __u8, scope )
__field( __u8, flags )
- __array( __u8, src, 4 )
+ __field( __u32, src )
__array( __u8, dst, 4 )
),
@@ -33,13 +33,13 @@ TRACE_EVENT(fib_table_lookup,
__entry->tos = flp->flowi4_tos;
__entry->scope = flp->flowi4_scope;
__entry->flags = flp->flowi4_flags;
- memcpy(&__entry->src, &flp->saddr, 4);
+ __entry->src = flp->saddr;
memcpy(&__entry->dst, &flp->daddr, 4);
),
TP_printk("table %d oif %d iif %d src %pI4 dst %pI4 tos %d
scope %d flags %x",
__entry->tb_id, __entry->oif, __entry->iif,
- __entry->src, __entry->dst, __entry->tos, __entry->scope,
+ &__entry->src, __entry->dst, __entry->tos, __entry->scope,
__entry->flags)
);
and compiles fine but run time:
$ perf record -e fib:* -a
Warning: [fib:fib_table_lookup] bad op token &
^C[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.089 MB perf.data (148 samples) ]
$ perf script
Warning: [fib:fib_table_lookup] bad op token &
...
swapper 0 [000] 49.533997: fib:fib_table_lookup:
[FAILED TO PARSE] tb_id=254 oif=0 iif=3 tos=0 scope=0 flags=0
src=16843096 dst=ARRA
...
ie., it does matter. src was declared a u32 and trying to pass &src to
the printk fails. Been down this road a lot.
David
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists