[v2,net-next] i40e: stop VF rings
diff mbox

Message ID 1428431575-168522-1-git-send-email-mitch.a.williams@intel.com
State Accepted
Delegated to: Jeff Kirsher
Headers show

Commit Message

Mitch Williams April 7, 2015, 6:32 p.m. UTC
Explicitly stop the rings belonging to each VF when disabling SR-IOV.
Even though the VFs were gone, and the associated VSIs were removed,
the rings were not stopped, and in some circumstances the hardware would
continue to access the memory formerly used by the rings, causing
memory corruption or DMAR errors, both of which would lead to general
malaise of the kernel.

To relieve this condition, explicitly stop all the rings associated with
each VF before releasing its resources.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
v2: use correct variable name (changed in a different patch)
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Rose, Gregory V April 7, 2015, 6:38 p.m. UTC | #1
Looks good but maybe a comment too?

Your call.

ACK

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces@lists.osuosl.org] On
> Behalf Of Mitch Williams
> Sent: Tuesday, April 07, 2015 11:33 AM
> To: intel-wired-lan@lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH v2 net-next] i40e: stop VF rings
> 
> Explicitly stop the rings belonging to each VF when disabling SR-IOV.
> Even though the VFs were gone, and the associated VSIs were removed, the
> rings were not stopped, and in some circumstances the hardware would
> continue to access the memory formerly used by the rings, causing memory
> corruption or DMAR errors, both of which would lead to general malaise of
> the kernel.
> 
> To relieve this condition, explicitly stop all the rings associated with
> each VF before releasing its resources.
> 
> Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
> v2: use correct variable name (changed in a different patch)
> ---
>  drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
> b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
> index 4d69e1f..20ae88b 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
> @@ -733,6 +733,11 @@ void i40e_free_vfs(struct i40e_pf *pf)
>  	while (test_and_set_bit(__I40E_VF_DISABLE, &pf->state))
>  		usleep_range(1000, 2000);
> 
> +	for (i = 0; i < pf->num_alloc_vfs; i++)
> +		if (test_bit(I40E_VF_STAT_INIT, &pf->vf[i].vf_states))
> +			i40e_vsi_control_rings(pf->vsi[pf->vf[i].lan_vsi_idx],
> +					       false);
> +
>  	/* Disable IOV before freeing resources. This lets any VF drivers
>  	 * running in the host get themselves cleaned up before we yank
>  	 * the carpet out from underneath their feet.
> --
> 2.1.0
> 
> _______________________________________________
> Intel-wired-lan mailing list
> Intel-wired-lan@lists.osuosl.org
> http://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Jeff Kirsher April 7, 2015, 10:58 p.m. UTC | #2
On Tue, 2015-04-07 at 11:32 -0700, Mitch Williams wrote:
> Explicitly stop the rings belonging to each VF when disabling SR-IOV.
> Even though the VFs were gone, and the associated VSIs were removed,
> the rings were not stopped, and in some circumstances the hardware
> would
> continue to access the memory formerly used by the rings, causing
> memory corruption or DMAR errors, both of which would lead to general
> malaise of the kernel.
> 
> To relieve this condition, explicitly stop all the rings associated
> with
> each VF before releasing its resources.
> 
> Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
> v2: use correct variable name (changed in a different patch)
> ---
>  drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 5 +++++
>  1 file changed, 5 insertions(+)

Thanks Mitch, I have updated my queue with your patch.

Patch
diff mbox

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 4d69e1f..20ae88b 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -733,6 +733,11 @@  void i40e_free_vfs(struct i40e_pf *pf)
 	while (test_and_set_bit(__I40E_VF_DISABLE, &pf->state))
 		usleep_range(1000, 2000);
 
+	for (i = 0; i < pf->num_alloc_vfs; i++)
+		if (test_bit(I40E_VF_STAT_INIT, &pf->vf[i].vf_states))
+			i40e_vsi_control_rings(pf->vsi[pf->vf[i].lan_vsi_idx],
+					       false);
+
 	/* Disable IOV before freeing resources. This lets any VF drivers
 	 * running in the host get themselves cleaned up before we yank
 	 * the carpet out from underneath their feet.