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
Unified · Split
| @@ -50,6 +50,7 @@ · 49 unmodified lines | ||
| 50 | 50 | #include <linux/uaccess.h> |
| 51 | 51 | #include <linux/sched/isolation.h> |
| 52 | 52 | #include <linux/nmi.h> |
| 53 | +#include <linux/kvm_para.h> | |
| 53 | 54 | |
| 54 | 55 | #include "workqueue_internal.h" |
| 55 | 56 | |
| @@ -5772,6 +5773,7 @@ static void wq_watchdog_timer_fn(struct timer_list *unused) · 5716 unmodified lines | ||
| 5772 | 5773 | { |
| 5773 | 5774 | unsigned long thresh = READ_ONCE(wq_watchdog_thresh) * HZ; |
| 5774 | 5775 | bool lockup_detected = false; |
| 5776 | + unsigned long now = jiffies; | |
| 5775 | 5777 | struct worker_pool *pool; |
| 5776 | 5778 | int pi; |
| 5777 | 5779 | |
| @@ -5786,6 +5788,12 @@ static void wq_watchdog_timer_fn(struct timer_list *unused) · 8 unmodified lines | ||
| 5786 | 5788 | if (list_empty(&pool->worklist)) |
| 5787 | 5789 | continue; |
| 5788 | 5790 | |
| 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 | + | |
| 5789 | 5797 | /* get the latest of pool and touched timestamps */ |
| 5790 | 5798 | if (pool->cpu >= 0) |
| 5791 | 5799 | 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) · 7 unmodified lines | ||
| 5799 | 5807 | ts = touched; |
| 5800 | 5808 | |
| 5801 | 5809 | /* did we stall? */ |
| 5802 | − if (time_after(jiffies, ts + thresh)) { | |
| 5810 | + if (time_after(now, ts + thresh)) { | |
| 5803 | 5811 | lockup_detected = true; |
| 5804 | 5812 | pr_emerg("BUG: workqueue lockup - pool"); |
| 5805 | 5813 | pr_cont_pool_info(pool); |
| 5806 | 5814 | pr_cont(" stuck for %us!\n", |
| 5807 | − jiffies_to_msecs(jiffies - pool_ts) / 1000); | |
| 5815 | + jiffies_to_msecs(now - pool_ts) / 1000); | |
| 5808 | 5816 | } |
| 5809 | 5817 | } |
| 5810 | 5818 | |