RE: [PATCH net] ice: Fix race condition during interface enslave

From: Ertman, David M
Date: Thu Mar 10 2022 - 14:26:29 EST


> -----Original Message-----
> From: Ivan Vecera <ivecera@xxxxxxxxxx>
> Sent: Thursday, March 10, 2022 10:07 AM
> To: Ertman, David M <david.m.ertman@xxxxxxxxx>
> Cc: netdev@xxxxxxxxxxxxxxx; Petr Oros <poros@xxxxxxxxxx>; Brandeburg,
> Jesse <jesse.brandeburg@xxxxxxxxx>; Nguyen, Anthony L
> <anthony.l.nguyen@xxxxxxxxx>; David S. Miller <davem@xxxxxxxxxxxxx>;
> Jakub Kicinski <kuba@xxxxxxxxxx>; moderated list:INTEL ETHERNET DRIVERS"
> <intel-wired-lan@xxxxxxxxxxxxxxxx>, open list <linux-kernel@xxxxxxxxxxxxxxx>
> Subject: Re: [PATCH net] ice: Fix race condition during interface enslave
>
> On Thu, 10 Mar 2022 17:48:16 +0000
> "Ertman, David M" <david.m.ertman@xxxxxxxxx> wrote:
>
> > This only addresses one case of unplugging the auxiliary bus. Rather than
> controlling one instance of
> > calling ice_unplig_aux_dev(), it seems like it would be better to modify
> ice_unplug_aux_dev so that it
> > will pause until any plugging is done by the service task (check for the pf-
> >flag bit and wait until it clears
> > before progressing).
>
> You cannot wait in ice_unplug_aux_dev() for ICE_FLAG_PLUG_AUX_DEV to
> be cleared because
> ice_clear_rdma_cap() is called under RTNL.
> This patch is a counter part for commit 5dbbbd01cbba83 ("ice: Avoid RTNL
> lock when
> re-creating auxiliary device") that eliminates ice_plug_aux() and fixed first
> part
> of deadlock and this patch fixes a second part and eliminates also
> ice_unplug_aux_dev()
> to be called under RTNL.
>
> Thanks,
> Ivan

You are correct. I forgot about the RTNL context!

With this in mind - I agree with your approach.

Reviewed-by: Dave Ertman <david.m.ertman@xxxxxxxxx>