e1000e: Replace schedule_work with delayed workqueue for watchdog.
Subsystems (3)
PATCH 1/1 e1000e: Replace schedule_work with delayed workqueue for watchdog.
From: Jagadeesh <[email protected]>
Replace direct schedule_work() usage with queue_delayed_work() to allow better timing control for the watchdog task. This resolves potential race conditions during interface reset operations.
- Added watchdog_wq workqueue_struct and watchdog_dq delayed_work
- Updated e1000_watchdog() to use queue_delayed_work()
- Removed obsolete TODO comment about delayed workqueue
Tested in Qemu :
/ # for i in {1..1000}; do
> echo 1 > /sys/class/net/eth0/device/reset
> sleep 0.1
> done
[ 726.357499] e1000e 0000:00:02.0: resetting [ 726.390737] e1000e 0000:00:02.0: reset done
--- drivers/net/ethernet/intel/e1000e/e1000.h | 2 ++ drivers/net/ethernet/intel/e1000e/netdev.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/e1000e/e1000.h +2 -0
@@ -194,6 +194,8 @@ struct e1000_adapter {struct timer_list blink_timer;struct work_struct reset_task; +struct workqueue_struct *watchdog_wq; +struct delayed_work watchdog_dq;struct work_struct watchdog_task;const struct e1000_info *ei;
drivers/net/ethernet/intel/e1000e/netdev.c +1 -2
@@ -5178,9 +5178,8 @@ static void e1000_watchdog(struct timer_list *t)struct e1000_adapter *adapter =from_timer (adapter, t, watchdog_timer);/* Do the rest outside of interrupt context */ -schedule_work (&adapter->watchdog_task); +queue_delayed_work (adapter->watchdog_wq, &adapter->watchdog_dq,0 ); -/* TODO: make this use queue_delayed_work() */ }static void e1000_watchdog_task (struct work_struct *work)
Signature · 1 line
2.43.0
Przemek Kitszel
maintainerQuoted 18 lines · Jagadeesh Yalapalli
From: Jagadeesh <[email protected]>
Replace direct
schedule_work()usage withqueue_delayed_work()to allow better timing control for the watchdog task. This resolves potential race conditions during interface reset operations.- Added
watchdog_wqworkqueue_structandwatchdog_dqdelayed_work
- Updatede1000_watchdog()to usequeue_delayed_work()
- Removed obsolete TODO comment about delayed workqueueTested in Qemu :
/ # for i in {1..1000}; do
> echo 1 >/sys/class/net/eth0/device/reset
> sleep 0.1
> done
[ 726.357499] e1000e 0000:00:02.0: resetting [ 726.390737] e1000e 0000:00:02.0: reset done
Quoted 1 line
Signed-off-by Jagadeesh <[email protected]>
Thank you for your contribution.
Please use at least two parts for the author and signoff
Quoted 23 lines
--- drivers/net/ethernet/intel/e1000e/e1000.h | 2 ++ drivers/net/ethernet/intel/e1000e/netdev.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-)drivers/net/ethernet/intel/e1000e/e1000.h +2
-0@@ -194,6 +194,8 @@ struct e1000_adapter {struct timer_list blink_timer;struct work_struct reset_task; +struct workqueue_struct *watchdog_wq; +struct delayed_work watchdog_dq;struct work_struct watchdog_task;const struct e1000_info *ei;drivers/net/ethernet/intel/e1000e/netdev.c +0
-0
drivers/net/ethernet/intel/e1000e/netdev.c static void e1000_watchdog(struct timer_list *t) · line 5181
Quoted 5 lines
drivers/net/ethernet/intel/e1000e/netdev.c +1
-1@@ -5178,9 +5178,8 @@ static void e1000_watchdog(struct timer_list *t)struct e1000_adapter *adapter =from_timer (adapter, t, watchdog_timer);/* Do the rest outside of interrupt context */ -schedule_work (&adapter->watchdog_task); +queue_delayed_work (adapter->watchdog_wq, &adapter->watchdog_dq,0 );
there is no much point in using queue_delayed_work() with the delay of 0
please also note that the last commit touching this function was essentially just reverting the use of delayed work, see commit d5ad7a6a7f3c ("e1000e: Revert "e1000e: Make watchdog use delayed work"")
would be best to understand what was wrong with the reverted commit
Quoted 5 lines
drivers/net/ethernet/intel/e1000e/netdev.c +0
-1-/* TODO: make this use queue_delayed_work() */ }static void e1000_watchdog_task (struct work_struct *work)
Dear Jagadeesh,
Thank you for your patch.
Am 08.05.25 um 08:14 schrieb Jagadeesh Yalapalli:
Quoted 1 line
From: Jagadeesh <[email protected]>
Is this your full name, or should *Jagadeesh Yalapalli* be used?
git config --global user.name "Jagadeesh Yalapalli"
Quoted 4 lines
Replace direct
schedule_work()usage withqueue_delayed_work()to allow better timing control for the watchdog task. This resolves potential race conditions during interface reset operations.
What error do you get (without your patch)?
Quoted 11 lines
- Added
watchdog_wqworkqueue_structandwatchdog_dqdelayed_work
- Updatede1000_watchdog()to usequeue_delayed_work()
- Removed obsolete TODO comment about delayed workqueueTested in Qemu :
/ # for i in {1..1000}; do
> echo 1 >/sys/class/net/eth0/device/reset
> sleep 0.1
> done
[ 726.357499] e1000e 0000:00:02.0: resetting [ 726.390737] e1000e 0000:00:02.0: reset done
Please do not copy the output of git show, but send the patch with git format-patch and git send-email.
Quoted 24 lines
Signed-off-by Jagadeesh <[email protected]>--- drivers/net/ethernet/intel/e1000e/e1000.h | 2 ++ drivers/net/ethernet/intel/e1000e/netdev.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-)drivers/net/ethernet/intel/e1000e/e1000.h +2
-0@@ -194,6 +194,8 @@ struct e1000_adapter {struct timer_list blink_timer;struct work_struct reset_task; +struct workqueue_struct *watchdog_wq; +struct delayed_work watchdog_dq;struct work_struct watchdog_task;const struct e1000_info *ei;drivers/net/ethernet/intel/e1000e/netdev.c +0
-0
drivers/net/ethernet/intel/e1000e/netdev.c static void e1000_watchdog(struct timer_list *t) · line 5185
Quoted 10 lines
drivers/net/ethernet/intel/e1000e/netdev.c +1
-2@@ -5178,9 +5178,8 @@ static void e1000_watchdog(struct timer_list *t)struct e1000_adapter *adapter =from_timer (adapter, t, watchdog_timer);/* Do the rest outside of interrupt context */ -schedule_work (&adapter->watchdog_task); +queue_delayed_work (adapter->watchdog_wq, &adapter->watchdog_dq,0 ); -/* TODO: make this use queue_delayed_work() */ }static void e1000_watchdog_task (struct work_struct *work)
Kind regards,
Paul
Thanks for feedback.
Resolved the naming convention of Author/signoff part,
Check After previously reverted or rejected patches. understand the impact of usage of "queue_delayed_work" functions in watchdog related routines.
Impact : (59653e6497d1: e1000e: Make
watchdog use delayed work). This was resulted in driver crashes and connections to reset unexpectedly.
May be There is no proper synchronization for above patch changes.
Thanks & Regards,
Jagadeesh Yalapalli.
Quoted 78 lines · Paul Menzel
Dear Jagadeesh,
Thank you for your patch.
Am 08.05.25 um 08:14 schrieb Jagadeesh Yalapalli:
Quoted 1 line
From: Jagadeesh <[email protected]>
Is this your full name, or should *Jagadeesh Yalapalli* be used?
git config --global user.name "Jagadeesh Yalapalli"Quoted 2 lines
Replace direct
schedule_work()usage withqueue_delayed_work()toallow
Quoted 2 lines
better timing control for the watchdog task. This resolves potential race conditions during interface reset operations.
What error do you get (without your patch)?
Quoted 11 lines
- Added
watchdog_wqworkqueue_structandwatchdog_dqdelayed_work
- Updatede1000_watchdog()to usequeue_delayed_work()
- Removed obsolete TODO comment about delayed workqueueTested in Qemu :
/ # for i in {1..1000}; do
> echo 1 >/sys/class/net/eth0/device/reset
> sleep 0.1
> done
[ 726.357499] e1000e 0000:00:02.0: resetting [ 726.390737] e1000e 0000:00:02.0: reset donePlease do not copy the output of git show, but send the patch with
git format-patchandgit send-email.Review
Quoted 7 lines
Signed-off-by Jagadeesh <[email protected]>--- drivers/net/ethernet/intel/e1000e/e1000.h | 2 ++ drivers/net/ethernet/intel/e1000e/netdev.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/net/ethernet/intel/e1000e/e1000.hReview
Quoted 13 lines
index
ba9c19e6994c..1e7b365c4f31100644drivers/net/ethernet/intel/e1000e/e1000.h +2
-0@@ -194,6 +194,8 @@ struct e1000_adapter {struct timer_list blink_timer;struct work_struct reset_task; +struct workqueue_struct *watchdog_wq; +struct delayed_work watchdog_dq;struct work_struct watchdog_task;const struct e1000_info *ei;(quoted diff) +0
-0
b/drivers/net/ethernet/intel/e1000e/netdev.cdrivers/net/ethernet/intel/e1000e/netdev.c static void e1000_watchdog(struct timer_list *t) · line 5178
Quoted 5 lines
index
8ebcb6a7d608..87a915d09f4e100644drivers/net/ethernet/intel/e1000e/netdev.c +0
-0@@ -5178,9 +5178,8 @@ static void e1000_watchdog(struct timer_list *t) struct e1000_adapter *adapter = from_timer(adapter, t,
watchdog_timer);drivers/net/ethernet/intel/e1000e/netdev.c static void e1000_watchdog(struct timer_list *t) · line 5185
Quoted 9 lines
drivers/net/ethernet/intel/e1000e/netdev.c +1
-2/* Do the rest outside of interrupt context */ -schedule_work (&adapter->watchdog_task); +queue_delayed_work (adapter->watchdog_wq, &adapter->watchdog_dq,0 ); -/* TODO: make this use queue_delayed_work() */ }static void e1000_watchdog_task (struct work_struct *work)Kind regards,
Paul