[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210813172033.2c5c9101@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Fri, 13 Aug 2021 17:20:33 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Tony Nguyen <anthony.l.nguyen@...el.com>
Cc: davem@...emloft.net, Ken Cox <jkc@...hat.com>,
netdev@...r.kernel.org,
Anirudh Venkataramanan <anirudh.venkataramanan@...el.com>,
Marek Szlosek <marek.szlosek@...el.com>
Subject: Re: [PATCH net 1/1] ixgbe: Add locking to prevent panic when
setting sriov_numvfs to zero
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.
Powered by blists - more mailing lists