Author: mmacy
Date: Sat Jun 23 07:14:08 2018
New Revision: 335578
URL: https://svnweb.freebsd.org/changeset/base/335578

Log:
  epoch(9): Don't trigger taskq enqueue before the grouptaskqs are setup
  
  If EARLY_AP_STARTUP is not defined it is possible for an epoch to be
  allocated prior to it being possible to call epoch_call without
  issue.
  
  Based on patch by andrew@
  
  PR:           229014
  Reported by:  andrew

Modified:
  head/sys/kern/subr_epoch.c

Modified: head/sys/kern/subr_epoch.c
==============================================================================
--- head/sys/kern/subr_epoch.c  Sat Jun 23 06:53:53 2018        (r335577)
+++ head/sys/kern/subr_epoch.c  Sat Jun 23 07:14:08 2018        (r335578)
@@ -176,10 +176,19 @@ done:
        global_epoch = epoch_alloc(0);
        global_epoch_preempt = epoch_alloc(EPOCH_PREEMPT);
 }
-
 SYSINIT(epoch, SI_SUB_TASKQ + 1, SI_ORDER_FIRST, epoch_init, NULL);
 
+#if !defined(EARLY_AP_STARTUP)
 static void
+epoch_init_smp(void *dummy __unused)
+{
+       inited = 2;
+}
+SYSINIT(epoch_smp, SI_SUB_SMP + 1, SI_ORDER_FIRST, epoch_init_smp, NULL);
+#endif
+
+
+static void
 epoch_init_numa(epoch_t epoch)
 {
        int domain, cpu_offset;
@@ -570,6 +579,10 @@ epoch_call(epoch_t epoch, epoch_context_t ctx, void (*
        /* too early in boot to have epoch set up */
        if (__predict_false(epoch == NULL))
                goto boottime;
+#if !defined(EARLY_AP_STARTUP)
+       if (__predict_false(inited < 2))
+               goto boottime;
+#endif
 
        critical_enter();
        *DPCPU_PTR(epoch_cb_count) += 1;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to