Message ID | 20240625070057.2004129-1-liuhangbin@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [PATCHv2,net-next] bonding: 3ad: send ifinfo notify when mux state changed | expand |
On 25/06/2024 10:00, 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. > > Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> > --- > v2: don't use call_netdevice_notifiers as it will case sleeping in atomic > context (Nikolay Aleksandrov) > --- > drivers/net/bonding/bond_3ad.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c > index c6807e473ab7..7a7224bf1894 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; > } > + > + rtmsg_ifinfo(RTM_NEWLINK, port->slave->dev, 0, GFP_KERNEL, 0, NULL); > } > } > GFP_KERNEL still allows to sleep, this is where I meant use GFP_ATOMIC if under the locks in my previous comment. Also how does an administrator undestand that the mux state changed by using the above msg? Could you show the iproute2 part and how it looks for anyone monitoring?
On Tue, Jun 25, 2024 at 10:11:53AM +0300, Nikolay Aleksandrov wrote: > On 25/06/2024 10:00, 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. > > > > Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> > > --- > > v2: don't use call_netdevice_notifiers as it will case sleeping in atomic > > context (Nikolay Aleksandrov) > > --- > > drivers/net/bonding/bond_3ad.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c > > index c6807e473ab7..7a7224bf1894 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; > > } > > + > > + rtmsg_ifinfo(RTM_NEWLINK, port->slave->dev, 0, GFP_KERNEL, 0, NULL); > > } > > } > > > > GFP_KERNEL still allows to sleep, this is where I meant use GFP_ATOMIC if > under the locks in my previous comment. Oh, damn! I absolutely agree with you. I did read your last comment and I plan to use GFP_ATOMIC. I modified my first version of the patch (that use rtmsg_ifinfo directly, which use GFP_KERNEL) but forgot to commit the changes... Sorry for the low level mistake... > Also how does an administrator undestand that the mux state changed by > using the above msg? Could you show the iproute2 part and how it looks for > anyone monitoring? Do you mean to add the log in the patch description or you want to see it? It looks like the following: 7: veth1@if6: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc noqueue master bond0 state UP group default link/ether 02:0a:04:c2:d6:21 brd ff:ff:ff:ff:ff:ff link-netns b promiscuity 0 allmulti 0 minmtu 68 maxmtu 65535 veth bond_slave state BACKUP mii_status UP ... ad_aggregator_id 1 ad_actor_oper_port_state 143 ad_actor_oper_port_state_str <active,short_timeout,aggregating,in_sync,expired> ad_partner_oper_port_state 55 ad_partner_oper_port_state_str <active,short_timeout,aggregating,collecting,distributing> ... 7: veth1@if6: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc noqueue master bond0 state UP group default link/ether 02:0a:04:c2:d6:21 brd ff:ff:ff:ff:ff:ff link-netns b promiscuity 0 allmulti 0 minmtu 68 maxmtu 65535 veth bond_slave state ACTIVE mii_status UP ... ad_aggregator_id 1 ad_actor_oper_port_state 79 ad_actor_oper_port_state_str <active,short_timeout,aggregating,in_sync,defaulted> ad_partner_oper_port_state 1 ad_partner_oper_port_state_str <active> ... 7: veth1@if6: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc noqueue master bond0 state UP group default link/ether 02:0a:04:c2:d6:21 brd ff:ff:ff:ff:ff:ff link-netns b promiscuity 0 allmulti 0 minmtu 68 maxmtu 65535 veth bond_slave state ACTIVE mii_status UP ... ad_aggregator_id 1 ad_actor_oper_port_state 63 ad_actor_oper_port_state_str <active,short_timeout,aggregating,in_sync,collecting,distributing> ad_partner_oper_port_state 63 ad_partner_oper_port_state_str <active,short_timeout,aggregating,in_sync,collecting,distributing> ... You can see the actor and partner port state changes. Thanks Hangbin
On 26/06/2024 04:42, Hangbin Liu wrote: > On Tue, Jun 25, 2024 at 10:11:53AM +0300, Nikolay Aleksandrov wrote: >> On 25/06/2024 10:00, 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. >>> >>> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> >>> --- >>> v2: don't use call_netdevice_notifiers as it will case sleeping in atomic >>> context (Nikolay Aleksandrov) >>> --- >>> drivers/net/bonding/bond_3ad.c | 2 ++ >>> 1 file changed, 2 insertions(+) >>> >>> diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c >>> index c6807e473ab7..7a7224bf1894 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; >>> } >>> + >>> + rtmsg_ifinfo(RTM_NEWLINK, port->slave->dev, 0, GFP_KERNEL, 0, NULL); >>> } >>> } >>> >> >> GFP_KERNEL still allows to sleep, this is where I meant use GFP_ATOMIC if >> under the locks in my previous comment. > > Oh, damn! I absolutely agree with you. I did read your last comment and I plan > to use GFP_ATOMIC. I modified my first version of the patch (that use > rtmsg_ifinfo directly, which use GFP_KERNEL) but forgot to commit the changes... > > Sorry for the low level mistake... > >> Also how does an administrator undestand that the mux state changed by >> using the above msg? Could you show the iproute2 part and how it looks for >> anyone monitoring? > > Do you mean to add the log in the patch description or you want to see it? > It looks like the following: > > 7: veth1@if6: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc noqueue master bond0 state UP group default > link/ether 02:0a:04:c2:d6:21 brd ff:ff:ff:ff:ff:ff link-netns b promiscuity 0 allmulti 0 minmtu 68 maxmtu 65535 > veth > bond_slave state BACKUP mii_status UP ... ad_aggregator_id 1 ad_actor_oper_port_state 143 ad_actor_oper_port_state_str <active,short_timeout,aggregating,in_sync,expired> ad_partner_oper_port_state 55 ad_partner_oper_port_state_str <active,short_timeout,aggregating,collecting,distributing> ... > 7: veth1@if6: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc noqueue master bond0 state UP group default > link/ether 02:0a:04:c2:d6:21 brd ff:ff:ff:ff:ff:ff link-netns b promiscuity 0 allmulti 0 minmtu 68 maxmtu 65535 > veth > bond_slave state ACTIVE mii_status UP ... ad_aggregator_id 1 ad_actor_oper_port_state 79 ad_actor_oper_port_state_str <active,short_timeout,aggregating,in_sync,defaulted> ad_partner_oper_port_state 1 ad_partner_oper_port_state_str <active> ... > 7: veth1@if6: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc noqueue master bond0 state UP group default > link/ether 02:0a:04:c2:d6:21 brd ff:ff:ff:ff:ff:ff link-netns b promiscuity 0 allmulti 0 minmtu 68 maxmtu 65535 > veth > bond_slave state ACTIVE mii_status UP ... ad_aggregator_id 1 ad_actor_oper_port_state 63 ad_actor_oper_port_state_str <active,short_timeout,aggregating,in_sync,collecting,distributing> ad_partner_oper_port_state 63 ad_partner_oper_port_state_str <active,short_timeout,aggregating,in_sync,collecting,distributing> ... > > You can see the actor and partner port state changes. > > Thanks > Hangbin Yeah, I just wanted to see how it looks. Feel free to add it to the commit description but I'm good either way. :) Cheers, Nik
Hi Hangbin,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Hangbin-Liu/bonding-3ad-send-ifinfo-notify-when-mux-state-changed/20240626-005323
base: net-next/main
patch link: https://lore.kernel.org/r/20240625070057.2004129-1-liuhangbin%40gmail.com
patch subject: [PATCHv2 net-next] bonding: 3ad: send ifinfo notify when mux state changed
config: parisc-defconfig (https://download.01.org/0day-ci/archive/20240627/202406270002.Pr7BwyW0-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240627/202406270002.Pr7BwyW0-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406270002.Pr7BwyW0-lkp@intel.com/
All errors (new ones prefixed by >>, old ones prefixed by <<):
WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nfs_common/grace.o
WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_ucs2_utils.o
WARNING: modpost: missing MODULE_DESCRIPTION() in fs/binfmt_misc.o
WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nfs/nfs.o
WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nfs/nfsv3.o
WARNING: modpost: missing MODULE_DESCRIPTION() in crypto/cast_common.o
WARNING: modpost: missing MODULE_DESCRIPTION() in crypto/xor.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/crypto/libchacha.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/asn1_decoder.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/matrox/matroxfb_accel.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/matrox/matroxfb_DAC1064.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/matrox/matroxfb_Ti3026.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/macmodes.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/char/lp.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/char/ppdev.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/drm_panel_orientation_quirks.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/udl/udl.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/hid/hid-logitech-dj.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pcmcia/pcmcia_rsrc.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pcmcia/yenta_socket.o
>> ERROR: modpost: "rtmsg_ifinfo" [drivers/net/bonding/bonding.ko] undefined!
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index c6807e473ab7..7a7224bf1894 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; } + + rtmsg_ifinfo(RTM_NEWLINK, port->slave->dev, 0, GFP_KERNEL, 0, NULL); } }
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. Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> --- v2: don't use call_netdevice_notifiers as it will case sleeping in atomic context (Nikolay Aleksandrov) --- drivers/net/bonding/bond_3ad.c | 2 ++ 1 file changed, 2 insertions(+)