[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cd9c2290-f874-49e6-bc99-5336a096cffb@redhat.com>
Date: Mon, 21 Oct 2024 16:25:25 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: David Wei <dw@...idwei.uk>, io-uring@...r.kernel.org,
netdev@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>, Pavel Begunkov <asml.silence@...il.com>,
Jakub Kicinski <kuba@...nel.org>, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jesper Dangaard Brouer
<hawk@...nel.org>, David Ahern <dsahern@...nel.org>,
Mina Almasry <almasrymina@...gle.com>,
Stanislav Fomichev <stfomichev@...il.com>, Joe Damato <jdamato@...tly.com>,
Pedro Tammela <pctammela@...atatu.com>
Subject: Re: [PATCH v6 08/15] net: add helper executing custom callback from
napi
Hi,
On 10/16/24 20:52, David Wei wrote:
> @@ -6503,6 +6511,41 @@ void napi_busy_loop(unsigned int napi_id,
> }
> EXPORT_SYMBOL(napi_busy_loop);
>
> +void napi_execute(unsigned napi_id,
> + void (*cb)(void *), void *cb_arg)
> +{
> + struct napi_struct *napi;
> + void *have_poll_lock = NULL;
Minor nit: please respect the reverse x-mas tree order.
> +
> + guard(rcu)();
Since this will land into net core code, please use the explicit RCU
read lock/unlock:
https://elixir.bootlin.com/linux/v6.12-rc3/source/Documentation/process/maintainer-netdev.rst#L387
> + napi = napi_by_id(napi_id);
> + if (!napi)
> + return;
> +
> + if (!IS_ENABLED(CONFIG_PREEMPT_RT))
> + preempt_disable();
> +
> + for (;;) {
> + local_bh_disable();
> +
> + if (napi_state_start_busy_polling(napi, 0)) {
> + have_poll_lock = netpoll_poll_lock(napi);
> + cb(cb_arg);
> + local_bh_enable();
> + busy_poll_stop(napi, have_poll_lock, 0, 1);
> + break;
> + }
> +
> + local_bh_enable();
> + if (unlikely(need_resched()))
> + break;
> + cpu_relax();
Don't you need a 'loop_end' condition here?
Side notes not specifically related to this patch: I likely got lost in
previous revision, but it's unclear to me which is the merge plan here,
could you please (re-)word it?
Thanks!
Paolo
Powered by blists - more mailing lists