Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mateusz Palczewski <mateusz.palczewski@intel.com>
To: intel-wired-lan@lists.osuosl.org
Cc: ivecera@redhat.com
Subject: [Intel-wired-lan] [PATCH iwl-net v10 2/5] Revert "iavf: Detach device during reset task"
Date: Mon,  5 Jun 2023 10:52:23 -0400	[thread overview]
Message-ID: <20230605145226.1222225-3-mateusz.palczewski@intel.com> (raw)
In-Reply-To: <20230605145226.1222225-1-mateusz.palczewski@intel.com>

From: Marcin Szycik <marcin.szycik@linux.intel.com>

This reverts commit aa626da947e9cd30c4cf727493903e1adbb2c0a0.

Detaching device during reset was not fully fixing the rtnl locking issue,
as there could be a situation where callback was already in progress before
detaching netdev.

Furthermore, detaching netdevice causes TX timeouts if traffic is running.
To reproduce:

ip netns exec ns1 iperf3 -c $PEER_IP -t 600 --logfile /dev/null &
while :; do
        for i in 200 7000 400 5000 300 3000 ; do
		ip netns exec ns1 ip link set $VF1 mtu $i
                sleep 2
        done
        sleep 10
done

Currently, callbacks such as iavf_change_mtu() wait for the reset.
If the reset fails to acquire the rtnl_lock, they schedule the netdev
update for later while continuing the reset flow. Operations like MTU
changes are performed under the rtnl_lock. Therefore, when the operation
finishes, another callback that uses rtnl_lock can start.

Signed-off-by: Dawid Wesierski <dawidx.wesierski@intel.com>
Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
---
v1->v7: no changes
v8: changed commit msg
v9->v10: no changes
---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
index c815ef87e27d..6945f462c56e 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_main.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
@@ -2991,11 +2991,6 @@ static void iavf_reset_task(struct work_struct *work)
 	int i = 0, err;
 	bool running;
 
-	/* Detach interface to avoid subsequent NDO callbacks */
-	rtnl_lock();
-	netif_device_detach(netdev);
-	rtnl_unlock();
-
 	/* When device is being removed it doesn't make sense to run the reset
 	 * task, just return in such a case.
 	 */
@@ -3003,7 +2998,7 @@ static void iavf_reset_task(struct work_struct *work)
 		if (adapter->state != __IAVF_REMOVE)
 			queue_work(adapter->wq, &adapter->reset_task);
 
-		goto reset_finish;
+		return;
 	}
 
 	while (!mutex_trylock(&adapter->client_lock))
@@ -3206,7 +3201,7 @@ static void iavf_reset_task(struct work_struct *work)
 	mutex_unlock(&adapter->client_lock);
 	mutex_unlock(&adapter->crit_lock);
 
-	goto reset_finish;
+	return;
 reset_err:
 	if (running) {
 		set_bit(__IAVF_VSI_DOWN, adapter->vsi.state);
@@ -3227,10 +3222,6 @@ static void iavf_reset_task(struct work_struct *work)
 	}
 
 	dev_err(&adapter->pdev->dev, "failed to allocate resources during reinit\n");
-reset_finish:
-	rtnl_lock();
-	netif_device_attach(netdev);
-	rtnl_unlock();
 }
 
 /**
-- 
2.31.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

  parent reply	other threads:[~2023-06-05 14:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-05 14:52 [Intel-wired-lan] [PATCH iwl-net v10 0/5] iavf: fix reset task deadlock Mateusz Palczewski
2023-06-05 14:52 ` [Intel-wired-lan] [PATCH iwl-net v10 1/5] iavf: Wait for reset in callbacks which trigger it Mateusz Palczewski
2023-06-15 15:17   ` Romanowski, Rafal
2023-06-05 14:52 ` Mateusz Palczewski [this message]
2023-06-15 15:28   ` [Intel-wired-lan] [PATCH iwl-net v10 2/5] Revert "iavf: Detach device during reset task" Romanowski, Rafal
2023-06-05 14:52 ` [Intel-wired-lan] [PATCH iwl-net v10 3/5] Revert "iavf: Do not restart Tx queues after reset task failure" Mateusz Palczewski
2023-06-15 15:28   ` Romanowski, Rafal
2023-06-05 14:52 ` [Intel-wired-lan] [PATCH iwl-net v10 4/5] iavf: fix a deadlock caused by rtnl and driver's lock circular dependencies Mateusz Palczewski
2023-06-15 15:27   ` Romanowski, Rafal
2023-06-05 14:52 ` [Intel-wired-lan] [PATCH iwl-net v10 5/5] iavf: fix reset task race with iavf_remove() Mateusz Palczewski
2023-06-15 15:21   ` Romanowski, Rafal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230605145226.1222225-3-mateusz.palczewski@intel.com \
    --to=mateusz.palczewski@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=ivecera@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox