mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matt Johnston <matt@codeconstruct.com.au>
To: Kenny Hsieh <kenny_hsieh@jabil.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	 "jk@codeconstruct.com.au"	 <jk@codeconstruct.com.au>,
	"andi.shyti@kernel.org" <andi.shyti@kernel.org>,
	 "peda@lysator.liu.se"	 <peda@lysator.liu.se>,
	"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
	 "davem@davemloft.net"	 <davem@davemloft.net>,
	"edumazet@kernel.org" <edumazet@kernel.org>,
	 "kuba@kernel.org"	 <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	 "linux-i2c@vger.kernel.org"	 <linux-i2c@vger.kernel.org>,
	"linux-kernel@vger.kernel.org"	 <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next v2] mctp i2c: add sysfs control for mux child netdevs
Date: Mon, 02 Nov 2026 17:04:31 +0800	[thread overview]
Message-ID: <7486b1fc4dbcca755dd2f6b6de54d17919af873a.camel@codeconstruct.com.au> (raw)
In-Reply-To: <DM8PR02MB808768B7D02FF12777B7777E8E602@DM8PR02MB8087.namprd02.prod.outlook.com>

Hi Kenny,

On Tue, 2026-10-27 at 08:58 +0000, Kenny Hsieh wrote:
> Hi Andi, Peter, Matt, Jeremy,
> 
> > - [High] The store-side guard against adapters being deleted does not
> >   close the race it claims to close.
> 
> > - [High] mctp_i2c_remove() runs mctp_i2c_remove_sysfs_all() while the
> >   client is still on driver_clients.
> 
> > - [Medium] mctp_i2c_probe() now releases driver_clients_lock after
> >   list_add() and before i2c_for_each_dev(mcli,...
> 
> > - [Medium] The new ABI lives on i2c adapter devices, which the I2C core
> >   owns, but the mctp-i2c driver attaches it with sysfs_update_group() on...
> 
> These races come back to the last point: mctp-i2c bolts the attribute
> onto adapters the i2c core owns. Before I respin I'd like to check which
> way to go.
> 
> I can keep it in mctp-i2c and fix the races there, mostly by reordering
> notify_del() and remove(), and adding the attributes after the probe
> walk so it can hold driver_clients_lock again. That works, but it's more
> bookkeeping and there's still no uevent for the attribute.
> 
> The other option is to declare it on i2c_adapter_type in the core and
> have mctp-i2c register the show/store callbacks. That's cleaner, the
> driver core handles the lifetime and most of the races go away, but it
> adds an i2c API with mctp-i2c as its only user.
> 
> I prefer to keep it in mctp-i2c, but happy to go either way.

I agree it would be cleaner to avoid having mctp-i2c create items in i2c core
sysfs space.

An alternative could be to create sysfs attributes under the mctp-i2c device
instance itself (the i2c slave).

Mux buses could have mctp-i2c netdevs instantiated with

echo "i2c-6" > /sys/bus/i2c/devices/2-1060/add_mctp_controller

(where i2c-6 is a child mux bus of i2c-2, and i2c-2 0x60 is a mctp-i2c i2c
device).

"echo i2c-6 > .../2-1060/remove_mctp_controller" would remove the mctp-i2c
netdev.
Setting a root node as an mctp controller would involve writing its own name
to the attribute file.

How does that look to you?

Cheers,
Matt


> > - [High] When mctp_register_netdev() fails, mctp_i2c_add_netdev()
> >   (drivers/net/mctp/mctp-i2c.c) now always sets `midev = NULL`, so the...
> 
> > - [Medium] In the baseline, mctp_i2c_add_netdev() has a real double
> >   teardown.
> 
> This is the known double free, tracked in a separate patch on net, and
> v3 drops the midev = NULL change:
> https://lore.kernel.org/netdev/20261027053715.1623087-1-kenny_hsieh@jabil.com/
> 
> > - [Medium] The new ABI document Documentation/ABI/testing/sysfs-
> >   bus-i2c-devices-mctp says "The attribute appears only on mux child...
> 
> > - [Medium] mctp_i2c_new_client() now calls `write_pnet(&mcli->net,
> >   get_net(current->nsproxy->net_ns))` before i2c_slave_register().
> 
> > - [Low] The commit message says "a rebind reattaches it reading 0".
> 
> > - [Low] The commit message gives "an adapter that the devicetree cannot
> >   describe at all, such as a USB-attached one" as a use case.
> 
> Will fix all four in v3.
> 
> > - [Medium] Writing 0 to mctp_controller removes a channel's netdev
> >   through mctp_i2c_remove_netdev() -> mctp_i2c_unregister() ->...
> 
> The sel reselection on removal isn't new, removing a mux adapter already
> goes down that path. I'd rather leave that for a separate patch and just
> fix the ABI wording here.
> 
> pw-bot: cr

      reply	other threads:[~2026-11-02  9:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15  8:13 Kenny Hsieh
2026-10-19  8:38 ` netdev-bot+sashiko
2026-10-27  8:58   ` Kenny Hsieh
2026-11-02  9:04     ` Matt Johnston [this message]

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=7486b1fc4dbcca755dd2f6b6de54d17919af873a.camel@codeconstruct.com.au \
    --to=matt@codeconstruct.com.au \
    --cc=andi.shyti@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=jk@codeconstruct.com.au \
    --cc=kenny_hsieh@jabil.com \
    --cc=kuba@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peda@lysator.liu.se \
    /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

all inboxes | Powered by JetHome®