Author: kib
Date: Mon Feb  8 10:54:27 2016
New Revision: 295391
URL: https://svnweb.freebsd.org/changeset/base/295391

Log:
  Remove the assert which outlived its usefulness, and, by default,
  disable compilation of the code which made it possible to call
  stop_all_proc() from usermode at all.
  
  Move the comment to the preamble of stop_all_proc() and reword it to
  give overview of the function intent.
  
  proc0 has P_HADTHREADS flag set due to kthread_add(), but no
  P_KTHREAD, which triggered the assert, which does not serve a purpose
  now.
  
  Reported by:  Oliver Pinter
  Sponsored by: The FreeBSD Foundation
  MFC after:    2 weeks

Modified:
  head/sys/kern/kern_proc.c

Modified: head/sys/kern/kern_proc.c
==============================================================================
--- head/sys/kern/kern_proc.c   Mon Feb  8 02:11:34 2016        (r295390)
+++ head/sys/kern/kern_proc.c   Mon Feb  8 10:54:27 2016        (r295391)
@@ -2983,6 +2983,12 @@ static SYSCTL_NODE(_kern_proc, KERN_PROC
 
 int allproc_gen;
 
+/*
+ * stop_all_proc() purpose is to stop all process which have usermode,
+ * except current process for obvious reasons.  This makes it somewhat
+ * unreliable when invoked from multithreaded process.  The service
+ * must not be user-callable anyway.
+ */
 void
 stop_all_proc(void)
 {
@@ -2991,17 +2997,6 @@ stop_all_proc(void)
        bool restart, seen_stopped, seen_exiting, stopped_some;
 
        cp = curproc;
-       /*
-        * stop_all_proc() assumes that all process which have
-        * usermode must be stopped, except current process, for
-        * obvious reasons.  Since other threads in the process
-        * establishing global stop could unstop something, disable
-        * calls from multithreaded processes as precaution.  The
-        * service must not be user-callable anyway.
-        */
-       KASSERT((cp->p_flag & P_HADTHREADS) == 0 ||
-           (cp->p_flag & P_KTHREAD) != 0, ("mt stop_all_proc"));
-
 allproc_loop:
        sx_xlock(&allproc_lock);
        gen = allproc_gen;
@@ -3088,7 +3083,7 @@ resume_all_proc(void)
        sx_xunlock(&allproc_lock);
 }
 
-#define        TOTAL_STOP_DEBUG        1
+/* #define     TOTAL_STOP_DEBUG        1 */
 #ifdef TOTAL_STOP_DEBUG
 volatile static int ap_resume;
 #include <sys/mount.h>
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to