Skip to contentSkip to conversation

iavf: Fix race in init state

PATCH New Mateusz Palczewski 2 participants 2 messages Feb 23, 2022 – Feb 25, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 5/8 iavf: Fix race in init state

From: SlawomirX Laba <[email protected]>

When iavf_init_version_check sends VIRTCHNL_OP_GET_VF_RESOURCES message, the driver will wait for the response after requeueing the watchdog task in iavf_init_get_resources call stack. The logic is implemented this way that iavf_init_get_resources has to be called in order to allocate adapter->vf_res. It is polling for the AQ response in iavf_get_vf_config function. Expect a call trace from kernel when adminq_task worker handles this message first. adapter->vf_res will be NULL in iavf_virtchnl_completion.

Make the watchdog task not queue the adminq_task if the init process is not finished yet.

Fixes 898ef1cb1cb2 ("iavf: Combine init and watchdog state machines")
---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +2 -1
index 67349d2..36433d6 100644
@@ -2532,7 +2532,8 @@ static void iavf_watchdog_task(struct work_struct *work)
 	schedule_delayed_work(&adapter->client_task, msecs_to_jiffies(5));
 	mutex_unlock(&adapter->crit_lock);
 restart_watchdog:
-	queue_work(iavf_wq, &adapter->adminq_task);
+	if (adapter->state >= __IAVF_DOWN)
+		queue_work(iavf_wq, &adapter->adminq_task);
 	if (adapter->aq_required)
 		queue_delayed_work(iavf_wq, &adapter->watchdog_task,
 				   msecs_to_jiffies(20));
Signature · 1 line
2.27.0
#1 lore raw

PATCH 5/8 iavf: Fix race in init state

drivers/net/ethernet/intel/iavf/iavf_main.c static void iavf_watchdog_task(struct work_struct

Quoted 40 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Mateusz Palczewski
Sent: Wednesday, February 23, 2022 1:38 PM
To: intel-wired-lan at lists.osuosl.org
Cc: Laba, SlawomirX <[email protected]>; Burra, Phani R <[email protected]>; Palczewski, Mateusz <[email protected]>
Subject: [Intel-wired-lan] [PATCH net v1 5/8] iavf: Fix race in init state

From: SlawomirX Laba <[email protected]>

When iavf_init_version_check sends VIRTCHNL_OP_GET_VF_RESOURCES message, the driver will wait for the response after requeueing the watchdog task in iavf_init_get_resources call stack. The logic is implemented this way that iavf_init_get_resources has to be called in order to allocate adapter->vf_res. It is polling for the AQ response in iavf_get_vf_config function. Expect a call trace from kernel when adminq_task worker handles this message first. adapter->vf_res will be NULL in iavf_virtchnl_completion.

Make the watchdog task not queue the adminq_task if the init process is not finished yet.

Fixes 898ef1cb1cb2 ("iavf: Combine init and watchdog state machines")
---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +0 -0
index 67349d2..36433d6 100644
@@ -2532,7 +2532,8 @@ static void iavf_watchdog_task(struct work_struct