Module Name:    src
Committed By:   riastradh
Date:           Sun Dec 19 01:19:52 UTC 2021

Modified Files:
        src/sys/external/bsd/drm2/linux: linux_rcu.c

Log Message:
Make sure the RCU GC thread processes all callbacks before dying.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/linux/linux_rcu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/linux/linux_rcu.c
diff -u src/sys/external/bsd/drm2/linux/linux_rcu.c:1.6 src/sys/external/bsd/drm2/linux/linux_rcu.c:1.7
--- src/sys/external/bsd/drm2/linux/linux_rcu.c:1.6	Sun Dec 19 01:19:45 2021
+++ src/sys/external/bsd/drm2/linux/linux_rcu.c	Sun Dec 19 01:19:52 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_rcu.c,v 1.6 2021/12/19 01:19:45 riastradh Exp $	*/
+/*	$NetBSD: linux_rcu.c,v 1.7 2021/12/19 01:19:52 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_rcu.c,v 1.6 2021/12/19 01:19:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_rcu.c,v 1.7 2021/12/19 01:19:52 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -169,12 +169,20 @@ gc_thread(void *cookie)
 			mutex_enter(&gc.lock);
 			gc.gen++;		/* done running */
 			cv_broadcast(&gc.cv);	/* notify rcu_barrier */
+
+			/*
+			 * Go back to the top and get more work before
+			 * deciding whether to stop so that we
+			 * guarantee to run all callbacks.
+			 */
+			continue;
 		}
 
 		/* If we're asked to close shop, do so.  */
 		if (gc.dying)
 			break;
 	}
+	KASSERT(gc.first == NULL);
 	mutex_exit(&gc.lock);
 
 	kthread_exit(0);

Reply via email to