Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142333760
D16140.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
10 KB
Referenced Files
None
Subscribers
None
D16140.id.diff
View Options
Index: head/share/man/man9/dpcpu.9
===================================================================
--- head/share/man/man9/dpcpu.9
+++ head/share/man/man9/dpcpu.9
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 26, 2017
+.Dd July 5, 2018
.Dt DPCPU 9
.Os
.Sh NAME
@@ -35,6 +35,7 @@
.In sys/pcpu.h
.Ss Per-CPU Variable Definition and Declaration
.Fn DPCPU_DEFINE "type" "name"
+.Fn DPCPU_DEFINE_STATIC "type" "name"
.Fn DPCPU_DECLARE "type" "name"
.Ss Current CPU Accessor Functions
.Fn DPCPU_PTR "name"
@@ -66,11 +67,12 @@
DPCPU_DEFINE(int, foo_int) = 1;
.Ed
.Pp
-Syntactically, the definition may be treated as a variable.
-For example, a dynamic per-CPU variable may be declared as
-.Dv static :
+Values that can be defined as
+.Dv static
+must use
+.Fn DPCPU_DEFINE_STATIC :
.Bd -literal -offset 1234
-static DPCPU_DEFINE(int, foo_int);
+DPCPU_DEFINE_STATIC(int, foo_int);
.Ed
.Pp
.Fn DPCPU_DECLARE
@@ -111,8 +113,8 @@
sequence of accesses, using suitable synchronization to make non-atomic
sequences safe in the presence of migration.
.Bd -literal -offset 1234
-static DPCPU_DEFINE(int, foo_int);
-static DPCPU_DEFINE(struct mutex, foo_lock);
+DPCPU_DEFINE_STATIC(int, foo_int);
+DPCPU_DEFINE_STATIC(struct mutex, foo_lock);
void
foo_int_increment(void)
Index: head/sys/compat/linuxkpi/common/src/linux_idr.c
===================================================================
--- head/sys/compat/linuxkpi/common/src/linux_idr.c
+++ head/sys/compat/linuxkpi/common/src/linux_idr.c
@@ -55,7 +55,7 @@
unsigned count;
};
-static DPCPU_DEFINE(struct linux_idr_cache, linux_idr_cache);
+DPCPU_DEFINE_STATIC(struct linux_idr_cache, linux_idr_cache);
/*
* IDR Implementation.
Index: head/sys/compat/linuxkpi/common/src/linux_rcu.c
===================================================================
--- head/sys/compat/linuxkpi/common/src/linux_rcu.c
+++ head/sys/compat/linuxkpi/common/src/linux_rcu.c
@@ -92,7 +92,7 @@
static ck_epoch_t linux_epoch;
static struct linux_epoch_head linux_epoch_head;
-static DPCPU_DEFINE(struct linux_epoch_record, linux_epoch_record);
+DPCPU_DEFINE_STATIC(struct linux_epoch_record, linux_epoch_record);
static void linux_rcu_cleaner_func(void *, int);
Index: head/sys/compat/linuxkpi/common/src/linux_tasklet.c
===================================================================
--- head/sys/compat/linuxkpi/common/src/linux_tasklet.c
+++ head/sys/compat/linuxkpi/common/src/linux_tasklet.c
@@ -61,7 +61,7 @@
#define TASKLET_WORKER_LOCK(tw) mtx_lock(&(tw)->mtx)
#define TASKLET_WORKER_UNLOCK(tw) mtx_unlock(&(tw)->mtx)
-static DPCPU_DEFINE(struct tasklet_worker, tasklet_worker);
+DPCPU_DEFINE_STATIC(struct tasklet_worker, tasklet_worker);
static void
tasklet_handler(void *arg)
Index: head/sys/kern/kern_clock.c
===================================================================
--- head/sys/kern/kern_clock.c
+++ head/sys/kern/kern_clock.c
@@ -382,7 +382,7 @@
volatile int ticks;
int psratio;
-static DPCPU_DEFINE(int, pcputicks); /* Per-CPU version of ticks. */
+DPCPU_DEFINE_STATIC(int, pcputicks); /* Per-CPU version of ticks. */
#ifdef DEVICE_POLLING
static int devpoll_run = 0;
#endif
Index: head/sys/kern/kern_clocksource.c
===================================================================
--- head/sys/kern/kern_clocksource.c
+++ head/sys/kern/kern_clocksource.c
@@ -126,7 +126,7 @@
int idle; /* This CPU is in idle mode. */
};
-static DPCPU_DEFINE(struct pcpu_state, timerstate);
+DPCPU_DEFINE_STATIC(struct pcpu_state, timerstate);
DPCPU_DEFINE(sbintime_t, hardclocktime);
/*
Index: head/sys/kern/kern_exec.c
===================================================================
--- head/sys/kern/kern_exec.c
+++ head/sys/kern/kern_exec.c
@@ -1331,7 +1331,7 @@
SLIST_ENTRY(exec_args_kva) next;
};
-static DPCPU_DEFINE(struct exec_args_kva *, exec_args_kva);
+DPCPU_DEFINE_STATIC(struct exec_args_kva *, exec_args_kva);
static SLIST_HEAD(, exec_args_kva) exec_args_kva_freelist;
static struct mtx exec_args_kva_mtx;
Index: head/sys/kern/kern_tc.c
===================================================================
--- head/sys/kern/kern_tc.c
+++ head/sys/kern/kern_tc.c
@@ -2001,8 +2001,8 @@
static int cpu_tick_variable;
static uint64_t cpu_tick_frequency;
-static DPCPU_DEFINE(uint64_t, tc_cpu_ticks_base);
-static DPCPU_DEFINE(unsigned, tc_cpu_ticks_last);
+DPCPU_DEFINE_STATIC(uint64_t, tc_cpu_ticks_base);
+DPCPU_DEFINE_STATIC(unsigned, tc_cpu_ticks_last);
static uint64_t
tc_cpu_ticks(void)
Index: head/sys/kern/sched_4bsd.c
===================================================================
--- head/sys/kern/sched_4bsd.c
+++ head/sys/kern/sched_4bsd.c
@@ -176,7 +176,7 @@
u_int idlecalls;
u_int oldidlecalls;
};
-static DPCPU_DEFINE(struct pcpuidlestat, idlestat);
+DPCPU_DEFINE_STATIC(struct pcpuidlestat, idlestat);
static void
setup_runqs(void)
Index: head/sys/kern/sched_ule.c
===================================================================
--- head/sys/kern/sched_ule.c
+++ head/sys/kern/sched_ule.c
@@ -283,7 +283,7 @@
static struct tdq tdq_cpu[MAXCPU];
static struct tdq *balance_tdq;
static int balance_ticks;
-static DPCPU_DEFINE(uint32_t, randomval);
+DPCPU_DEFINE_STATIC(uint32_t, randomval);
#define TDQ_SELF() (&tdq_cpu[PCPU_GET(cpuid)])
#define TDQ_CPU(x) (&tdq_cpu[(x)])
Index: head/sys/kern/subr_pcpu.c
===================================================================
--- head/sys/kern/subr_pcpu.c
+++ head/sys/kern/subr_pcpu.c
@@ -72,7 +72,7 @@
TAILQ_ENTRY(dpcpu_free) df_link;
};
-static DPCPU_DEFINE(char, modspace[DPCPU_MODMIN]);
+DPCPU_DEFINE_STATIC(char, modspace[DPCPU_MODMIN]);
static TAILQ_HEAD(, dpcpu_free) dpcpu_head = TAILQ_HEAD_INITIALIZER(dpcpu_head);
static struct sx dpcpu_lock;
uintptr_t dpcpu_off[MAXCPU];
Index: head/sys/mips/mips/tick.c
===================================================================
--- head/sys/mips/mips/tick.c
+++ head/sys/mips/mips/tick.c
@@ -61,13 +61,13 @@
struct timecounter *platform_timecounter;
-static DPCPU_DEFINE(uint32_t, cycles_per_tick);
+DPCPU_DEFINE_STATIC(uint32_t, cycles_per_tick);
static uint32_t cycles_per_usec;
-static DPCPU_DEFINE(volatile uint32_t, counter_upper);
-static DPCPU_DEFINE(volatile uint32_t, counter_lower_last);
-static DPCPU_DEFINE(uint32_t, compare_ticks);
-static DPCPU_DEFINE(uint32_t, lost_ticks);
+DPCPU_DEFINE_STATIC(volatile uint32_t, counter_upper);
+DPCPU_DEFINE_STATIC(volatile uint32_t, counter_lower_last);
+DPCPU_DEFINE_STATIC(uint32_t, compare_ticks);
+DPCPU_DEFINE_STATIC(uint32_t, lost_ticks);
struct clock_softc {
int intr_rid;
Index: head/sys/mips/nlm/tick.c
===================================================================
--- head/sys/mips/nlm/tick.c
+++ head/sys/mips/nlm/tick.c
@@ -62,13 +62,13 @@
struct timecounter *platform_timecounter;
-static DPCPU_DEFINE(uint32_t, cycles_per_tick);
+DPCPU_DEFINE_STATIC(uint32_t, cycles_per_tick);
static uint32_t cycles_per_usec;
-static DPCPU_DEFINE(volatile uint32_t, counter_upper);
-static DPCPU_DEFINE(volatile uint32_t, counter_lower_last);
-static DPCPU_DEFINE(uint32_t, compare_ticks);
-static DPCPU_DEFINE(uint32_t, lost_ticks);
+DPCPU_DEFINE_STATIC(volatile uint32_t, counter_upper);
+DPCPU_DEFINE_STATIC(volatile uint32_t, counter_lower_last);
+DPCPU_DEFINE_STATIC(uint32_t, compare_ticks);
+DPCPU_DEFINE_STATIC(uint32_t, lost_ticks);
struct clock_softc {
int intr_rid;
Index: head/sys/netinet/siftr.c
===================================================================
--- head/sys/netinet/siftr.c
+++ head/sys/netinet/siftr.c
@@ -268,7 +268,7 @@
uint32_t nskip_out_dejavu;
};
-static DPCPU_DEFINE(struct siftr_stats, ss);
+DPCPU_DEFINE_STATIC(struct siftr_stats, ss);
static volatile unsigned int siftr_exit_pkt_manager_thread = 0;
static unsigned int siftr_enabled = 0;
Index: head/sys/netpfil/ipfw/ip_fw_dynamic.c
===================================================================
--- head/sys/netpfil/ipfw/ip_fw_dynamic.c
+++ head/sys/netpfil/ipfw/ip_fw_dynamic.c
@@ -219,7 +219,7 @@
* and must not be reclaimed by expiration callout.
*/
static void **dyn_hp_cache;
-static DPCPU_DEFINE(void *, dyn_hp);
+DPCPU_DEFINE_STATIC(void *, dyn_hp);
#define DYNSTATE_GET(cpu) ck_pr_load_ptr(DPCPU_ID_PTR((cpu), dyn_hp))
#define DYNSTATE_PROTECT(v) ck_pr_store_ptr(DPCPU_PTR(dyn_hp), (v))
#define DYNSTATE_RELEASE() DYNSTATE_PROTECT(NULL)
Index: head/sys/powerpc/powerpc/clock.c
===================================================================
--- head/sys/powerpc/powerpc/clock.c
+++ head/sys/powerpc/powerpc/clock.c
@@ -95,7 +95,7 @@
int mode; /* 0 - off, 1 - periodic, 2 - one-shot. */
int32_t div; /* Periodic divisor. */
};
-static DPCPU_DEFINE(struct decr_state, decr_state);
+DPCPU_DEFINE_STATIC(struct decr_state, decr_state);
static struct eventtimer decr_et;
static struct timecounter decr_tc = {
Index: head/sys/sys/pcpu.h
===================================================================
--- head/sys/sys/pcpu.h
+++ head/sys/sys/pcpu.h
@@ -81,7 +81,11 @@
*/
#define DPCPU_NAME(n) pcpu_entry_##n
#define DPCPU_DECLARE(t, n) extern t DPCPU_NAME(n)
-#define DPCPU_DEFINE(t, n) t DPCPU_NAME(n) __section(DPCPU_SETNAME) __used
+/* struct _hack is to stop this from being used with the static keyword. */
+#define DPCPU_DEFINE(t, n) \
+ struct _hack; t DPCPU_NAME(n) __section(DPCPU_SETNAME) __used
+#define DPCPU_DEFINE_STATIC(t, n) \
+ static t DPCPU_NAME(n) __section(DPCPU_SETNAME) __used
/*
* Accessors with a given base.
Index: head/sys/vm/vm_page.c
===================================================================
--- head/sys/vm/vm_page.c
+++ head/sys/vm/vm_page.c
@@ -134,7 +134,7 @@
struct vm_domain vm_dom[MAXMEMDOM];
-static DPCPU_DEFINE(struct vm_batchqueue, pqbatch[MAXMEMDOM][PQ_COUNT]);
+DPCPU_DEFINE_STATIC(struct vm_batchqueue, pqbatch[MAXMEMDOM][PQ_COUNT]);
struct mtx_padalign __exclusive_cache_line pa_lock[PA_LOCK_COUNT];
Index: head/sys/x86/xen/xen_intr.c
===================================================================
--- head/sys/x86/xen/xen_intr.c
+++ head/sys/x86/xen/xen_intr.c
@@ -103,7 +103,7 @@
* Start the scan at port 0 by initializing the last scanned
* location as the highest numbered event channel port.
*/
-static DPCPU_DEFINE(struct xen_intr_pcpu_data, xen_intr_pcpu) = {
+DPCPU_DEFINE_STATIC(struct xen_intr_pcpu_data, xen_intr_pcpu) = {
.last_processed_l1i = LONG_BIT - 1,
.last_processed_l2i = LONG_BIT - 1
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 19, 5:17 PM (11 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27750115
Default Alt Text
D16140.id.diff (10 KB)
Attached To
Mode
D16140: Create a new macro for static DPCPU data
Attached
Detach File
Event Timeline
Log In to Comment