Mon Aug 27 13:39:48 2018 UTC ()
Don't forget to call kthread_exit.


(riastradh)
diff -r1.1 -r1.2 src/sys/external/bsd/drm2/linux/linux_rcu.c

cvs diff -r1.1 -r1.2 src/sys/external/bsd/drm2/linux/Attic/linux_rcu.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/linux/Attic/linux_rcu.c 2018/08/27 13:31:37 1.1
+++ src/sys/external/bsd/drm2/linux/Attic/linux_rcu.c 2018/08/27 13:39:48 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_rcu.c,v 1.1 2018/08/27 13:31:37 riastradh Exp $ */ 1/* $NetBSD: linux_rcu.c,v 1.2 2018/08/27 13:39:48 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2018 The NetBSD Foundation, Inc. 4 * Copyright (c) 2018 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Taylor R. Campbell. 8 * by Taylor R. Campbell.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: linux_rcu.c,v 1.1 2018/08/27 13:31:37 riastradh Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: linux_rcu.c,v 1.2 2018/08/27 13:39:48 riastradh Exp $");
34 34
35#include <sys/types.h> 35#include <sys/types.h>
36#include <sys/condvar.h> 36#include <sys/condvar.h>
37#include <sys/kthread.h> 37#include <sys/kthread.h>
38#include <sys/mutex.h> 38#include <sys/mutex.h>
39#include <sys/xcall.h> 39#include <sys/xcall.h>
40 40
41#include <linux/rcupdate.h> 41#include <linux/rcupdate.h>
42 42
43struct { 43struct {
44 kmutex_t lock; 44 kmutex_t lock;
45 kcondvar_t cv; 45 kcondvar_t cv;
46 struct rcu_head *first; 46 struct rcu_head *first;
@@ -96,26 +96,28 @@ gc_thread(void *cookie) @@ -96,26 +96,28 @@ gc_thread(void *cookie)
96 for (; head != NULL; head = next) { 96 for (; head != NULL; head = next) {
97 next = head->rcuh_next; 97 next = head->rcuh_next;
98 (*head->rcuh_callback)(head); 98 (*head->rcuh_callback)(head);
99 } 99 }
100 100
101 mutex_enter(&gc.lock); 101 mutex_enter(&gc.lock);
102 } 102 }
103 103
104 /* If we're asked to close shop, do so. */ 104 /* If we're asked to close shop, do so. */
105 if (gc.dying) 105 if (gc.dying)
106 break; 106 break;
107 } 107 }
108 mutex_exit(&gc.lock); 108 mutex_exit(&gc.lock);
 109
 110 kthread_exit(0);
109} 111}
110 112
111int 113int
112linux_rcu_gc_init(void) 114linux_rcu_gc_init(void)
113{ 115{
114 int error; 116 int error;
115 117
116 mutex_init(&gc.lock, MUTEX_DEFAULT, IPL_VM); 118 mutex_init(&gc.lock, MUTEX_DEFAULT, IPL_VM);
117 cv_init(&gc.cv, "lnxrcugc"); 119 cv_init(&gc.cv, "lnxrcugc");
118 gc.first = NULL; 120 gc.first = NULL;
119 gc.dying = false; 121 gc.dying = false;
120 122
121 error = kthread_create(PRI_NONE, 123 error = kthread_create(PRI_NONE,