[PATCH net-next v2 0/2] netconsole: replace target_list_lock by RCU on userdata hot path

Breno Leitao posted 2 patches 1 month, 3 weeks ago
There is a newer version of this series
drivers/net/netconsole.c                           |  92 +++++----
.../selftests/drivers/net/netconsole/Makefile      |   1 +
.../drivers/net/netconsole/netcons_userdata.sh     | 229 +++++++++++++++++++++
3 files changed, 286 insertions(+), 36 deletions(-)
[PATCH net-next v2 0/2] netconsole: replace target_list_lock by RCU on userdata hot path
Posted by Breno Leitao 1 month, 3 weeks ago
I would like to move netconsole to use RCU on the hot path for
a while instead of target_list_lock. My goal is to have no lock on the
tx side at all and eventually drop CON_NBCON_ATOMIC_UNSAFE, if that is
possible [1].

Start removing target_list_lock on certain parts of the code. This patch
transforms the userdata array into a RCU-protected pointer, and uses the
dynamic mutex as the write lock.

Added a selftest, given we didn't have any netconsole selftest for
userdata operations. Feel free to drop it if this is not useful, dear
maintainers.

Link: https://lore.kernel.org/all/20251121-nbcon-v1-0-503d17b2b4af@debian.org/[1]

Signed-off-by: Breno Leitao <leitao@debian.org>
---
Changes in v2:
- netconsole: free the payload with kfree(rcu_access_pointer()) in the
  teardown paths, silencing a sparse __rcu warning (Gustavo Luiz Duarte)
- selftest: reap every torture worker before reporting a failure, so
  none is left writing to configfs while the exit trap runs
- Link to v1: https://patch.msgid.link/20260803-netcons-userdata-rcu-v1-0-1e5e6b62b75d@debian.org

---
Breno Leitao (2):
      netconsole: publish the userdata payload with RCU
      selftests: netconsole: add a userdata torture test

 drivers/net/netconsole.c                           |  92 +++++----
 .../selftests/drivers/net/netconsole/Makefile      |   1 +
 .../drivers/net/netconsole/netcons_userdata.sh     | 229 +++++++++++++++++++++
 3 files changed, 286 insertions(+), 36 deletions(-)
---
base-commit: 8ba098e6b6ff0db8edf28528d1552be261af30d4
change-id: 20260801-netcons-userdata-rcu-40446e018f86

Best regards,
--  
Breno Leitao <leitao@debian.org>
Re: [PATCH net-next v2 0/2] netconsole: replace target_list_lock by RCU on userdata hot path
Posted by Jakub Kicinski 1 month, 3 weeks ago
On Wed, 05 Aug 2026 03:58:18 -0700 Breno Leitao wrote:
> I would like to move netconsole to use RCU on the hot path for
> a while instead of target_list_lock. My goal is to have no lock on the
> tx side at all and eventually drop CON_NBCON_ATOMIC_UNSAFE, if that is
> possible [1].

Bot says this didn't apply when it was posted.
Re: [PATCH net-next v2 0/2] netconsole: replace target_list_lock by RCU on userdata hot path
Posted by Breno Leitao 1 month, 3 weeks ago
On Fri, Aug 07, 2026 at 05:09:08PM -0700, Jakub Kicinski wrote:
> On Wed, 05 Aug 2026 03:58:18 -0700 Breno Leitao wrote:
> > I would like to move netconsole to use RCU on the hot path for
> > a while instead of target_list_lock. My goal is to have no lock on the
> > tx side at all and eventually drop CON_NBCON_ATOMIC_UNSAFE, if that is
> > possible [1].
> 
> Bot says this didn't apply when it was posted.

Sorry, let me rebase it and update.