Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F133499818
D25459.id78230.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D25459.id78230.diff
View Options
Index: sys/kern/uipc_domain.c
===================================================================
--- sys/kern/uipc_domain.c
+++ sys/kern/uipc_domain.c
@@ -47,6 +47,8 @@
#include <sys/socketvar.h>
#include <sys/systm.h>
+#include <machine/atomic.h>
+
#include <net/vnet.h>
/*
@@ -177,6 +179,8 @@
flags = atomic_load_acq_int(&dp->dom_flags);
if ((flags & DOMF_SUPPORTED) == 0)
return;
+ KASSERT((flags & DOMF_INITED) == 0 || !IS_DEFAULT_VNET(curvnet),
+ ("Premature initialization of domain in non-default vnet"));
if (dp->dom_init)
(*dp->dom_init)();
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
@@ -188,6 +192,8 @@
max_datalen = MHLEN - max_hdr;
if (max_datalen < 1)
panic("%s: max_datalen < 1", __func__);
+ if (IS_DEFAULT_VNET(curvnet))
+ atomic_set_rel_int(&dp->dom_flags, DOMF_INITED);
}
#ifdef VIMAGE
@@ -236,15 +242,6 @@
if (domain_init_status < 1)
printf("WARNING: attempt to domain_add(%s) before "
"domaininit()\n", dp->dom_name);
-#endif
-#ifdef notyet
- KASSERT(domain_init_status < 2,
- ("attempt to domain_add(%s) after domainfinalize()",
- dp->dom_name));
-#else
- if (domain_init_status >= 2)
- printf("WARNING: attempt to domain_add(%s) after "
- "domainfinalize()\n", dp->dom_name);
#endif
mtx_unlock(&dom_mtx);
}
@@ -491,10 +488,14 @@
struct protosw *pr;
NET_EPOCH_ENTER(et);
- for (dp = domains; dp; dp = dp->dom_next)
+ for (dp = domains; dp; dp = dp->dom_next) {
+ if ((atomic_load_int(&dp->dom_flags) & DOMF_INITED) == 0)
+ continue;
+ atomic_thread_fence_acq();
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
if (pr->pr_slowtimo)
(*pr->pr_slowtimo)();
+ }
NET_EPOCH_EXIT(et);
callout_reset(&pfslow_callout, hz/2, pfslowtimo, NULL);
}
@@ -507,10 +508,14 @@
struct protosw *pr;
NET_EPOCH_ENTER(et);
- for (dp = domains; dp; dp = dp->dom_next)
+ for (dp = domains; dp; dp = dp->dom_next) {
+ if ((atomic_load_int(&dp->dom_flags) & DOMF_INITED) == 0)
+ continue;
+ atomic_thread_fence_acq();
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
if (pr->pr_fasttimo)
(*pr->pr_fasttimo)();
+ }
NET_EPOCH_EXIT(et);
callout_reset(&pffast_callout, hz/5, pffasttimo, NULL);
}
Index: sys/sys/domain.h
===================================================================
--- sys/sys/domain.h
+++ sys/sys/domain.h
@@ -74,6 +74,7 @@
/* dom_flags */
#define DOMF_SUPPORTED 0x0001 /* System supports this domain. */
+#define DOMF_INITED 0x0002 /* Initialized in the default vnet. */
#ifdef _KERNEL
extern int domain_init_status;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Oct 27, 5:57 AM (7 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24226432
Default Alt Text
D25459.id78230.diff (2 KB)
Attached To
Mode
D25459: domain: make it safer to add domains post-domainfinalize
Attached
Detach File
Event Timeline
Log In to Comment