netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: auke-jan.h.kok@intel.com, gallatin@myri.com,
	joonwpark81@gmail.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, jgarzik@pobox.com,
	shemminger@linux-foundation.org, jesse.brandeburg@intel.com
Subject: Re: [RFC] net: napi fix
Date: Thu, 13 Dec 2007 21:16:12 +0100	[thread overview]
Message-ID: <4761930C.3030504@gmail.com> (raw)
In-Reply-To: <20071213.055013.83963139.davem@davemloft.net>

David Miller wrote, On 12/13/2007 02:50 PM:

> From: Jarek Poplawski <jarkao2@gmail.com>
> Date: Thu, 13 Dec 2007 14:49:53 +0100
> 
>> As a matter of fact, since it's "unlikely()" in net_rx_action() anyway,
>> I wonder what is the main reason or gain of leaving such a tricky
>> exception, instead of letting drivers to always decide which is the
>> best moment for napi_complete()? (Or maybe even, in such a case, they
>> should call some function with this list_move_tail() if it's so
>> useful?)
> 
> It is the only sane way to synchronize the list manipulations.
> 
> There has to be a way for ->poll() to tell net_rx_action() two things:
> 
> 1) How much work was completed, so we can adjust 'budget'


The 'budget' line would stay where it is. IMHO, it's only about this
list_move_tail(). (Probably also doing netpoll_poll_unlock()
during n->poll() could be considered to let the driver even destroy
napi just after napi_complete() - but it's another subject.)

> 2) Was the NAPI quota exhausted?  So that we know that
>    net_rx_action() still "owns" the polling context and
>    thus can do the list manipulation safely.
> 
> And these both need to be encoded into one single return value, thus
> the adopted convention that "work == weight" means that the device has
> not done a NAPI complete.

Of course, with some care and explanations to driver maintainers, like in
this case, this all should probably work like it is. But IMHO it would be
easier to remember and maintain if there are some simple rules with no
exceptions, so here e.g. driver always "owns" (with functions like
napi_schedule(), napi_complete(), and maybe napi_move_tail()), and
net_rx_action() only reads the list and runs these functions?!

I see in a nearby thread you would prefer to save some work to drivers
(like this netif_running() check), but I think this all is at the cost
of flexibility, and there will probably appear new problems, when a
driver simply can't wait till the next poll (which btw. looks strange
with all these hotplugging, usb and powersaving).

Regards,
Jarek P.

  parent reply	other threads:[~2007-12-13 20:13 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-12 17:29 [RFC] net: napi fix Andrew Gallatin
2007-12-12 17:38 ` David Miller
2007-12-12 17:40   ` Andrew Gallatin
2007-12-12 18:41   ` Kok, Auke
2007-12-13  7:41     ` Joonwoo Park
2007-12-13 14:13       ` Andrew Gallatin
2007-12-13 14:19         ` David Miller
2007-12-13 16:45           ` Kok, Auke
2007-12-13 18:22           ` Stephen Hemminger
2007-12-13 19:02             ` Andrew Gallatin
2007-12-13 19:09               ` David Miller
2007-12-13 19:35                 ` Stephen Hemminger
2007-12-13 20:38                   ` David Miller
2007-12-14  2:06         ` Joonwoo Park
2007-12-13 13:49     ` Jarek Poplawski
2007-12-13 13:50       ` David Miller
2007-12-13 14:14         ` Jarek Poplawski
2007-12-13 20:16         ` Jarek Poplawski [this message]
2007-12-13 20:37           ` David Miller
2007-12-13 20:41             ` Stephen Hemminger
2007-12-13 21:55               ` Jarek Poplawski
2007-12-13 22:28             ` Jarek Poplawski
2007-12-13 22:34               ` David Miller
2007-12-13 22:58                 ` Jarek Poplawski
2007-12-20  9:52   ` Robert Olsson
2007-12-20 11:22     ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2007-12-12  4:01 [PATCH 6/7] : tehuti Fix possible causing oops of net_rx_action Joonwoo Park
2007-12-12  5:39 ` Stephen Hemminger
2007-12-12  5:46   ` [RFC] net: napi fix Stephen Hemminger
2007-12-12  6:05     ` Joonwoo Park
2007-12-12 15:22       ` David Miller
2007-12-12 15:21     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4761930C.3030504@gmail.com \
    --to=jarkao2@gmail.com \
    --cc=auke-jan.h.kok@intel.com \
    --cc=davem@davemloft.net \
    --cc=gallatin@myri.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=jgarzik@pobox.com \
    --cc=joonwpark81@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).