From dbcba89131b58b7216efb8356da2adfc1a788cb7 Mon Sep 17 00:00:00 2001 From: hselasky Date: Wed, 25 May 2016 09:04:06 +0000 Subject: Add checks for SCHEDULER_STOPPED() so that code using the LinuxKPI can run after a panic(). This for example allows a LinuxKPI based graphics stack to receive prints during a panic. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies --- sys/compat/linuxkpi/common/include/linux/wait.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sys/compat/linuxkpi/common/include/linux/wait.h') diff --git a/sys/compat/linuxkpi/common/include/linux/wait.h b/sys/compat/linuxkpi/common/include/linux/wait.h index 8afea08..9624c84 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); \ -- cgit v1.1