diff options
| -rw-r--r-- | include/trace/events/napi.h | 13 | ||||
| -rw-r--r-- | net/core/dev.c | 4 | ||||
| -rw-r--r-- | net/core/drop_monitor.c | 3 | ||||
| -rw-r--r-- | net/core/netpoll.c | 2 | ||||
| -rw-r--r-- | tools/perf/scripts/python/netdev-times.py | 11 |
5 files changed, 21 insertions, 12 deletions
diff --git a/include/trace/events/napi.h b/include/trace/events/napi.h index 8fe1e93f531d..118ed7767639 100644 --- a/include/trace/events/napi.h +++ b/include/trace/events/napi.h | |||
| @@ -12,22 +12,27 @@ | |||
| 12 | 12 | ||
| 13 | TRACE_EVENT(napi_poll, | 13 | TRACE_EVENT(napi_poll, |
| 14 | 14 | ||
| 15 | TP_PROTO(struct napi_struct *napi), | 15 | TP_PROTO(struct napi_struct *napi, int work, int budget), |
| 16 | 16 | ||
| 17 | TP_ARGS(napi), | 17 | TP_ARGS(napi, work, budget), |
| 18 | 18 | ||
| 19 | TP_STRUCT__entry( | 19 | TP_STRUCT__entry( |
| 20 | __field( struct napi_struct *, napi) | 20 | __field( struct napi_struct *, napi) |
| 21 | __field( int, work) | ||
| 22 | __field( int, budget) | ||
| 21 | __string( dev_name, napi->dev ? napi->dev->name : NO_DEV) | 23 | __string( dev_name, napi->dev ? napi->dev->name : NO_DEV) |
| 22 | ), | 24 | ), |
| 23 | 25 | ||
| 24 | TP_fast_assign( | 26 | TP_fast_assign( |
| 25 | __entry->napi = napi; | 27 | __entry->napi = napi; |
| 28 | __entry->work = work; | ||
| 29 | __entry->budget = budget; | ||
| 26 | __assign_str(dev_name, napi->dev ? napi->dev->name : NO_DEV); | 30 | __assign_str(dev_name, napi->dev ? napi->dev->name : NO_DEV); |
| 27 | ), | 31 | ), |
| 28 | 32 | ||
| 29 | TP_printk("napi poll on napi struct %p for device %s", | 33 | TP_printk("napi poll on napi struct %p for device %s work %d budget %d", |
| 30 | __entry->napi, __get_str(dev_name)) | 34 | __entry->napi, __get_str(dev_name), |
| 35 | __entry->work, __entry->budget) | ||
| 31 | ); | 36 | ); |
| 32 | 37 | ||
| 33 | #undef NO_DEV | 38 | #undef NO_DEV |
diff --git a/net/core/dev.c b/net/core/dev.c index b92d63bfde7a..7894e406c806 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -4972,7 +4972,7 @@ bool sk_busy_loop(struct sock *sk, int nonblock) | |||
| 4972 | 4972 | ||
| 4973 | if (test_bit(NAPI_STATE_SCHED, &napi->state)) { | 4973 | if (test_bit(NAPI_STATE_SCHED, &napi->state)) { |
| 4974 | rc = napi->poll(napi, BUSY_POLL_BUDGET); | 4974 | rc = napi->poll(napi, BUSY_POLL_BUDGET); |
| 4975 | trace_napi_poll(napi); | 4975 | trace_napi_poll(napi, rc, BUSY_POLL_BUDGET); |
| 4976 | if (rc == BUSY_POLL_BUDGET) { | 4976 | if (rc == BUSY_POLL_BUDGET) { |
| 4977 | napi_complete_done(napi, rc); | 4977 | napi_complete_done(napi, rc); |
| 4978 | napi_schedule(napi); | 4978 | napi_schedule(napi); |
| @@ -5128,7 +5128,7 @@ static int napi_poll(struct napi_struct *n, struct list_head *repoll) | |||
| 5128 | work = 0; | 5128 | work = 0; |
| 5129 | if (test_bit(NAPI_STATE_SCHED, &n->state)) { | 5129 | if (test_bit(NAPI_STATE_SCHED, &n->state)) { |
| 5130 | work = n->poll(n, weight); | 5130 | work = n->poll(n, weight); |
| 5131 | trace_napi_poll(n); | 5131 | trace_napi_poll(n, work, weight); |
| 5132 | } | 5132 | } |
| 5133 | 5133 | ||
| 5134 | WARN_ON_ONCE(work > weight); | 5134 | WARN_ON_ONCE(work > weight); |
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c index 252e155c837b..d6b3b579560d 100644 --- a/net/core/drop_monitor.c +++ b/net/core/drop_monitor.c | |||
| @@ -187,7 +187,8 @@ static void trace_kfree_skb_hit(void *ignore, struct sk_buff *skb, void *locatio | |||
| 187 | trace_drop_common(skb, location); | 187 | trace_drop_common(skb, location); |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | static void trace_napi_poll_hit(void *ignore, struct napi_struct *napi) | 190 | static void trace_napi_poll_hit(void *ignore, struct napi_struct *napi, |
| 191 | int work, int budget) | ||
| 191 | { | 192 | { |
| 192 | struct dm_hw_stat_delta *new_stat; | 193 | struct dm_hw_stat_delta *new_stat; |
| 193 | 194 | ||
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 94acfc89ad97..53599bd0c82d 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
| @@ -163,7 +163,7 @@ static void poll_one_napi(struct napi_struct *napi) | |||
| 163 | */ | 163 | */ |
| 164 | work = napi->poll(napi, 0); | 164 | work = napi->poll(napi, 0); |
| 165 | WARN_ONCE(work, "%pF exceeded budget in poll\n", napi->poll); | 165 | WARN_ONCE(work, "%pF exceeded budget in poll\n", napi->poll); |
| 166 | trace_napi_poll(napi); | 166 | trace_napi_poll(napi, work, 0); |
| 167 | 167 | ||
| 168 | clear_bit(NAPI_STATE_NPSVC, &napi->state); | 168 | clear_bit(NAPI_STATE_NPSVC, &napi->state); |
| 169 | } | 169 | } |
diff --git a/tools/perf/scripts/python/netdev-times.py b/tools/perf/scripts/python/netdev-times.py index 4d21ef2d601d..4c6f09ac7d12 100644 --- a/tools/perf/scripts/python/netdev-times.py +++ b/tools/perf/scripts/python/netdev-times.py | |||
| @@ -252,9 +252,10 @@ def irq__irq_handler_exit(name, context, cpu, sec, nsec, pid, comm, callchain, i | |||
| 252 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, irq, ret) | 252 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, irq, ret) |
| 253 | all_event_list.append(event_info) | 253 | all_event_list.append(event_info) |
| 254 | 254 | ||
| 255 | def napi__napi_poll(name, context, cpu, sec, nsec, pid, comm, callchain, napi, dev_name): | 255 | def napi__napi_poll(name, context, cpu, sec, nsec, pid, comm, callchain, napi, |
| 256 | dev_name, work=None, budget=None): | ||
| 256 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, | 257 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, |
| 257 | napi, dev_name) | 258 | napi, dev_name, work, budget) |
| 258 | all_event_list.append(event_info) | 259 | all_event_list.append(event_info) |
| 259 | 260 | ||
| 260 | def net__netif_receive_skb(name, context, cpu, sec, nsec, pid, comm, callchain, skbaddr, | 261 | def net__netif_receive_skb(name, context, cpu, sec, nsec, pid, comm, callchain, skbaddr, |
| @@ -354,11 +355,13 @@ def handle_irq_softirq_exit(event_info): | |||
| 354 | receive_hunk_list.append(rec_data) | 355 | receive_hunk_list.append(rec_data) |
| 355 | 356 | ||
| 356 | def handle_napi_poll(event_info): | 357 | def handle_napi_poll(event_info): |
| 357 | (name, context, cpu, time, pid, comm, napi, dev_name) = event_info | 358 | (name, context, cpu, time, pid, comm, napi, dev_name, |
| 359 | work, budget) = event_info | ||
| 358 | if cpu in net_rx_dic.keys(): | 360 | if cpu in net_rx_dic.keys(): |
| 359 | event_list = net_rx_dic[cpu]['event_list'] | 361 | event_list = net_rx_dic[cpu]['event_list'] |
| 360 | rec_data = {'event_name':'napi_poll', | 362 | rec_data = {'event_name':'napi_poll', |
| 361 | 'dev':dev_name, 'event_t':time} | 363 | 'dev':dev_name, 'event_t':time, |
| 364 | 'work':work, 'budget':budget} | ||
| 362 | event_list.append(rec_data) | 365 | event_list.append(rec_data) |
| 363 | 366 | ||
| 364 | def handle_netif_rx(event_info): | 367 | def handle_netif_rx(event_info): |
