edb46ef683
[ Upstream commit 51270d573a8d9dd5afdc7934de97d66c0e14b5fd ] I'm updating __assign_str() and will be removing the second parameter. To make sure that it does not break anything, I make sure that it matches the __string() field, as that is where the string is actually going to be saved in. To make sure there's nothing that breaks, I added a WARN_ON() to make sure that what was used in __string() is the same that is used in __assign_str(). In doing this change, an error was triggered as __assign_str() now expects the string passed in to be a char * value. I instead had the following warning: include/trace/events/qdisc.h: In function ‘trace_event_raw_event_qdisc_reset’: include/trace/events/qdisc.h:91:35: error: passing argument 1 of 'strcmp' from incompatible pointer type [-Werror=incompatible-pointer-types] 91 | __assign_str(dev, qdisc_dev(q)); That's because the qdisc_enqueue() and qdisc_reset() pass in qdisc_dev(q) to __assign_str() and to __string(). But that function returns a pointer to struct net_device and not a string. It appears that these events are just saving the pointer as a string and then reading it as a string as well. Use qdisc_dev(q)->name to save the device instead. Fixes: a34dac0b90552 ("net_sched: add tracepoints for qdisc_reset() and qdisc_destroy()") Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
125 lines
3.1 KiB
C
Executable file
125 lines
3.1 KiB
C
Executable file
#undef TRACE_SYSTEM
|
|
#define TRACE_SYSTEM qdisc
|
|
|
|
#if !defined(_TRACE_QDISC_H) || defined(TRACE_HEADER_MULTI_READ)
|
|
#define _TRACE_QDISC_H
|
|
|
|
#include <linux/skbuff.h>
|
|
#include <linux/netdevice.h>
|
|
#include <linux/tracepoint.h>
|
|
#include <linux/ftrace.h>
|
|
#include <linux/pkt_sched.h>
|
|
#include <net/sch_generic.h>
|
|
|
|
TRACE_EVENT(qdisc_dequeue,
|
|
|
|
TP_PROTO(struct Qdisc *qdisc, const struct netdev_queue *txq,
|
|
int packets, struct sk_buff *skb),
|
|
|
|
TP_ARGS(qdisc, txq, packets, skb),
|
|
|
|
TP_STRUCT__entry(
|
|
__field( struct Qdisc *, qdisc )
|
|
__field(const struct netdev_queue *, txq )
|
|
__field( int, packets )
|
|
__field( void *, skbaddr )
|
|
__field( int, ifindex )
|
|
__field( u32, handle )
|
|
__field( u32, parent )
|
|
__field( unsigned long, txq_state)
|
|
),
|
|
|
|
/* skb==NULL indicate packets dequeued was 0, even when packets==1 */
|
|
TP_fast_assign(
|
|
__entry->qdisc = qdisc;
|
|
__entry->txq = txq;
|
|
__entry->packets = skb ? packets : 0;
|
|
__entry->skbaddr = skb;
|
|
__entry->ifindex = txq->dev ? txq->dev->ifindex : 0;
|
|
__entry->handle = qdisc->handle;
|
|
__entry->parent = qdisc->parent;
|
|
__entry->txq_state = txq->state;
|
|
),
|
|
|
|
TP_printk("dequeue ifindex=%d qdisc handle=0x%X parent=0x%X txq_state=0x%lX packets=%d skbaddr=%p",
|
|
__entry->ifindex, __entry->handle, __entry->parent,
|
|
__entry->txq_state, __entry->packets, __entry->skbaddr )
|
|
);
|
|
|
|
TRACE_EVENT(qdisc_reset,
|
|
|
|
TP_PROTO(struct Qdisc *q),
|
|
|
|
TP_ARGS(q),
|
|
|
|
TP_STRUCT__entry(
|
|
__string( dev, qdisc_dev(q)->name )
|
|
__string( kind, q->ops->id )
|
|
__field( u32, parent )
|
|
__field( u32, handle )
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__assign_str(dev, qdisc_dev(q)->name);
|
|
__assign_str(kind, q->ops->id);
|
|
__entry->parent = q->parent;
|
|
__entry->handle = q->handle;
|
|
),
|
|
|
|
TP_printk("dev=%s kind=%s parent=%x:%x handle=%x:%x", __get_str(dev),
|
|
__get_str(kind), TC_H_MAJ(__entry->parent) >> 16, TC_H_MIN(__entry->parent),
|
|
TC_H_MAJ(__entry->handle) >> 16, TC_H_MIN(__entry->handle))
|
|
);
|
|
|
|
TRACE_EVENT(qdisc_destroy,
|
|
|
|
TP_PROTO(struct Qdisc *q),
|
|
|
|
TP_ARGS(q),
|
|
|
|
TP_STRUCT__entry(
|
|
__string( dev, qdisc_dev(q)->name )
|
|
__string( kind, q->ops->id )
|
|
__field( u32, parent )
|
|
__field( u32, handle )
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__assign_str(dev, qdisc_dev(q)->name);
|
|
__assign_str(kind, q->ops->id);
|
|
__entry->parent = q->parent;
|
|
__entry->handle = q->handle;
|
|
),
|
|
|
|
TP_printk("dev=%s kind=%s parent=%x:%x handle=%x:%x", __get_str(dev),
|
|
__get_str(kind), TC_H_MAJ(__entry->parent) >> 16, TC_H_MIN(__entry->parent),
|
|
TC_H_MAJ(__entry->handle) >> 16, TC_H_MIN(__entry->handle))
|
|
);
|
|
|
|
TRACE_EVENT(qdisc_create,
|
|
|
|
TP_PROTO(const struct Qdisc_ops *ops, struct net_device *dev, u32 parent),
|
|
|
|
TP_ARGS(ops, dev, parent),
|
|
|
|
TP_STRUCT__entry(
|
|
__string( dev, dev->name )
|
|
__string( kind, ops->id )
|
|
__field( u32, parent )
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__assign_str(dev, dev->name);
|
|
__assign_str(kind, ops->id);
|
|
__entry->parent = parent;
|
|
),
|
|
|
|
TP_printk("dev=%s kind=%s parent=%x:%x",
|
|
__get_str(dev), __get_str(kind),
|
|
TC_H_MAJ(__entry->parent) >> 16, TC_H_MIN(__entry->parent))
|
|
);
|
|
|
|
#endif /* _TRACE_QDISC_H */
|
|
|
|
/* This part must be outside protection */
|
|
#include <trace/define_trace.h>
|