diff options
author | Matt Macy <mmacy@FreeBSD.org> | 2018-06-23 07:14:08 +0000 |
---|---|---|
committer | Matt Macy <mmacy@FreeBSD.org> | 2018-06-23 07:14:08 +0000 |
commit | 0bcfb4736334b64f86672e10ffa642184e7438a5 (patch) | |
tree | 63e34798512b07c04c1e31ecb6f2bf4193df88d3 /sys/kern/subr_epoch.c | |
parent | a00f4ac22fc56e7b627db40c6fef8d417ec8f74c (diff) | |
download | src-0bcfb4736334b64f86672e10ffa642184e7438a5.tar.gz src-0bcfb4736334b64f86672e10ffa642184e7438a5.zip |
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
Notes
Notes:
svn path=/head/; revision=335578
Diffstat (limited to 'sys/kern/subr_epoch.c')
-rw-r--r-- | sys/kern/subr_epoch.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/kern/subr_epoch.c b/sys/kern/subr_epoch.c index b5e6f285062f..9a6f6a68eed9 100644 --- a/sys/kern/subr_epoch.c +++ b/sys/kern/subr_epoch.c @@ -176,9 +176,18 @@ 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) { @@ -570,6 +579,10 @@ epoch_call(epoch_t epoch, epoch_context_t ctx, void (*callback) (epoch_context_t /* 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; |