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
This commit is contained in:
Hans Petter Selasky 2016-05-25 09:04:06 +00:00
parent dbd2ee46b2
commit 8571421886
3 changed files with 13 additions and 1 deletions

View File

@ -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); \

View File

@ -31,6 +31,7 @@
#ifndef _LINUX_WAIT_H_
#define _LINUX_WAIT_H_
#include <linux/compiler.h>
#include <linux/spinlock.h>
#include <linux/sched.h>
#include <linux/list.h>
@ -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); \

View File

@ -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