* [PATCH] networking: enhance NAPI tracing
@ 2013-04-15 9:16 Vladimir Kondratiev
0 siblings, 0 replies; only message in thread
From: Vladimir Kondratiev @ 2013-04-15 9:16 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
Hi,
I faced with lack of tracing when debugging NAPI,
patch below adds missing bits.
There are warnings from checkpatch, because of commonly used style
for the traces.
>From 12f3171f1346a2b89121f941208111711fab1097 Mon Sep 17 00:00:00 2001
From: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Date: Mon, 15 Apr 2013 12:00:08 +0300
Subject: [PATCH] networking: enhance NAPI tracing
NAPI cycle includes napi_schedule(), poll() and napi_complete() functions.
Add trace for napi_schedule()/napi_complete() - for internal functions with '__',
when actual actions performed.
For poll(), add printing of 'weight' and 'work'
Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
---
include/trace/events/napi.h | 39 +++++++++++++++++++++++++++++++++++++--
net/core/dev.c | 4 +++-
net/core/netpoll.c | 2 +-
3 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/include/trace/events/napi.h b/include/trace/events/napi.h
index 8fe1e93..26fdb75 100644
--- a/include/trace/events/napi.h
+++ b/include/trace/events/napi.h
@@ -12,6 +12,31 @@
TRACE_EVENT(napi_poll,
+ TP_PROTO(struct napi_struct *napi, int weight, int work),
+
+ TP_ARGS(napi, weight, work),
+
+ TP_STRUCT__entry(
+ __field( struct napi_struct *, napi)
+ __string( dev_name, napi->dev ? napi->dev->name : NO_DEV)
+ __field( int, weight)
+ __field( int, work)
+ ),
+
+ TP_fast_assign(
+ __entry->napi = napi;
+ __assign_str(dev_name, napi->dev ? napi->dev->name : NO_DEV);
+ __entry->weight = weight;
+ __entry->work = work;
+ ),
+
+ TP_printk("napi poll on napi struct %p for device %s"
+ " weight %d work %d",
+ __entry->napi, __get_str(dev_name), __entry->weight,
+ __entry->work)
+);
+
+DECLARE_EVENT_CLASS(napi_state,
TP_PROTO(struct napi_struct *napi),
TP_ARGS(napi),
@@ -26,8 +51,18 @@ TRACE_EVENT(napi_poll,
__assign_str(dev_name, napi->dev ? napi->dev->name : NO_DEV);
),
- TP_printk("napi poll on napi struct %p for device %s",
- __entry->napi, __get_str(dev_name))
+ TP_printk("napi struct %p for device %s",
+ __entry->napi, __get_str(dev_name))
+);
+
+DEFINE_EVENT(napi_state, napi_schedule,
+ TP_PROTO(struct napi_struct *napi),
+ TP_ARGS(napi)
+);
+
+DEFINE_EVENT(napi_state, napi_complete,
+ TP_PROTO(struct napi_struct *napi),
+ TP_ARGS(napi)
);
#undef NO_DEV
diff --git a/net/core/dev.c b/net/core/dev.c
index e7d68ed..2537253 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4023,6 +4023,7 @@ void __napi_schedule(struct napi_struct *n)
local_irq_save(flags);
____napi_schedule(&__get_cpu_var(softnet_data), n);
local_irq_restore(flags);
+ trace_napi_schedule(n);
}
EXPORT_SYMBOL(__napi_schedule);
@@ -4034,6 +4035,7 @@ void __napi_complete(struct napi_struct *n)
list_del(&n->poll_list);
smp_mb__before_clear_bit();
clear_bit(NAPI_STATE_SCHED, &n->state);
+ trace_napi_complete(n);
}
EXPORT_SYMBOL(__napi_complete);
@@ -4134,7 +4136,7 @@ static void net_rx_action(struct softirq_action *h)
work = 0;
if (test_bit(NAPI_STATE_SCHED, &n->state)) {
work = n->poll(n, weight);
- trace_napi_poll(n);
+ trace_napi_poll(n, weight, work);
}
WARN_ON_ONCE(work > weight);
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index fa32899..75f8c32 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -160,7 +160,7 @@ static int poll_one_napi(struct netpoll_info *npinfo,
set_bit(NAPI_STATE_NPSVC, &napi->state);
work = napi->poll(napi, budget);
- trace_napi_poll(napi);
+ trace_napi_poll(napi, budget, work);
clear_bit(NAPI_STATE_NPSVC, &napi->state);
atomic_dec(&trapped);
--
1.7.10.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-04-15 9:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-15 9:16 [PATCH] networking: enhance NAPI tracing Vladimir Kondratiev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox