[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <31f33e9ced63115b66ede5ff1e385105be076f15.camel@intel.com>
Date: Mon, 16 Aug 2021 17:52:43 +0000
From: "Nguyen, Anthony L" <anthony.l.nguyen@...el.com>
To: "kuba@...nel.org" <kuba@...nel.org>
CC: "jkc@...hat.com" <jkc@...hat.com>,
"Szlosek, Marek" <marek.szlosek@...el.com>,
"Yang, Lihong" <lihong.yang@...el.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"Venkataramanan, Anirudh" <anirudh.venkataramanan@...el.com>
Subject: Re: [PATCH net 1/1] ixgbe: Add locking to prevent panic when setting
sriov_numvfs to zero
On Fri, 2021-08-13 at 17:20 -0700, Jakub Kicinski wrote:
> On Thu, 12 Aug 2021 10:18:56 -0700 Tony Nguyen wrote:
> > diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
> > b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
> > index 214a38de3f41..0a1a8756f1fd 100644
> > --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
> > +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
> > @@ -206,8 +206,12 @@ int ixgbe_disable_sriov(struct ixgbe_adapter
> > *adapter)
> > unsigned int num_vfs = adapter->num_vfs, vf;
> > int rss;
> >
> > + while (test_and_set_bit(__IXGBE_DISABLING_VFS, &adapter-
> > >state))
> > + usleep_range(1000, 2000);
> > +
> > /* set num VFs to 0 to prevent access to vfinfo */
> > adapter->num_vfs = 0;
> > + clear_bit(__IXGBE_DISABLING_VFS, &adapter->state);
> >
> > /* put the reference to all of the vf devices */
> > for (vf = 0; vf < num_vfs; ++vf) {
> > @@ -1307,6 +1311,9 @@ void ixgbe_msg_task(struct ixgbe_adapter
> > *adapter)
> > struct ixgbe_hw *hw = &adapter->hw;
> > u32 vf;
> >
> > + if (test_and_set_bit(__IXGBE_DISABLING_VFS, &adapter->state))
> > + return;
> > +
> > for (vf = 0; vf < adapter->num_vfs; vf++) {
> > /* process any reset requests */
> > if (!ixgbe_check_for_rst(hw, vf))
> > @@ -1320,6 +1327,7 @@ void ixgbe_msg_task(struct ixgbe_adapter
> > *adapter)
> > if (!ixgbe_check_for_ack(hw, vf))
> > ixgbe_rcv_ack_from_vf(adapter, vf);
> > }
> > + clear_bit(__IXGBE_DISABLING_VFS, &adapter->state);
>
> Like I've already said two or three times. No flag based locking.
Ken,
Did you want to make this change or did you want Intel to do it?
Thanks,
Tony
Powered by blists - more mailing lists