diff --git a/sys/compat/linuxkpi/common/include/linux/sched.h b/sys/compat/linuxkpi/common/include/linux/sched.h index bdaf7ae070f3..c9f2a399904e 100644 --- a/sys/compat/linuxkpi/common/include/linux/sched.h +++ b/sys/compat/linuxkpi/common/include/linux/sched.h @@ -91,7 +91,7 @@ CTASSERT(sizeof(((struct thread *)0)->td_retval[1]) >= sizeof(uintptr_t)); do { \ void *c; \ \ - if (cold) \ + if (cold || SCHEDULER_STOPPED()) \ break; \ c = curthread; \ sleepq_lock(c); \ diff --git a/sys/compat/linuxkpi/common/include/linux/wait.h b/sys/compat/linuxkpi/common/include/linux/wait.h index 8afea0856bd8..9624c8467657 100644 --- a/sys/compat/linuxkpi/common/include/linux/wait.h +++ b/sys/compat/linuxkpi/common/include/linux/wait.h @@ -31,6 +31,7 @@ #ifndef _LINUX_WAIT_H_ #define _LINUX_WAIT_H_ +#include #include #include #include @@ -81,6 +82,8 @@ do { \ void *c = &(q).wchan; \ if (!(cond)) { \ for (;;) { \ + if (unlikely(SCHEDULER_STOPPED())) \ + break; \ sleepq_lock(c); \ if (cond) { \ sleepq_release(c); \ @@ -100,6 +103,8 @@ do { \ _error = 0; \ if (!(cond)) { \ for (; _error == 0;) { \ + if (unlikely(SCHEDULER_STOPPED())) \ + break; \ sleepq_lock(c); \ if (cond) { \ sleepq_release(c); \ @@ -123,6 +128,8 @@ do { \ \ if (!(cond)) { \ for (; __rc == 0;) { \ + if (unlikely(SCHEDULER_STOPPED())) \ + break; \ sleepq_lock(c); \ if (cond) { \ sleepq_release(c); \ diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index faaa1d453806..1fc0bc490a1b 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -1093,6 +1093,8 @@ linux_complete_common(struct completion *c, int all) long linux_wait_for_common(struct completion *c, int flags) { + if (unlikely(SCHEDULER_STOPPED())) + return (0); if (flags != 0) flags = SLEEPQ_INTERRUPTIBLE | SLEEPQ_SLEEP; @@ -1123,6 +1125,9 @@ linux_wait_for_timeout_common(struct completion *c, long timeout, int flags) { long end = jiffies + timeout; + if (unlikely(SCHEDULER_STOPPED())) + return (0); + if (flags != 0) flags = SLEEPQ_INTERRUPTIBLE | SLEEPQ_SLEEP; else