[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CO1PR11MB5089EE31C5E298306B8BF7A5D6659@CO1PR11MB5089.namprd11.prod.outlook.com>
Date: Wed, 26 Apr 2023 16:22:25 +0000
From: "Keller, Jacob E" <jacob.e.keller@...el.com>
To: Leon Romanovsky <leon@...nel.org>,
"Nguyen, Anthony L" <anthony.l.nguyen@...el.com>
CC: "davem@...emloft.net" <davem@...emloft.net>,
"kuba@...nel.org" <kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"Wesierski, DawidX" <dawidx.wesierski@...el.com>,
"Maziarz, Kamil" <kamil.maziarz@...el.com>,
"Romanowski, Rafal" <rafal.romanowski@...el.com>
Subject: RE: [PATCH net 2/3] ice: Fix ice VF reset during iavf initialization
> -----Original Message-----
> From: Leon Romanovsky <leon@...nel.org>
> Sent: Tuesday, April 25, 2023 11:50 PM
> To: Nguyen, Anthony L <anthony.l.nguyen@...el.com>
> Cc: davem@...emloft.net; kuba@...nel.org; pabeni@...hat.com;
> edumazet@...gle.com; netdev@...r.kernel.org; Wesierski, DawidX
> <dawidx.wesierski@...el.com>; Maziarz, Kamil <kamil.maziarz@...el.com>;
> Keller, Jacob E <jacob.e.keller@...el.com>; Romanowski, Rafal
> <rafal.romanowski@...el.com>
> Subject: Re: [PATCH net 2/3] ice: Fix ice VF reset during iavf initialization
>
> On Tue, Apr 25, 2023 at 10:01:26AM -0700, Tony Nguyen wrote:
> > From: Dawid Wesierski <dawidx.wesierski@...el.com>
> >
> > Fix the current implementation that causes ice_trigger_vf_reset()
> > to start resetting the VF even when the VF is still resetting itself
> > and initializing adminq. This leads to a series of -53 errors
> > (failed to init adminq) from the IAVF.
> >
> > Change the state of the vf_state field to be not active when the IAVF
> > asks for a reset. To avoid issues caused by the VF being reset too
> > early, make sure to wait until receiving the message on the message
> > box to know the exact state of the IAVF driver.
> >
> > Fixes: c54d209c78b8 ("ice: Wait for VF to be reset/ready before configuration")
> > Signed-off-by: Dawid Wesierski <dawidx.wesierski@...el.com>
> > Signed-off-by: Kamil Maziarz <kamil.maziarz@...el.com>
> > Acked-by: Jacob Keller <Jacob.e.keller@...el.com>
> > Tested-by: Rafal Romanowski <rafal.romanowski@...el.com>
> > Signed-off-by: Tony Nguyen <anthony.l.nguyen@...el.com>
> > ---
> > drivers/net/ethernet/intel/ice/ice_sriov.c | 8 ++++----
> > drivers/net/ethernet/intel/ice/ice_vf_lib.c | 19 +++++++++++++++++++
> > drivers/net/ethernet/intel/ice/ice_vf_lib.h | 1 +
> > drivers/net/ethernet/intel/ice/ice_virtchnl.c | 1 +
> > 4 files changed, 25 insertions(+), 4 deletions(-)
>
> <...>
>
> > - ret = ice_check_vf_ready_for_cfg(vf);
> > + ret = ice_check_vf_ready_for_reset(vf);
> > if (ret)
> > goto out_put_vf;
>
> <...>
>
> > +/**
> > + * ice_check_vf_ready_for_reset - check if VF is ready to be reset
> > + * @vf: VF to check if it's ready to be reset
> > + *
> > + * The purpose of this function is to ensure that the VF is not in reset,
> > + * disabled, and is both initialized and active, thus enabling us to safely
> > + * initialize another reset.
> > + */
> > +int ice_check_vf_ready_for_reset(struct ice_vf *vf)
> > +{
> > + int ret;
> > +
> > + ret = ice_check_vf_ready_for_cfg(vf);
> > + if (!ret && !test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states))
> > + ret = -EAGAIN;
>
> I don't know your driver enough to say how it is it possible to find VF
> "resetting itself" and PF trying to reset VF at the same time.
>
VF can request a reset via virtchnl, and the PF can request a reset due to system administration activity such as changing a configuration.
> But what I see is that ICE_VF_STATE_ACTIVE bit check is racy and you
> don't really fix the root cause of calling to reset without proper locking.
>
I think there's some confusing re-use of words going on in the commit message. It describes what the VF does while recovering and re-initializing from a reset. I think the goal is to prevent starting another reset until the first one has recovered. I am not sure we can use a standard lock here because we likely do want to be able to recover if the VF driver doesn't respond in a sufficient time.
I don't know exactly what problem this commit claims to fix.
> Thanks
>
> > +
> > + return ret;
> > +}
>
> <...>
>
> > case VIRTCHNL_OP_RESET_VF:
> > + clear_bit(ICE_VF_STATE_ACTIVE, vf->vf_states);
> > ops->reset_vf(vf);
> > break;
> > case VIRTCHNL_OP_ADD_ETH_ADDR:
> > --
> > 2.38.1
> >
Powered by blists - more mailing lists