Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Jul 2018 19:50:25 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r336046 - in head/sys: amd64/include i386/include sys
Message-ID:  <201807061950.w66JoP2F081328@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Jul  6 19:50:25 2018
New Revision: 336046
URL: https://svnweb.freebsd.org/changeset/base/336046

Log:
  Revert to recommit with the proper message.

Modified:
  head/sys/amd64/include/counter.h
  head/sys/amd64/include/pcpu.h
  head/sys/i386/include/pcpu.h
  head/sys/sys/pcpu.h

Modified: head/sys/amd64/include/counter.h
==============================================================================
--- head/sys/amd64/include/counter.h	Fri Jul  6 19:48:47 2018	(r336045)
+++ head/sys/amd64/include/counter.h	Fri Jul  6 19:50:25 2018	(r336046)
@@ -83,11 +83,18 @@ 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__ */

Modified: head/sys/amd64/include/pcpu.h
==============================================================================
--- head/sys/amd64/include/pcpu.h	Fri Jul  6 19:48:47 2018	(r336045)
+++ head/sys/amd64/include/pcpu.h	Fri Jul  6 19:50:25 2018	(r336046)
@@ -76,7 +76,8 @@
 	uint32_t pc_pcid_gen;						\
 	uint32_t pc_smp_tlb_done;	/* TLB op acknowledgement */	\
 	uint32_t pc_ibpb_set;						\
-	char	__pad[3288]		/* pad to UMA_PCPU_ALLOC_SIZE */
+	char	__pad[216]		/* be divisor of PAGE_SIZE	\
+					   after cache alignment */
 
 #define	PC_DBREG_CMD_NONE	0
 #define	PC_DBREG_CMD_LOAD	1

Modified: head/sys/i386/include/pcpu.h
==============================================================================
--- head/sys/i386/include/pcpu.h	Fri Jul  6 19:48:47 2018	(r336045)
+++ head/sys/i386/include/pcpu.h	Fri Jul  6 19:50:25 2018	(r336046)
@@ -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[3610]
+	char	__pad[538]
 
 #ifdef _KERNEL
 

Modified: head/sys/sys/pcpu.h
==============================================================================
--- head/sys/sys/pcpu.h	Fri Jul  6 19:48:47 2018	(r336045)
+++ head/sys/sys/pcpu.h	Fri Jul  6 19:50:25 2018	(r336046)
@@ -185,6 +185,14 @@ 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);
@@ -200,19 +208,6 @@ extern struct pcpu *cpuid_to_pcpu[];
 #define	curvidata	PCPU_GET(vidata)
 
 #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 *



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807061950.w66JoP2F081328>