Messages in this thread | | | From | DENG Qingfang <> | Date | Fri, 3 Feb 2023 21:05:41 +0800 | 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@redhat.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?
| |