Netdev List
 help / color / mirror / Atom feed
From: alexjlzheng@gmail.com
To: kuba@kernel.org
Cc: albinwyang@tencent.com, alexjlzheng@gmail.com,
	alexjlzheng@tencent.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com,
	hannes@stressinduktion.org, horms@kernel.org, kuniyu@google.com,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	pabeni@redhat.com, sd@queasysnail.net, shenyangyang4@huawei.com
Subject: Re: [PATCH net v2 1/3] macsec: introduce dedicated workqueue for SA crypto cleanup
Date: Sat,  9 May 2026 10:00:54 +0800	[thread overview]
Message-ID: <20260509020054.1792674-1-alexjlzheng@tencent.com> (raw)
In-Reply-To: <20260508154243.3ce21bee@kernel.org>

From: Jinliang Zheng <alexjlzheng@tencent.com>

On Fri, 8 May 2026 15:42:43 -0700, Jakub Kicinski wrote:
> > +wq:
> > +	destroy_workqueue(macsec_wq);
> > +	return err;
>
> nit: err_destroy_wq: would be a better label name
>
> rcu_barrier() is needed before this

Thanks for the review.

Regarding the label name: "wq:" follows the existing naming convention
in macsec_init(), where the other error labels are also named after the
resource they clean up ("rtnl:", "notifier:") rather than using the
"err_xxx:" style. I kept it consistent with that local convention, but
happy to switch to "err_destroy_wq:" if you prefer uniformity with the
broader codebase.

Regarding rcu_barrier(): in the error path of macsec_init(), the
workqueue has just been created and no MACsec interface has been
registered yet. queue_rcu_work(macsec_wq, ...) is only reachable
from macsec_rxsa_put() and macsec_txsa_put(), which require an SA
object to exist. No SA can be created before macsec_init() succeeds,
so macsec_wq is guaranteed to be empty at this point and
rcu_barrier() is not needed here.

The rcu_barrier() in macsec_exit() is necessary for a different
reason: at that point live interfaces may have been destroyed and
their SAs may be in-flight through the rcu_work mechanism, so we
must wait for all rcu_work_rcufn callbacks to finish enqueuing their
work items before destroy_workqueue() drains them.

Does that reasoning make sense, or am I missing a path where work
could be queued onto macsec_wq during the init error unwind?

Thanks,
Jinliang

  reply	other threads:[~2026-05-09  2:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-07  2:04 [PATCH net v2 0/3] macsec: use rcu_work to fix crypto cleanup in softirq context alexjlzheng
2026-05-07  2:04 ` [PATCH net v2 v2 1/3] macsec: introduce dedicated workqueue for SA crypto cleanup alexjlzheng
2026-05-08 22:42   ` Jakub Kicinski
2026-05-09  2:00     ` alexjlzheng [this message]
2026-05-09  2:19       ` [PATCH net " Jakub Kicinski
2026-05-09  2:50         ` alexjlzheng
2026-05-07  2:04 ` [PATCH net v2 v2 2/3] macsec: use rcu_work to defer RX SA crypto cleanup out of softirq alexjlzheng
2026-05-08 22:42   ` Jakub Kicinski
2026-05-07  2:04 ` [PATCH net v2 v2 3/3] macsec: use rcu_work to defer TX " alexjlzheng

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=20260509020054.1792674-1-alexjlzheng@tencent.com \
    --to=alexjlzheng@gmail.com \
    --cc=albinwyang@tencent.com \
    --cc=alexjlzheng@tencent.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hannes@stressinduktion.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sd@queasysnail.net \
    --cc=shenyangyang4@huawei.com \
    /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