trace event skb fix unassigned field
Quoted 13 lines · On Tue, Jan 04, 2011 at 06:46:06PM -0500, [email protected] wrote:
Acked- by: Neil Horman <[email protected]>
Sent from my Verizon Wireless Phone
----- Reply message -----
From: "Mathieu Desnoyers" <[email protected]>
Date: Tue, Jan 4, 2011 6:16 pm
Subject: [RFC patch 2/5] trace event skb fix unassigned field
To: "LKML" <[email protected]>
Cc: "Mathieu Desnoyers" <[email protected]>, "Steven Rostedt" <[email protected]>, "Frederic Weisbecker" <[email protected]>, "Ingo Molnar" <[email protected]>, "Neil Horman" <[email protected]>, "Thomas Gleixner" <[email protected]>
Quoted 3 lines
The field "protocol" in event
kfree_skbis left unassigned if skb is NULL, leaving its trace output as garbage. Assign the value to 0 when skb is NULL instead.
Hm, if the skb is already null, we probably shouldn't send any trace.
What about using TP_CONDITION() ?
Quoted 28 lines
Signed-off-by Mathieu Desnoyers <[email protected]>CC Steven Rostedt <[email protected]>CC Frederic Weisbecker <[email protected]>CC Ingo Molnar <[email protected]>CC Neil Horman <[email protected]>CC Thomas Gleixner <[email protected]>--- include/trace/events/skb.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)Index:
linux-2.6-lttng/include/trace/events/skb.h
===================================================================include/trace/events/skb.h +1
-3@@ -25,9 +25,7 @@ TRACE_EVENT(kfree_skb,TP_fast_assign ( __entry->skbaddr = skb; -if (skb) { - __entry->protocol =ntohs (skb->protocol); - } + __entry->protocol = skb ?ntohs (skb->protocol) :0 ; __entry->location = location; ),
Mathieu Desnoyers
reviewerQuoted 14 lines · * Frederic Weisbecker ([email protected]) wrote:
Quoted 13 lines · On Tue, Jan 04, 2011 at 06:46:06PM -0500, [email protected] wrote:
Acked- by: Neil Horman <[email protected]>
Sent from my Verizon Wireless Phone
----- Reply message -----
From: "Mathieu Desnoyers" <[email protected]>
Date: Tue, Jan 4, 2011 6:16 pm
Subject: [RFC patch 2/5] trace event skb fix unassigned field
To: "LKML" <[email protected]>
Cc: "Mathieu Desnoyers" <[email protected]>, "Steven Rostedt" <[email protected]>, "Frederic Weisbecker" <[email protected]>, "Ingo Molnar" <[email protected]>, "Neil Horman" <[email protected]>, "Thomas Gleixner" <[email protected]>
Quoted 7 lines
Quoted 3 lines
The field "protocol" in event
kfree_skbis left unassigned if skb is NULL, leaving its trace output as garbage. Assign the value to 0 when skb is NULL instead.Hm, if the skb is already null, we probably shouldn't send any trace.
What about using
TP_CONDITION()?
Hrm, let's see. It's been introduced by commit5cb3d1d9d34ac04bcaa2034139345b2a5fea54c1
by Zhaolei.
Event at the time of that commit, the only caller looked like:
void kfree_skb(struct sk_buff *skb)
{
if (unlikely(!skb))
return;
if (likely(atomic_read(&skb->users) == 1))
smp_rmb();
else if (likely(!atomic_dec_and_test(&skb->users)))
return;
trace_kfree_skb(skb, __builtin_return_address(0));
__kfree_skb(skb);
}EXPORT_SYMBOL(kfree_skb);
So it already checks for a null pointer before calling the tracepoint. This leads me to wonder why why this check was added in the first place ?
Mathieu
Quoted 29 lines
Quoted 29 lines
Signed-off-by Mathieu Desnoyers <[email protected]>CC Steven Rostedt <[email protected]>CC Frederic Weisbecker <[email protected]>CC Ingo Molnar <[email protected]>CC Neil Horman <[email protected]>CC Thomas Gleixner <[email protected]>--- include/trace/events/skb.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)Index:
linux-2.6-lttng/include/trace/events/skb.h
===================================================================include/trace/events/skb.h +1
-3@@ -25,9 +25,7 @@ TRACE_EVENT(kfree_skb,TP_fast_assign ( __entry->skbaddr = skb; -if (skb) { - __entry->protocol =ntohs (skb->protocol); - } + __entry->protocol = skb ?ntohs (skb->protocol) :0 ; __entry->location = location; ),
Signature · 4 lines
Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com
Quoted 40 lines · Mathieu Desnoyers
Quoted 14 lines · * Frederic Weisbecker ([email protected]) wrote:
Quoted 13 lines · On Tue, Jan 04, 2011 at 06:46:06PM -0500, [email protected] wrote:
Acked- by: Neil Horman <[email protected]>
Sent from my Verizon Wireless Phone
----- Reply message -----
From: "Mathieu Desnoyers" <[email protected]>
Date: Tue, Jan 4, 2011 6:16 pm
Subject: [RFC patch 2/5] trace event skb fix unassigned field
To: "LKML" <[email protected]>
Cc: "Mathieu Desnoyers" <[email protected]>, "Steven Rostedt" <[email protected]>, "Frederic Weisbecker" <[email protected]>, "Ingo Molnar" <[email protected]>, "Neil Horman" <[email protected]>, "Thomas Gleixner" <[email protected]>Quoted 7 lines
Quoted 3 lines
The field "protocol" in event
kfree_skbis left unassigned if skb is NULL, leaving its trace output as garbage. Assign the value to 0 when skb is NULL instead.Hm, if the skb is already null, we probably shouldn't send any trace.
What about using
TP_CONDITION()?Hrm, let's see. It's been introduced by commit
5cb3d1d9d34ac04bcaa2034139345b2a5fea54c1
by Zhaolei.Event at the time of that commit, the only caller looked like:
void
kfree_skb(struct sk_buff *skb){ if (unlikely(!skb)) return; if (likely(atomic_read(&skb->users) == 1)) smp_rmb(); else if (likely(!atomic_dec_and_test(&skb->users))) return; trace_kfree_skb(skb, __builtin_return_address(0)); __kfree_skb(skb); }
Quoted 4 lines
EXPORT_SYMBOL(kfree_skb);So it already checks for a null pointer before calling the tracepoint. This leads me to wonder why why this check was added in the first place ?
Likely for no strong reasons :)
So I guess we can remove the check from the tracepoint?
Mathieu Desnoyers
reviewerQuoted 43 lines · * Frederic Weisbecker ([email protected]) wrote:
Quoted 42 lines · Mathieu Desnoyers
Quoted 14 lines · * Frederic Weisbecker ([email protected]) wrote:
Quoted 13 lines · On Tue, Jan 04, 2011 at 06:46:06PM -0500, [email protected] wrote:
Acked- by: Neil Horman <[email protected]>
Sent from my Verizon Wireless Phone
----- Reply message -----
From: "Mathieu Desnoyers" <[email protected]>
Date: Tue, Jan 4, 2011 6:16 pm
Subject: [RFC patch 2/5] trace event skb fix unassigned field
To: "LKML" <[email protected]>
Cc: "Mathieu Desnoyers" <[email protected]>, "Steven Rostedt" <[email protected]>, "Frederic Weisbecker" <[email protected]>, "Ingo Molnar" <[email protected]>, "Neil Horman" <[email protected]>, "Thomas Gleixner" <[email protected]>Quoted 7 lines
Quoted 3 lines
The field "protocol" in event
kfree_skbis left unassigned if skb is NULL, leaving its trace output as garbage. Assign the value to 0 when skb is NULL instead.Hm, if the skb is already null, we probably shouldn't send any trace.
What about using
TP_CONDITION()?Hrm, let's see. It's been introduced by commit
5cb3d1d9d34ac04bcaa2034139345b2a5fea54c1
by Zhaolei.Event at the time of that commit, the only caller looked like:
void
kfree_skb(struct sk_buff *skb){ if (unlikely(!skb)) return; if (likely(atomic_read(&skb->users) == 1)) smp_rmb(); else if (likely(!atomic_dec_and_test(&skb->users))) return; trace_kfree_skb(skb, __builtin_return_address(0)); __kfree_skb(skb); }
EXPORT_SYMBOL(kfree_skb);
Quoted 6 lines
Quoted 2 lines
So it already checks for a null pointer before calling the tracepoint. This leads me to wonder why why this check was added in the first place ?
Likely for no strong reasons :)
So I guess we can remove the check from the tracepoint?
Yep, leading to this patch instead:
trace event skb remove duplicate null-pointer check
The check for NULL skb in the kfree_skb trace event is a duplicate from the check already done in its only caller, kfree_skb(). Remove this duplicate check.
--- include/trace/events/skb.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
include/trace/events/skb.h +1 -3
@@ -25,9 +25,7 @@ TRACE_EVENT(kfree_skb,TP_fast_assign ( __entry->skbaddr = skb; -if (skb) { - __entry->protocol =ntohs (skb->protocol); - } + __entry->protocol =ntohs (skb->protocol); __entry->location = location; ),
Signature · 4 lines
Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com
Neil Horman
Acked-byQuoted 75 lines · Mathieu Desnoyers
Quoted 43 lines · * Frederic Weisbecker ([email protected]) wrote:
Quoted 42 lines · Mathieu Desnoyers
Quoted 14 lines · * Frederic Weisbecker ([email protected]) wrote:
Quoted 13 lines · On Tue, Jan 04, 2011 at 06:46:06PM -0500, [email protected] wrote:
Acked- by: Neil Horman <[email protected]>
Sent from my Verizon Wireless Phone
----- Reply message -----
From: "Mathieu Desnoyers" <[email protected]>
Date: Tue, Jan 4, 2011 6:16 pm
Subject: [RFC patch 2/5] trace event skb fix unassigned field
To: "LKML" <[email protected]>
Cc: "Mathieu Desnoyers" <[email protected]>, "Steven Rostedt" <[email protected]>, "Frederic Weisbecker" <[email protected]>, "Ingo Molnar" <[email protected]>, "Neil Horman" <[email protected]>, "Thomas Gleixner" <[email protected]>Quoted 7 lines
Quoted 3 lines
The field "protocol" in event
kfree_skbis left unassigned if skb is NULL, leaving its trace output as garbage. Assign the value to 0 when skb is NULL instead.Hm, if the skb is already null, we probably shouldn't send any trace.
What about using
TP_CONDITION()?Hrm, let's see. It's been introduced by commit
5cb3d1d9d34ac04bcaa2034139345b2a5fea54c1
by Zhaolei.Event at the time of that commit, the only caller looked like:
void
kfree_skb(struct sk_buff *skb){ if (unlikely(!skb)) return; if (likely(atomic_read(&skb->users) == 1)) smp_rmb(); else if (likely(!atomic_dec_and_test(&skb->users))) return; trace_kfree_skb(skb, __builtin_return_address(0)); __kfree_skb(skb); }
EXPORT_SYMBOL(kfree_skb);Quoted 6 lines
Quoted 2 lines
So it already checks for a null pointer before calling the tracepoint. This leads me to wonder why why this check was added in the first place ?
Likely for no strong reasons :)
So I guess we can remove the check from the tracepoint?
Yep, leading to this patch instead:
trace event skb remove duplicate null-pointer check
The check for NULL skb in the
kfree_skbtrace event is a duplicate from the check already done in its only caller,kfree_skb(). Remove this duplicate check.Signed-off-by Mathieu Desnoyers <[email protected]>CC Steven Rostedt <[email protected]>CC Frederic Weisbecker <[email protected]>CC Ingo Molnar <[email protected]>CC Thomas Gleixner <[email protected]>CC Neil Horman <[email protected]>--- include/trace/events/skb.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)Index:
linux-2.6-lttng/include/trace/events/skb.h
===================================================================
include/trace/events/skb.h TRACE_EVENT(kfree_skb, · line 31
Quoted 10 lines
include/trace/events/skb.h +1
-3@@ -25,9 +25,7 @@ TRACE_EVENT(kfree_skb,TP_fast_assign ( __entry->skbaddr = skb; -if (skb) { - __entry->protocol =ntohs (skb->protocol); - } + __entry->protocol =ntohs (skb->protocol); __entry->location = location; ),
Quoted 6 lines
Signature · 4 lines
Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com
Mathieu Desnoyers
reviewer* Neil Horman ([email protected]) wrote:
[...]
Quoted 21 lines
Quoted 21 lines
trace event skb remove duplicate null-pointer check
The check for NULL skb in the
kfree_skbtrace event is a duplicate from the check already done in its only caller,kfree_skb(). Remove this duplicate check.Signed-off-by Mathieu Desnoyers <[email protected]>CC Steven Rostedt <[email protected]>CC Frederic Weisbecker <[email protected]>CC Ingo Molnar <[email protected]>CC Thomas Gleixner <[email protected]>CC Neil Horman <[email protected]>--- include/trace/events/skb.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)Index:
linux-2.6-lttng/include/trace/events/skb.h
===================================================================include/trace/events/skb.h +0
-0@@ -25,9 +25,7 @@ TRACE_EVENT(kfree_skb,
Quoted 12 lines
include/trace/events/skb.h TRACE_EVENT(kfree_skb, · line 31
Quoted 11 lines
include/trace/events/skb.h +1
-3TP_fast_assign ( __entry->skbaddr = skb; -if (skb) { - __entry->protocol =ntohs (skb->protocol); - } + __entry->protocol =ntohs (skb->protocol); __entry->location = location; ),Acked-by Neil Horman <[email protected]>
Thanks!
Mathieu
Quoted 7 lines
Quoted 7 lines
Signature · 5 lines
-- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com
Signature · 4 lines
Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com
Steven Rostedt
maintainerQuoted 9 lines · Neil Horman
Quoted 7 lines
Yep, leading to this patch instead:
trace event skb remove duplicate null-pointer check
The check for NULL skb in the
kfree_skbtrace event is a duplicate from the check already done in its only caller,kfree_skb(). Remove this duplicate check.Acked-by Neil Horman <[email protected]>
Mathieu, can you repost this as a non-RFC patch, and include Neil's acked-by.
Thanks,
-- Steve