Message ID | 1572998794-9392-1-git-send-email-tlfalcon@linux.ibm.com |
---|---|
State | RFC |
Delegated to: | David Miller |
Headers | show |
Series | [RFC] powerpc/pseries/mobility: notify network peers after migration | expand |
On Tue, 2019-11-05 at 18:06 -0600, Thomas Falcon wrote: > After a migration, it is necessary to send a gratuitous ARP > from all running interfaces so that the rest of the network > is aware of its new location. However, some supported network > devices are unaware that they have been migrated. To avoid network > interruptions and other unwanted behavior, force a GARP on all > valid, running interfaces as part of the post_mobility_fixup > routine. > > Signed-off-by: Thomas Falcon <tlfalcon@linux.ibm.com> Hi Thomas, > --- > arch/powerpc/platforms/pseries/mobility.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/arch/powerpc/platforms/pseries/mobility.c > b/arch/powerpc/platforms/pseries/mobility.c > index b571285f6c14..c1abc14cf2bb 100644 > --- a/arch/powerpc/platforms/pseries/mobility.c > +++ b/arch/powerpc/platforms/pseries/mobility.c > @@ -17,6 +17,9 @@ > #include <linux/delay.h> > #include <linux/slab.h> > #include <linux/stringify.h> > +#include <linux/netdevice.h> > +#include <linux/rtnetlink.h> > +#include <net/net_namespace.h> > > #include <asm/machdep.h> > #include <asm/rtas.h> > @@ -331,6 +334,8 @@ void post_mobility_fixup(void) > { > int rc; > int activate_fw_token; > + struct net_device *netdev; > + struct net *net; > > activate_fw_token = rtas_token("ibm,activate-firmware"); > if (activate_fw_token == RTAS_UNKNOWN_SERVICE) { > @@ -371,6 +376,21 @@ void post_mobility_fixup(void) > /* Possibly switch to a new RFI flush type */ > pseries_setup_rfi_flush(); > > + /* need to force a gratuitous ARP on running interfaces */ > + rtnl_lock(); > + for_each_net(net) { > + for_each_netdev(net, netdev) { > + if (netif_device_present(netdev) && > + netif_running(netdev) && > + !(netdev->flags & (IFF_NOARP | > IFF_LOOPBACK))) > + call_netdevice_notifiers(NETDEV_NOTIFY_ > PEERS, > + netdev); Without curly braces following the "if" statment, the second line (below) will be executed unconditionally, which I assume with this indentation isn't what you want. (reported by snowpatch) - Russell > + call_netdevice_notifiers(NETDEV_RESEND_ > IGMP, > + netdev); > + } > + } > + rtnl_unlock(); > + > return; > } >
On 11/5/19 10:13 PM, Russell Currey wrote: > On Tue, 2019-11-05 at 18:06 -0600, Thomas Falcon wrote: >> After a migration, it is necessary to send a gratuitous ARP >> from all running interfaces so that the rest of the network >> is aware of its new location. However, some supported network >> devices are unaware that they have been migrated. To avoid network >> interruptions and other unwanted behavior, force a GARP on all >> valid, running interfaces as part of the post_mobility_fixup >> routine. >> >> Signed-off-by: Thomas Falcon <tlfalcon@linux.ibm.com> > Hi Thomas, > >> --- >> arch/powerpc/platforms/pseries/mobility.c | 20 ++++++++++++++++++++ >> 1 file changed, 20 insertions(+) >> >> diff --git a/arch/powerpc/platforms/pseries/mobility.c >> b/arch/powerpc/platforms/pseries/mobility.c >> index b571285f6c14..c1abc14cf2bb 100644 >> --- a/arch/powerpc/platforms/pseries/mobility.c >> +++ b/arch/powerpc/platforms/pseries/mobility.c >> @@ -17,6 +17,9 @@ >> #include <linux/delay.h> >> #include <linux/slab.h> >> #include <linux/stringify.h> >> +#include <linux/netdevice.h> >> +#include <linux/rtnetlink.h> >> +#include <net/net_namespace.h> >> >> #include <asm/machdep.h> >> #include <asm/rtas.h> >> @@ -331,6 +334,8 @@ void post_mobility_fixup(void) >> { >> int rc; >> int activate_fw_token; >> + struct net_device *netdev; >> + struct net *net; >> >> activate_fw_token = rtas_token("ibm,activate-firmware"); >> if (activate_fw_token == RTAS_UNKNOWN_SERVICE) { >> @@ -371,6 +376,21 @@ void post_mobility_fixup(void) >> /* Possibly switch to a new RFI flush type */ >> pseries_setup_rfi_flush(); >> >> + /* need to force a gratuitous ARP on running interfaces */ >> + rtnl_lock(); >> + for_each_net(net) { >> + for_each_netdev(net, netdev) { >> + if (netif_device_present(netdev) && >> + netif_running(netdev) && >> + !(netdev->flags & (IFF_NOARP | >> IFF_LOOPBACK))) >> + call_netdevice_notifiers(NETDEV_NOTIFY_ >> PEERS, >> + netdev); > Without curly braces following the "if" statment, the second line > (below) will be executed unconditionally, which I assume with this > indentation isn't what you want. > > (reported by snowpatch) > > - Russell Thanks for catching that! I'll fix that and send a v2 soon. Tom >> + call_netdevice_notifiers(NETDEV_RESEND_ >> IGMP, >> + netdev); >> + } >> + } >> + rtnl_unlock(); >> + >> return; >> } >>
Hi Tom, Thomas Falcon <tlfalcon@linux.ibm.com> writes: > After a migration, it is necessary to send a gratuitous ARP > from all running interfaces so that the rest of the network > is aware of its new location. However, some supported network > devices are unaware that they have been migrated. To avoid network > interruptions and other unwanted behavior, force a GARP on all > valid, running interfaces as part of the post_mobility_fixup > routine. [...] > @@ -331,6 +334,8 @@ void post_mobility_fixup(void) > { > int rc; > int activate_fw_token; > + struct net_device *netdev; > + struct net *net; > > activate_fw_token = rtas_token("ibm,activate-firmware"); > if (activate_fw_token == RTAS_UNKNOWN_SERVICE) { > @@ -371,6 +376,21 @@ void post_mobility_fixup(void) > /* Possibly switch to a new RFI flush type */ > pseries_setup_rfi_flush(); > > + /* need to force a gratuitous ARP on running interfaces */ > + rtnl_lock(); > + for_each_net(net) { > + for_each_netdev(net, netdev) { > + if (netif_device_present(netdev) && > + netif_running(netdev) && > + !(netdev->flags & (IFF_NOARP | IFF_LOOPBACK))) > + call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, > + netdev); > + call_netdevice_notifiers(NETDEV_RESEND_IGMP, > + netdev); > + } > + } > + rtnl_unlock(); > + This isn't an outright nak, but this is not nice. It illustrates the need to rethink the pseries partition migration code. There is no mechanism for drivers and other interested code to prepare for a migration or to adjust to the destination. So post_mobility_fixup() will continue to grow into a fragile collection of calls into unrelated subsystems until there is a better design -- either a pseries-specific notification/callback mechanism, or something based on the pm framework. My understanding is that this is needed specifically for ibmveth and, unlike ibmvnic, the platform does not provide any notification to that driver that a migration has occurred, right?
Hi Thomas, Thomas Falcon <tlfalcon@linux.ibm.com> writes: > After a migration, it is necessary to send a gratuitous ARP > from all running interfaces so that the rest of the network > is aware of its new location. However, some supported network > devices are unaware that they have been migrated. To avoid network > interruptions and other unwanted behavior, force a GARP on all > valid, running interfaces as part of the post_mobility_fixup > routine. > > Signed-off-by: Thomas Falcon <tlfalcon@linux.ibm.com> > --- > arch/powerpc/platforms/pseries/mobility.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) This patch is in powerpc code, but it's doing networking stuff that I don't really understand. So I'd like an Ack from Dave or someone else in netdev land before I merge it. cheers > diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c > index b571285f6c14..c1abc14cf2bb 100644 > --- a/arch/powerpc/platforms/pseries/mobility.c > +++ b/arch/powerpc/platforms/pseries/mobility.c > @@ -17,6 +17,9 @@ > #include <linux/delay.h> > #include <linux/slab.h> > #include <linux/stringify.h> > +#include <linux/netdevice.h> > +#include <linux/rtnetlink.h> > +#include <net/net_namespace.h> > > #include <asm/machdep.h> > #include <asm/rtas.h> > @@ -331,6 +334,8 @@ void post_mobility_fixup(void) > { > int rc; > int activate_fw_token; > + struct net_device *netdev; > + struct net *net; > > activate_fw_token = rtas_token("ibm,activate-firmware"); > if (activate_fw_token == RTAS_UNKNOWN_SERVICE) { > @@ -371,6 +376,21 @@ void post_mobility_fixup(void) > /* Possibly switch to a new RFI flush type */ > pseries_setup_rfi_flush(); > > + /* need to force a gratuitous ARP on running interfaces */ > + rtnl_lock(); > + for_each_net(net) { > + for_each_netdev(net, netdev) { > + if (netif_device_present(netdev) && > + netif_running(netdev) && > + !(netdev->flags & (IFF_NOARP | IFF_LOOPBACK))) > + call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, > + netdev); > + call_netdevice_notifiers(NETDEV_RESEND_IGMP, > + netdev); > + } > + } > + rtnl_unlock(); > + > return; > } > > -- > 2.12.3
On 11/6/19 7:33 PM, Michael Ellerman wrote: > Hi Thomas, > > Thomas Falcon <tlfalcon@linux.ibm.com> writes: >> After a migration, it is necessary to send a gratuitous ARP >> from all running interfaces so that the rest of the network >> is aware of its new location. However, some supported network >> devices are unaware that they have been migrated. To avoid network >> interruptions and other unwanted behavior, force a GARP on all >> valid, running interfaces as part of the post_mobility_fixup >> routine. >> >> Signed-off-by: Thomas Falcon <tlfalcon@linux.ibm.com> >> --- >> arch/powerpc/platforms/pseries/mobility.c | 20 ++++++++++++++++++++ >> 1 file changed, 20 insertions(+) > This patch is in powerpc code, but it's doing networking stuff that I > don't really understand. > > So I'd like an Ack from Dave or someone else in netdev land before I > merge it. Thanks, I've already included netdev in the CC list. I'll wait and keep an eye out for any comments from that side. Tom > > cheers > > >> diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c >> index b571285f6c14..c1abc14cf2bb 100644 >> --- a/arch/powerpc/platforms/pseries/mobility.c >> +++ b/arch/powerpc/platforms/pseries/mobility.c >> @@ -17,6 +17,9 @@ >> #include <linux/delay.h> >> #include <linux/slab.h> >> #include <linux/stringify.h> >> +#include <linux/netdevice.h> >> +#include <linux/rtnetlink.h> >> +#include <net/net_namespace.h> >> >> #include <asm/machdep.h> >> #include <asm/rtas.h> >> @@ -331,6 +334,8 @@ void post_mobility_fixup(void) >> { >> int rc; >> int activate_fw_token; >> + struct net_device *netdev; >> + struct net *net; >> >> activate_fw_token = rtas_token("ibm,activate-firmware"); >> if (activate_fw_token == RTAS_UNKNOWN_SERVICE) { >> @@ -371,6 +376,21 @@ void post_mobility_fixup(void) >> /* Possibly switch to a new RFI flush type */ >> pseries_setup_rfi_flush(); >> >> + /* need to force a gratuitous ARP on running interfaces */ >> + rtnl_lock(); >> + for_each_net(net) { >> + for_each_netdev(net, netdev) { >> + if (netif_device_present(netdev) && >> + netif_running(netdev) && >> + !(netdev->flags & (IFF_NOARP | IFF_LOOPBACK))) >> + call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, >> + netdev); >> + call_netdevice_notifiers(NETDEV_RESEND_IGMP, >> + netdev); >> + } >> + } >> + rtnl_unlock(); >> + >> return; >> } >> >> -- >> 2.12.3
On 11/6/19 4:14 PM, Nathan Lynch wrote: > Hi Tom, > > Thomas Falcon <tlfalcon@linux.ibm.com> writes: >> After a migration, it is necessary to send a gratuitous ARP >> from all running interfaces so that the rest of the network >> is aware of its new location. However, some supported network >> devices are unaware that they have been migrated. To avoid network >> interruptions and other unwanted behavior, force a GARP on all >> valid, running interfaces as part of the post_mobility_fixup >> routine. > [...] > >> @@ -331,6 +334,8 @@ void post_mobility_fixup(void) >> { >> int rc; >> int activate_fw_token; >> + struct net_device *netdev; >> + struct net *net; >> >> activate_fw_token = rtas_token("ibm,activate-firmware"); >> if (activate_fw_token == RTAS_UNKNOWN_SERVICE) { >> @@ -371,6 +376,21 @@ void post_mobility_fixup(void) >> /* Possibly switch to a new RFI flush type */ >> pseries_setup_rfi_flush(); >> >> + /* need to force a gratuitous ARP on running interfaces */ >> + rtnl_lock(); >> + for_each_net(net) { >> + for_each_netdev(net, netdev) { >> + if (netif_device_present(netdev) && >> + netif_running(netdev) && >> + !(netdev->flags & (IFF_NOARP | IFF_LOOPBACK))) >> + call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, >> + netdev); >> + call_netdevice_notifiers(NETDEV_RESEND_IGMP, >> + netdev); >> + } >> + } >> + rtnl_unlock(); >> + > This isn't an outright nak, but this is not nice. It illustrates the > need to rethink the pseries partition migration code. There is no > mechanism for drivers and other interested code to prepare for a > migration or to adjust to the destination. So post_mobility_fixup() will > continue to grow into a fragile collection of calls into unrelated > subsystems until there is a better design -- either a pseries-specific > notification/callback mechanism, or something based on the pm framework. > > My understanding is that this is needed specifically for ibmveth and, > unlike ibmvnic, the platform does not provide any notification to that > driver that a migration has occurred, right? Correct, the ibmveth device, unlike ibmvnic, receives no signal or notification at all in the event of a partition migration, so it can not handle it or send a gratuitous ARP because from the driver's perspective nothing has changed. As you've described, there is no existing notifier in the kernel to inform interested parties that the system has migrated or is about to migrate. Without adding the needed infrastructure to do that, I'm not sure how else to fix this. Tom
diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c index b571285f6c14..c1abc14cf2bb 100644 --- a/arch/powerpc/platforms/pseries/mobility.c +++ b/arch/powerpc/platforms/pseries/mobility.c @@ -17,6 +17,9 @@ #include <linux/delay.h> #include <linux/slab.h> #include <linux/stringify.h> +#include <linux/netdevice.h> +#include <linux/rtnetlink.h> +#include <net/net_namespace.h> #include <asm/machdep.h> #include <asm/rtas.h> @@ -331,6 +334,8 @@ void post_mobility_fixup(void) { int rc; int activate_fw_token; + struct net_device *netdev; + struct net *net; activate_fw_token = rtas_token("ibm,activate-firmware"); if (activate_fw_token == RTAS_UNKNOWN_SERVICE) { @@ -371,6 +376,21 @@ void post_mobility_fixup(void) /* Possibly switch to a new RFI flush type */ pseries_setup_rfi_flush(); + /* need to force a gratuitous ARP on running interfaces */ + rtnl_lock(); + for_each_net(net) { + for_each_netdev(net, netdev) { + if (netif_device_present(netdev) && + netif_running(netdev) && + !(netdev->flags & (IFF_NOARP | IFF_LOOPBACK))) + call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, + netdev); + call_netdevice_notifiers(NETDEV_RESEND_IGMP, + netdev); + } + } + rtnl_unlock(); + return; }
After a migration, it is necessary to send a gratuitous ARP from all running interfaces so that the rest of the network is aware of its new location. However, some supported network devices are unaware that they have been migrated. To avoid network interruptions and other unwanted behavior, force a GARP on all valid, running interfaces as part of the post_mobility_fixup routine. Signed-off-by: Thomas Falcon <tlfalcon@linux.ibm.com> --- arch/powerpc/platforms/pseries/mobility.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)