wifi: mt76: mt792x: Fix a potential deadlock in high-load situations

A deadlock may occur between two works, ps_work and mac_work, if their work
functions run simultaneously as they attempt to cancel each other by
calling cancel_delayed_work_sync().

mt792x_mac_work() ->   ...  -> cancel_delayed_work_sync(&pm->ps_work);
mt792x_pm_power_save_work() -> cancel_delayed_work_sync(&mphy->mac_work);

In high-load situations, they are queued but may not have chance to be
executed until the CPUs are released. Once the CPUs are available, there
is a high possibility that the ps_work function and mac_work function will
be executed simultaneously, resulting in a possible deadlock.

This patch replaces cancel_delayed_work_sync() with cancel_delayed_work()
in ps_work to eliminate the deadlock and make the code easier to maintain.

Signed-off-by: Leon Yen <[email protected]>
Tested-by: Chia-Lin Kao (AceLan) <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Leon Yen
2026-01-27 10:46:24 +00:00
committed by Felix Fietkau
parent 2e0a0f36cc
commit 85f5a3473b
+1 -1
View File
@@ -375,7 +375,7 @@ void mt792x_pm_power_save_work(struct work_struct *work)
} }
if (!mt792x_mcu_fw_pmctrl(dev)) { if (!mt792x_mcu_fw_pmctrl(dev)) {
cancel_delayed_work_sync(&mphy->mac_work); cancel_delayed_work(&mphy->mac_work);
return; return;
} }
out: out: