Expand x86 struct pcpus to UMA_PCPU_ALLOC_SIZE AKA PAGE_SIZE.
This restores counters(9) operation. Revert r336024. Improve assert of pcpu size on x86. Reviewed by: mmacy Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D16163
This commit is contained in:
parent
fb0a281196
commit
53dec71d39
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=336047
@ -83,18 +83,11 @@ counter_u64_zero_inline(counter_u64_t c)
|
||||
static inline void
|
||||
counter_u64_add(counter_u64_t c, int64_t inc)
|
||||
{
|
||||
int64_t *p;
|
||||
#ifdef notyet
|
||||
|
||||
__asm __volatile("addq\t%1,%%gs:(%0)"
|
||||
:
|
||||
: "r" ((char *)c - (char *)&__pcpu[0]), "ri" (inc)
|
||||
: "memory", "cc");
|
||||
#endif
|
||||
/* temporary */
|
||||
critical_enter();
|
||||
p = zpcpu_get(c);
|
||||
*p += inc;
|
||||
critical_exit();
|
||||
}
|
||||
|
||||
#endif /* ! __MACHINE_COUNTER_H__ */
|
||||
|
@ -76,8 +76,7 @@
|
||||
uint32_t pc_pcid_gen; \
|
||||
uint32_t pc_smp_tlb_done; /* TLB op acknowledgement */ \
|
||||
uint32_t pc_ibpb_set; \
|
||||
char __pad[216] /* be divisor of PAGE_SIZE \
|
||||
after cache alignment */
|
||||
char __pad[3288] /* pad to UMA_PCPU_ALLOC_SIZE */
|
||||
|
||||
#define PC_DBREG_CMD_NONE 0
|
||||
#define PC_DBREG_CMD_LOAD 1
|
||||
|
@ -80,7 +80,7 @@
|
||||
caddr_t pc_pmap_eh_ptep; \
|
||||
uint32_t pc_smp_tlb_done; /* TLB op acknowledgement */ \
|
||||
uint32_t pc_ibpb_set; \
|
||||
char __pad[538]
|
||||
char __pad[3610]
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
|
@ -185,14 +185,6 @@ struct pcpu {
|
||||
PCPU_MD_FIELDS;
|
||||
} __aligned(CACHE_LINE_SIZE);
|
||||
|
||||
#ifdef CTASSERT
|
||||
/*
|
||||
* To minimize memory waste in per-cpu UMA zones, size of struct pcpu
|
||||
* should be denominator of PAGE_SIZE.
|
||||
*/
|
||||
CTASSERT((PAGE_SIZE / sizeof(struct pcpu)) * sizeof(struct pcpu) == PAGE_SIZE);
|
||||
#endif
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
STAILQ_HEAD(cpuhead, pcpu);
|
||||
@ -209,6 +201,19 @@ extern struct pcpu *cpuid_to_pcpu[];
|
||||
|
||||
#define UMA_PCPU_ALLOC_SIZE PAGE_SIZE
|
||||
|
||||
#ifdef CTASSERT
|
||||
#if defined(__i386__) || defined(__amd64__)
|
||||
/* Required for counters(9) to work on x86. */
|
||||
CTASSERT(sizeof(struct pcpu) == UMA_PCPU_ALLOC_SIZE);
|
||||
#else
|
||||
/*
|
||||
* To minimize memory waste in per-cpu UMA zones, size of struct pcpu
|
||||
* should be denominator of PAGE_SIZE.
|
||||
*/
|
||||
CTASSERT((PAGE_SIZE / sizeof(struct pcpu)) * sizeof(struct pcpu) == PAGE_SIZE);
|
||||
#endif /* UMA_PCPU_ALLOC_SIZE && x86 */
|
||||
#endif /* CTASSERT */
|
||||
|
||||
/* Accessor to elements allocated via UMA_ZONE_PCPU zone. */
|
||||
static inline void *
|
||||
zpcpu_get(void *base)
|
||||
|
Loading…
Reference in New Issue
Block a user