Message ID | 87wqg1dsyw.fsf_-_@xmission.com |
---|---|
State | RFC, archived |
Delegated to: | David Miller |
Headers | show |
On Tue, 2014-03-11 at 01:45 -0700, Eric W. Biederman wrote: > When calling drivers napi poll function pass it a budget of 0, to > request that no rx packets be processed, and warn if any rx packets > are actually processed. > > Additionally remove the drop_mon tracepoint as nothing interesting > should be happening in netpoll, and running an arbitrary tracepoint > in irq context is probably a bad idea. > > Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> > --- > net/core/netpoll.c | 28 +++++++++------------------- > 1 files changed, 9 insertions(+), 19 deletions(-) Acked-by: Eric Dumazet <edumazet@google.com> -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Mar 11, 2014 at 1:45 AM, Eric W. Biederman <ebiederm@xmission.com> wrote: > - work = napi->poll(napi, budget); > - trace_napi_poll(napi); > + /* Use a budget of 0 to request the drivers not process > + * their receive queue. Warn when they do anyway. > + */ > + work = napi->poll(napi, 0); > + WARN_ON_ONCE(work != 0); > Adding more printk's in netpoll call path would only bring more troubles. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Cong Wang <xiyou.wangcong@gmail.com> writes: > On Tue, Mar 11, 2014 at 1:45 AM, Eric W. Biederman > <ebiederm@xmission.com> wrote: >> - work = napi->poll(napi, budget); >> - trace_napi_poll(napi); >> + /* Use a budget of 0 to request the drivers not process >> + * their receive queue. Warn when they do anyway. >> + */ >> + work = napi->poll(napi, 0); >> + WARN_ON_ONCE(work != 0); >> > > Adding more printk's in netpoll call path would only bring more > troubles. That is why I used WARN_ON_ONCE. So we are alerted to problems but because it only prints once service won't be denied if nothing except that warning cares. Eric -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index e883eff6799e..f95ca7f9d246 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -114,48 +114,38 @@ static void queue_process(struct work_struct *work) * trylock here and interrupts are already disabled in the softirq * case. Further, we test the poll_owner to avoid recursion on UP * systems where the lock doesn't exist. - * - * In cases where there is bi-directional communications, reading only - * one message at a time can lead to packets being dropped by the - * network adapter, forcing superfluous retries and possibly timeouts. - * Thus, we set our budget to greater than 1. */ -static int poll_one_napi(struct netpoll_info *npinfo, - struct napi_struct *napi, int budget) +static void poll_one_napi(struct netpoll_info *npinfo, + struct napi_struct *napi) { int work; - /* net_rx_action's ->poll() invocations and our's are * synchronized by this test which is only made while * holding the napi->poll_lock. */ if (!test_bit(NAPI_STATE_SCHED, &napi->state)) - return budget; + return; set_bit(NAPI_STATE_NPSVC, &napi->state); - work = napi->poll(napi, budget); - trace_napi_poll(napi); + /* Use a budget of 0 to request the drivers not process + * their receive queue. Warn when they do anyway. + */ + work = napi->poll(napi, 0); + WARN_ON_ONCE(work != 0); clear_bit(NAPI_STATE_NPSVC, &napi->state); - - return budget - work; } static void poll_napi(struct net_device *dev) { struct napi_struct *napi; - int budget = 16; list_for_each_entry(napi, &dev->napi_list, dev_list) { if (napi->poll_owner != smp_processor_id() && spin_trylock(&napi->poll_lock)) { - budget = poll_one_napi(rcu_dereference_bh(dev->npinfo), - napi, budget); + poll_one_napi(rcu_dereference_bh(dev->npinfo), napi); spin_unlock(&napi->poll_lock); - - if (!budget) - break; } } }
When calling drivers napi poll function pass it a budget of 0, to request that no rx packets be processed, and warn if any rx packets are actually processed. Additionally remove the drop_mon tracepoint as nothing interesting should be happening in netpoll, and running an arbitrary tracepoint in irq context is probably a bad idea. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> --- net/core/netpoll.c | 28 +++++++++------------------- 1 files changed, 9 insertions(+), 19 deletions(-)