pds_core: error handling fixes
Subsystems (3)
cover pds_core: error handling fixes
Some fixes for better handling of broken states.
Shannon Nelson (5):
pds_core: protect devlink callbacks from fw_down state
pds_core: no health reporter in VF
pds_core: no reset command for VF
pds_core: check for work queue before use
pds_core: pass opcode to devcmd_wait
drivers/net/ethernet/amd/pds_core/core.c | 11 +++++++---- drivers/net/ethernet/amd/pds_core/dev.c | 9 +++------ drivers/net/ethernet/amd/pds_core/devlink.c | 3 +++ 3 files changed, 13 insertions(+), 10 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/5 pds_core: protect devlink callbacks from fw_down state
Don't access structs that have been cleared when in the fw_down state and the various structs have been cleaned and are waiting to recover. This caused a panic on rmmod when already in fw_down and devlink_param_unregister() tried to check the parameters.
--- drivers/net/ethernet/amd/pds_core/devlink.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/amd/pds_core/devlink.c +3 -0
@@ -10,6 +10,9 @@ pdsc_viftype *pdsc_dl_find_viftype_by_id(struct pdsc *pdsc, {int vt; +if (!pdsc->viftype_status) +return NULL ; +for (vt =0 ; vt <PDS_DEV_TYPE_MAX ; vt++) {if (pdsc->viftype_status[vt].dl_id == dl_id)return &pdsc->viftype_status[vt];
Signature · 1 line
2.17.1
PATCH 2/5 pds_core: no health reporter in VF
In reply to Shannon NelsonMake sure the health reporter is set up before we use it in our devlink health updates, especially since the VF doesn't set up the health reporter.
--- drivers/net/ethernet/amd/pds_core/core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/ethernet/amd/pds_core/core.c +5 -3
@@ -524,7 +524,8 @@ static void pdsc_fw_down(struct pdsc *pdsc) }/* Notify clients of fw_down */ -devlink_health_report (pdsc->fw_reporter,"FW down reported" , pdsc); +if (pdsc->fw_reporter) +devlink_health_report (pdsc->fw_reporter,"FW down reported" , pdsc);pdsc_notify (PDS_EVENT_RESET , &reset_event);pdsc_stop (pdsc);
@@ -554,8 +555,9 @@ static void pdsc_fw_up(struct pdsc *pdsc)/* Notify clients of fw_up */ pdsc->fw_recoveries++; -devlink_health_reporter_state_update (pdsc->fw_reporter, -DEVLINK_HEALTH_REPORTER_STATE_HEALTHY ); +if (pdsc->fw_reporter) +devlink_health_reporter_state_update (pdsc->fw_reporter, +DEVLINK_HEALTH_REPORTER_STATE_HEALTHY );pdsc_notify (PDS_EVENT_RESET , &reset_event);return ;
Signature · 1 line
2.17.1
PATCH 3/5 pds_core: no reset command for VF
In reply to Shannon NelsonThe VF doesn't need to send a reset command, and in a PCI reset scenario it might not have a valid IO space to write to anyway.
--- drivers/net/ethernet/amd/pds_core/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/amd/pds_core/core.c +2 -1
@@ -464,7 +464,8 @@ void pdsc_teardown(struct pdsc *pdsc, bool removing) {int i; -pdsc_devcmd_reset (pdsc); +if (!pdsc->pdev->is_virtfn) +pdsc_devcmd_reset (pdsc);pdsc_qcq_free (pdsc, &pdsc->notifyqcq);pdsc_qcq_free (pdsc, &pdsc->adminqcq);
Signature · 1 line
2.17.1
PATCH 4/5 pds_core: check for work queue before use
In reply to Shannon NelsonAdd a check that the wq exists before queuing up work for a failed devcmd, as the PF is responsible for health and the VF doesn't have a wq.
--- drivers/net/ethernet/amd/pds_core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/amd/pds_core/dev.c +1 -1
@@ -183,7 +183,7 @@ int pdsc_devcmd_locked(struct pdsc *pdsc, union pds_core_dev_cmd *cmd, err =pdsc_devcmd_wait (pdsc, max_seconds);memcpy_fromio (comp, &pdsc->cmd_regs->comp,sizeof (*comp)); -if (err == -ENXIO || err == -ETIMEDOUT ) +if ((err == -ENXIO || err == -ETIMEDOUT ) && pdsc->wq)queue_work (pdsc->wq, &pdsc->health_work);return err;
Signature · 1 line
2.17.1
PATCH 5/5 pds_core: pass opcode to devcmd_wait
In reply to Shannon NelsonDon't rely on the PCI memory for the devcmd opcode because we read a 0xff value if the PCI bus is broken, which can cause us to report a bogus dev_cmd opcode later.
--- drivers/net/ethernet/amd/pds_core/dev.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/net/ethernet/amd/pds_core/dev.c +2 -5
@@ -121,7 +121,7 @@ static const char *pdsc_devcmd_str(int opcode) } } -static int pdsc_devcmd_wait (struct pdsc *pdsc,int max_seconds) +static int pdsc_devcmd_wait (struct pdsc *pdsc,u8 opcode,int max_seconds) {struct device *dev = pdsc->dev;unsigned long start_time;
@@ -131,9 +131,6 @@ static int pdsc_devcmd_wait(struct pdsc *pdsc, int max_seconds)int done =0 ;int err =0 ;int status; -int opcode; - - opcode =ioread8 (&pdsc->cmd_regs->cmd.opcode); start_time = jiffies; max_wait = start_time + (max_seconds *HZ );
@@ -180,7 +177,7 @@ int pdsc_devcmd_locked(struct pdsc *pdsc, union pds_core_dev_cmd *cmd,memcpy_toio (&pdsc->cmd_regs->cmd, cmd,sizeof (*cmd));pdsc_devcmd_dbell (pdsc); - err =pdsc_devcmd_wait (pdsc, max_seconds); + err =pdsc_devcmd_wait (pdsc, cmd->opcode, max_seconds);memcpy_fromio (comp, &pdsc->cmd_regs->comp,sizeof (*comp));if ((err == -ENXIO || err == -ETIMEDOUT ) && pdsc->wq)
Signature · 1 line
2.17.1
Quoted 9 lines · Shannon Nelson
Some fixes for better handling of broken states.
Shannon Nelson (5):
pds_core: protect devlink callbacks fromfw_downstate
pds_core: no health reporter in VF
pds_core: no reset command for VF
pds_core: check for work queue before use
pds_core: pass opcode todevcmd_wait
Quoted 4 lines
drivers/net/ethernet/amd/pds_core/core.c | 11 +++++++---- drivers/net/ethernet/amd/pds_core/dev.c | 9 +++------ drivers/net/ethernet/amd/pds_core/devlink.c | 3 +++ 3 files changed, 13 insertions(+), 10 deletions(-)
For series,
This series was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Thu, 24 Aug 2023 09:17:49 -0700 you wrote:
Some fixes for better handling of broken states.
Shannon Nelson (5):
pds_core: protect devlink callbacks fromfw_downstate
pds_core: no health reporter in VF
pds_core: no reset command for VF
pds_core: check for work queue before use
pds_core: pass opcode todevcmd_wait[...]
Here is the summary with links:
- [net,1/5] pds_core: protect devlink callbacks from fw_down state
https://git.kernel.org/netdev/net/c/91202ce78fcd - [net,2/5] pds_core: no health reporter in VF https://git.kernel.org/netdev/net/c/e48b894a1db7 - [net,3/5] pds_core: no reset command for VF https://git.kernel.org/netdev/net/c/95e383226d6f - [net,4/5] pds_core: check for work queue before use https://git.kernel.org/netdev/net/c/969cfd4c8ca5 - [net,5/5] pds_core: pass opcode to devcmd_wait https://git.kernel.org/netdev/net/c/0ea064e74bc8
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html