[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALW65ja+P+E0fjEsZfm1XWb_dn_snuRoFA5i_i+_1K9j0+wi7Q@mail.gmail.com>
Date: Fri, 3 Feb 2023 21:05:41 +0800
From: DENG Qingfang <dqfext@...il.com>
To: Jesper Dangaard Brouer <jbrouer@...hat.com>
Cc: Jesper Dangaard Brouer <hawk@...nel.org>,
Ilias Apalodimas <ilias.apalodimas@...aro.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Lorenzo Bianconi <lorenzo@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
John Fastabend <john.fastabend@...il.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
brouer@...hat.com
Subject: Re: [PATCH net] net: page_pool: use in_softirq() instead
Hi Jesper,
On Fri, Feb 3, 2023 at 7:15 PM Jesper Dangaard Brouer
<jbrouer@...hat.com> wrote:
> How can I enable threaded NAPI on my system?
dev_set_threaded(napi_dev, true);
You can also enable it at runtime by writing 1 to
/sys/class/net/<devname>/threaded, but it only works if the driver
does _not_ use a dummy netdev for NAPI poll.
> I think other cases (above) are likely safe, but I worry a little about
> this case, as the page_pool_recycle_in_cache() rely on RX-NAPI protection.
> Meaning it is only the CPU that handles RX-NAPI for this RX-queue that
> is allowed to access this lockless array.
The major changes to the threaded NAPI is that instead of scheduling a
NET_RX softirq, it wakes up a kthread which then does the polling,
allowing it to be scheduled to another CPU. The driver's poll function
is called with BH disabled so it's still considered BH context.
> We do have the 'allow_direct' boolean, and if every driver/user uses
> this correctly, then this should be safe. Changing this makes it
> possible for drivers to use page_pool API incorrectly and this leads to
> hard-to-debug errors.
"incorrectly", like, calling it outside RX-NAPI?
Powered by blists - more mailing lists