Skip to content

Commit 5df7ae7

Browse files
committed
Merge branch 'for-5.13-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
Pull workqueue fix from Tejun Heo: "One commit to fix spurious workqueue stall warnings across VM suspensions" * 'for-5.13-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq: wq: handle VM suspension in stall detection
2 parents f71d49e + 940d71c commit 5df7ae7

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎kernel/workqueue.c‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#include <linux/uaccess.h>
5151
#include <linux/sched/isolation.h>
5252
#include <linux/nmi.h>
53+
#include <linux/kvm_para.h>
5354

5455
#include "workqueue_internal.h"
5556

@@ -5772,6 +5773,7 @@ static void wq_watchdog_timer_fn(struct timer_list *unused)
57725773
{
57735774
unsigned long thresh = READ_ONCE(wq_watchdog_thresh) * HZ;
57745775
bool lockup_detected = false;
5776+
unsigned long now = jiffies;
57755777
struct worker_pool *pool;
57765778
int pi;
57775779

@@ -5786,6 +5788,12 @@ static void wq_watchdog_timer_fn(struct timer_list *unused)
57865788
if (list_empty(&pool->worklist))
57875789
continue;
57885790

5791+
/*
5792+
* If a virtual machine is stopped by the host it can look to
5793+
* the watchdog like a stall.
5794+
*/
5795+
kvm_check_and_clear_guest_paused();
5796+
57895797
/* get the latest of pool and touched timestamps */
57905798
if (pool->cpu >= 0)
57915799
touched = READ_ONCE(per_cpu(wq_watchdog_touched_cpu, pool->cpu));
@@ -5799,12 +5807,12 @@ static void wq_watchdog_timer_fn(struct timer_list *unused)
57995807
ts = touched;
58005808

58015809
/* did we stall? */
5802-
if (time_after(jiffies, ts + thresh)) {
5810+
if (time_after(now, ts + thresh)) {
58035811
lockup_detected = true;
58045812
pr_emerg("BUG: workqueue lockup - pool");
58055813
pr_cont_pool_info(pool);
58065814
pr_cont(" stuck for %us!\n",
5807-
jiffies_to_msecs(jiffies - pool_ts) / 1000);
5815+
jiffies_to_msecs(now - pool_ts) / 1000);
58085816
}
58095817
}
58105818

0 commit comments

Comments
 (0)