[PATCH v2 1/1][SRU][J] ice: avoid bonding causing auxiliary plug/unplug under RTNL lock
Heitor Alves de Siqueira
halves at canonical.com
Fri Mar 31 17:36:49 UTC 2023
Hey Tim,
Thanks for the hint on the backport comments/description. I remember having
to do some minor context adjustments when I cherry-picked this last time,
but re-running against a fresh tree only gives me some "Auto-merging"
messages.
Would you like me to send out a v3 with the proper cherry-pick message?
On Fri, Mar 31, 2023 at 10:25 AM Tim Gardner <tim.gardner at canonical.com>
wrote:
> On 3/31/23 6:22 AM, Heitor Alves de Siqueira wrote:
> > From: Dave Ertman <david.m.ertman at intel.com>
> >
> > BugLink: https://bugs.launchpad.net/bugs/2004262
> >
> > RDMA is not supported in ice on a PF that has been added to a bonded
> > interface. To enforce this, when an interface enters a bond, we unplug
> > the auxiliary device that supports RDMA functionality. This unplug
> > currently happens in the context of handling the netdev bonding event.
> > This event is sent to the ice driver under RTNL context. This is causing
> > a deadlock where the RDMA driver is waiting for the RTNL lock to complete
> > the removal.
> >
> > Defer the unplugging/re-plugging of the auxiliary device to the service
> > task so that it is not performed under the RTNL lock context.
> >
> > Cc: stable at vger.kernel.org # 6.1.x
> > Reported-by: Jaroslav Pulchart <jaroslav.pulchart at gooddata.com>
> > Link:
> https://lore.kernel.org/netdev/CAK8fFZ6A_Gphw_3-QMGKEFQk=sfCw1Qmq0TVZK3rtAi7vb621A@mail.gmail.com/
> > Fixes: 5cb1ebdbc434 ("ice: Fix race condition during interface enslave")
> > Fixes: 4eace75e0853 ("RDMA/irdma: Report the correct link speed")
> > Signed-off-by: Dave Ertman <david.m.ertman at intel.com>
> > Tested-by: Arpana Arland <arpanax.arland at intel.com> (A Contingent
> worker at Intel)
> > Signed-off-by: Tony Nguyen <anthony.l.nguyen at intel.com>
> > Reviewed-by: Leon Romanovsky <leonro at nvidia.com>
> > Link:
> https://lore.kernel.org/r/20230310194833.3074601-1-anthony.l.nguyen@intel.com
> > Signed-off-by: Jakub Kicinski <kuba at kernel.org>
> > (backported from commit 248401cb2c4612d83eb0c352ee8103b78b8eb365)
> > Signed-off-by: Heitor Alves de Siqueira <halves at canonical.com>
> > ---
> > drivers/net/ethernet/intel/ice/ice.h | 14 +++++---------
> > drivers/net/ethernet/intel/ice/ice_main.c | 19 ++++++++-----------
> > 2 files changed, 13 insertions(+), 20 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/intel/ice/ice.h
> b/drivers/net/ethernet/intel/ice/ice.h
> > index 89bca2ed895a..2d67876c53a6 100644
> > --- a/drivers/net/ethernet/intel/ice/ice.h
> > +++ b/drivers/net/ethernet/intel/ice/ice.h
> > @@ -399,6 +399,7 @@ enum ice_pf_flags {
> > ICE_FLAG_MDD_AUTO_RESET_VF,
> > ICE_FLAG_LINK_LENIENT_MODE_ENA,
> > ICE_FLAG_PLUG_AUX_DEV,
> > + ICE_FLAG_UNPLUG_AUX_DEV,
> > ICE_FLAG_MTU_CHANGED,
> > ICE_PF_FLAGS_NBITS /* must be last */
> > };
> > @@ -706,16 +707,11 @@ static inline void ice_set_rdma_cap(struct ice_pf
> *pf)
> > */
> > static inline void ice_clear_rdma_cap(struct ice_pf *pf)
> > {
> > - /* We can directly unplug aux device here only if the flag bit
> > - * ICE_FLAG_PLUG_AUX_DEV is not set because ice_unplug_aux_dev()
> > - * could race with ice_plug_aux_dev() called from
> > - * ice_service_task(). In this case we only clear that bit now and
> > - * aux device will be unplugged later once ice_plug_aux_device()
> > - * called from ice_service_task() finishes (see
> ice_service_task()).
> > + /* defer unplug to service task to avoid RTNL lock and
> > + * clear PLUG bit so that pending plugs don't interfere
> > */
> > - if (!test_and_clear_bit(ICE_FLAG_PLUG_AUX_DEV, pf->flags))
> > - ice_unplug_aux_dev(pf);
> > -
> > + clear_bit(ICE_FLAG_PLUG_AUX_DEV, pf->flags);
> > + set_bit(ICE_FLAG_UNPLUG_AUX_DEV, pf->flags);
> > clear_bit(ICE_FLAG_RDMA_ENA, pf->flags);
> > clear_bit(ICE_FLAG_AUX_ENA, pf->flags);
> > }
> > diff --git a/drivers/net/ethernet/intel/ice/ice_main.c
> b/drivers/net/ethernet/intel/ice/ice_main.c
> > index ffbba5f6b7a5..d3462fc650d1 100644
> > --- a/drivers/net/ethernet/intel/ice/ice_main.c
> > +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> > @@ -2156,18 +2156,15 @@ static void ice_service_task(struct work_struct
> *work)
> > }
> > }
> >
> > - if (test_bit(ICE_FLAG_PLUG_AUX_DEV, pf->flags)) {
> > - /* Plug aux device per request */
> > - ice_plug_aux_dev(pf);
> > + /* unplug aux dev per request, if an unplug request came in
> > + * while processing a plug request, this will handle it
> > + */
> > + if (test_and_clear_bit(ICE_FLAG_UNPLUG_AUX_DEV, pf->flags))
> > + ice_unplug_aux_dev(pf);
> >
> > - /* Mark plugging as done but check whether unplug was
> > - * requested during ice_plug_aux_dev() call
> > - * (e.g. from ice_clear_rdma_cap()) and if so then
> > - * plug aux device.
> > - */
> > - if (!test_and_clear_bit(ICE_FLAG_PLUG_AUX_DEV, pf->flags))
> > - ice_unplug_aux_dev(pf);
> > - }
> > + /* Plug aux device per request */
> > + if (test_and_clear_bit(ICE_FLAG_PLUG_AUX_DEV, pf->flags))
> > + ice_plug_aux_dev(pf);
> >
> > if (test_and_clear_bit(ICE_FLAG_MTU_CHANGED, pf->flags)) {
> > struct iidc_event *event;
>
> This is a clean cherry pick for me. Do you have some cruft in your tree
> preventing clean application ? Also, when you declare that a patch is a
> backport you should describe what changes you had to make in order to
> get the patch to apply. For example,
>
> (backported from commit 248401cb2c4612d83eb0c352ee8103b78b8eb365)
> [Heitor - simple context adjustments]
>
> --
> -----------
> Tim Gardner
> Canonical, Inc
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20230331/b86c9acc/attachment-0001.html>
More information about the kernel-team
mailing list