mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 00:10:51 +07:00
i40e: Fix kernel oops when i40e driver removes VF's
[ Upstream commit 347b5650cd158d1d953487cc2bec567af5c5bf96 ]
Fix the reason of kernel oops when i40e driver removed VFs.
Added new __I40E_VFS_RELEASING state to signalize releasing
process by PF, that it makes possible to exit of reset VF procedure.
Without this patch, it is possible to suspend the VFs reset by
releasing VFs resources procedure. Retrying the reset after the
timeout works on the freed VF memory causing a kernel oops.
Fixes: d43d60e5eb
("i40e: ensure reset occurs when disabling VF")
Signed-off-by: Eryk Rybak <eryk.roch.rybak@intel.com>
Signed-off-by: Grzegorz Szczurek <grzegorzx.szczurek@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
9856607c9c
commit
3cc4db1213
@ -142,6 +142,7 @@ enum i40e_state_t {
|
||||
__I40E_VIRTCHNL_OP_PENDING,
|
||||
__I40E_RECOVERY_MODE,
|
||||
__I40E_VF_RESETS_DISABLED, /* disable resets during i40e_remove */
|
||||
__I40E_VFS_RELEASING,
|
||||
/* This must be last as it determines the size of the BITMAP */
|
||||
__I40E_STATE_SIZE__,
|
||||
};
|
||||
|
@ -137,6 +137,7 @@ void i40e_vc_notify_vf_reset(struct i40e_vf *vf)
|
||||
**/
|
||||
static inline void i40e_vc_disable_vf(struct i40e_vf *vf)
|
||||
{
|
||||
struct i40e_pf *pf = vf->pf;
|
||||
int i;
|
||||
|
||||
i40e_vc_notify_vf_reset(vf);
|
||||
@ -147,6 +148,11 @@ static inline void i40e_vc_disable_vf(struct i40e_vf *vf)
|
||||
* ensure a reset.
|
||||
*/
|
||||
for (i = 0; i < 20; i++) {
|
||||
/* If PF is in VFs releasing state reset VF is impossible,
|
||||
* so leave it.
|
||||
*/
|
||||
if (test_bit(__I40E_VFS_RELEASING, pf->state))
|
||||
return;
|
||||
if (i40e_reset_vf(vf, false))
|
||||
return;
|
||||
usleep_range(10000, 20000);
|
||||
@ -1574,6 +1580,8 @@ void i40e_free_vfs(struct i40e_pf *pf)
|
||||
|
||||
if (!pf->vf)
|
||||
return;
|
||||
|
||||
set_bit(__I40E_VFS_RELEASING, pf->state);
|
||||
while (test_and_set_bit(__I40E_VF_DISABLE, pf->state))
|
||||
usleep_range(1000, 2000);
|
||||
|
||||
@ -1631,6 +1639,7 @@ void i40e_free_vfs(struct i40e_pf *pf)
|
||||
}
|
||||
}
|
||||
clear_bit(__I40E_VF_DISABLE, pf->state);
|
||||
clear_bit(__I40E_VFS_RELEASING, pf->state);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PCI_IOV
|
||||
|
Loading…
Reference in New Issue
Block a user