Commit 5df7ae7b authored by Linus Torvalds's avatar Linus Torvalds

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
parents f71d49e0 940d71c6
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/sched/isolation.h> #include <linux/sched/isolation.h>
#include <linux/nmi.h> #include <linux/nmi.h>
#include <linux/kvm_para.h>
#include "workqueue_internal.h" #include "workqueue_internal.h"
...@@ -5772,6 +5773,7 @@ static void wq_watchdog_timer_fn(struct timer_list *unused) ...@@ -5772,6 +5773,7 @@ static void wq_watchdog_timer_fn(struct timer_list *unused)
{ {
unsigned long thresh = READ_ONCE(wq_watchdog_thresh) * HZ; unsigned long thresh = READ_ONCE(wq_watchdog_thresh) * HZ;
bool lockup_detected = false; bool lockup_detected = false;
unsigned long now = jiffies;
struct worker_pool *pool; struct worker_pool *pool;
int pi; int pi;
...@@ -5786,6 +5788,12 @@ static void wq_watchdog_timer_fn(struct timer_list *unused) ...@@ -5786,6 +5788,12 @@ static void wq_watchdog_timer_fn(struct timer_list *unused)
if (list_empty(&pool->worklist)) if (list_empty(&pool->worklist))
continue; continue;
/*
* If a virtual machine is stopped by the host it can look to
* the watchdog like a stall.
*/
kvm_check_and_clear_guest_paused();
/* get the latest of pool and touched timestamps */ /* get the latest of pool and touched timestamps */
if (pool->cpu >= 0) if (pool->cpu >= 0)
touched = READ_ONCE(per_cpu(wq_watchdog_touched_cpu, pool->cpu)); 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) ...@@ -5799,12 +5807,12 @@ static void wq_watchdog_timer_fn(struct timer_list *unused)
ts = touched; ts = touched;
/* did we stall? */ /* did we stall? */
if (time_after(jiffies, ts + thresh)) { if (time_after(now, ts + thresh)) {
lockup_detected = true; lockup_detected = true;
pr_emerg("BUG: workqueue lockup - pool"); pr_emerg("BUG: workqueue lockup - pool");
pr_cont_pool_info(pool); pr_cont_pool_info(pool);
pr_cont(" stuck for %us!\n", pr_cont(" stuck for %us!\n",
jiffies_to_msecs(jiffies - pool_ts) / 1000); jiffies_to_msecs(now - pool_ts) / 1000);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment