diff options
author | Sebastien Marie <semarie@cvs.openbsd.org> | 2020-10-17 15:10:55 +0000 |
---|---|---|
committer | Sebastien Marie <semarie@cvs.openbsd.org> | 2020-10-17 15:10:55 +0000 |
commit | 63f00f370118d66a9cfda0b58c88124338392e97 (patch) | |
tree | 7a16a449eacad05065b84d028798f41a3c18cf6e /sys/dev/pci/drm | |
parent | 261c0a1a4ff81e4ad0464706a2f9895098229578 (diff) |
Avoid a possible dead-lock in kthread_stop(): when stopping, wakeup()
the caller of kthread_stop().
The thread should also be unparked as else it will not seen the
KTHREAD_SHOULDSTOP flag. it follows what Linux is doing.
ok kettenis@
Diffstat (limited to 'sys/dev/pci/drm')
-rw-r--r-- | sys/dev/pci/drm/drm_linux.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/drm_linux.c b/sys/dev/pci/drm/drm_linux.c index fd797effc74..25282df374a 100644 --- a/sys/dev/pci/drm/drm_linux.c +++ b/sys/dev/pci/drm/drm_linux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_linux.c,v 1.64 2020/10/16 09:20:04 jsg Exp $ */ +/* $OpenBSD: drm_linux.c,v 1.65 2020/10/17 15:10:54 semarie Exp $ */ /* * Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org> * Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org> @@ -207,6 +207,7 @@ kthread_func(void *arg) ret = thread->func(thread->data); thread->flags |= KTHREAD_STOPPED; + wakeup(thread); kthread_exit(ret); } @@ -298,6 +299,7 @@ kthread_stop(struct proc *p) while ((thread->flags & KTHREAD_STOPPED) == 0) { thread->flags |= KTHREAD_SHOULDSTOP; + kthread_unpark(p); wake_up_process(thread->proc); tsleep_nsec(thread, PPAUSE, "stop", INFSLP); } |