public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: Nikolay Aleksandrov <razor@blackwall.org>
Cc: netdev@vger.kernel.org, Jay Vosburgh <j.vosburgh@gmail.com>,
	Andy Gospodarek <andy@greyhouse.net>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Jiri Pirko <jiri@resnulli.us>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	Ido Schimmel <idosch@nvidia.com>, Amit Cohen <amcohen@nvidia.com>
Subject: Re: [PATCH net-next] bonding: 3ad: send rtnl ifinfo notify when mux state changed
Date: Thu, 20 Jun 2024 17:08:48 +0800	[thread overview]
Message-ID: <ZnPxoFXHKQ5dAq5K@Laptop-X1> (raw)
In-Reply-To: <1b9fd871-e34a-4a7d-b1d3-4f3fd8858fa3@blackwall.org>

Hi Nikolay,
On Thu, Jun 20, 2024 at 11:47:46AM +0300, Nikolay Aleksandrov wrote:
> On 6/20/24 09:10, Hangbin Liu wrote:
> > Currently, administrators need to retrieve LACP mux state changes from
> > the kernel DEBUG log using netdev_dbg and slave_dbg macros. To simplify
> > this process, let's send the ifinfo notification whenever the mux state
> > changes. This will enable users to directly access and monitor this
> > information using the ip monitor command.
> > 
> > To achieve this, add a new enum NETDEV_LACP_STATE_CHANGE in netdev_cmd.
> > 
> > Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> > ---
> >  drivers/net/bonding/bond_3ad.c | 2 ++
> >  include/linux/netdevice.h      | 1 +
> >  net/core/dev.c                 | 2 +-
> >  net/core/rtnetlink.c           | 1 +
> >  4 files changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
> > index c6807e473ab7..bcd8b16173f2 100644
> > --- a/drivers/net/bonding/bond_3ad.c
> > +++ b/drivers/net/bonding/bond_3ad.c
> > @@ -1185,6 +1185,8 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr)
> >  		default:
> >  			break;
> >  		}
> > +
> > +		call_netdevice_notifiers(NETDEV_LACP_STATE_CHANGE, port->slave->dev);
> >  	}
> 
> This will cause sleeping while atomic because
> ad_mux_machine() is called in atomic context (both rcu and bond mode
> spinlock held with bh disabled) in bond_3ad_state_machine_handler().

Ah, that's why we call the bond_slave_state_notify() after spin_unlock_bh()?
Where can I check if call_netdevice_notifiers() would sleep? So I can avoid
this error next time.

> Minor (and rather more personal pref) I'd split the addition of the new
> event and adding its first user (bond) for separate review.

Hmm, with out using call_netdevice_notifiers(). How about just call
rtmsg_ifinfo() or rtmsg_ifinfo_event() directly?

Thanks
Hangbin

  reply	other threads:[~2024-06-20  9:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-20  6:10 [PATCH net-next] bonding: 3ad: send rtnl ifinfo notify when mux state changed Hangbin Liu
2024-06-20  8:47 ` Nikolay Aleksandrov
2024-06-20  9:08   ` Hangbin Liu [this message]
2024-06-21 10:58     ` Nikolay Aleksandrov

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=ZnPxoFXHKQ5dAq5K@Laptop-X1 \
    --to=liuhangbin@gmail.com \
    --cc=amcohen@nvidia.com \
    --cc=andy@greyhouse.net \
    --cc=bigeasy@linutronix.de \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=idosch@nvidia.com \
    --cc=j.vosburgh@gmail.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=razor@blackwall.org \
    /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