git: 0be13a45f7cb - main - xregs_sig: Add a ability to handle multiple register banks

2023-06-04 Thread Dmitry Chagin
The branch main has been updated by dchagin:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=0be13a45f7cb18f8b86c800a28457bf918e130f2

commit 0be13a45f7cb18f8b86c800a28457bf918e130f2
Author: Dmitry Chagin 
AuthorDate: 2023-06-04 09:06:25 +
Commit: Dmitry Chagin 
CommitDate: 2023-06-04 09:06:25 +

xregs_sig: Add a ability to handle multiple register banks

While here replace the .global directive by traditionally used .globl.

Reviewed by:kib
Differential Revision:  https://reviews.freebsd.org/D40410
---
 tools/test/xregs_sig/c2x2c_aarch64.S |  18 ++---
 tools/test/xregs_sig/c2x2c_amd64.S   |  18 ++---
 tools/test/xregs_sig/xregs_sig.c | 128 ++-
 3 files changed, 100 insertions(+), 64 deletions(-)

diff --git a/tools/test/xregs_sig/c2x2c_aarch64.S 
b/tools/test/xregs_sig/c2x2c_aarch64.S
index 6f1637f5bcdf..f53550b867fd 100644
--- a/tools/test/xregs_sig/c2x2c_aarch64.S
+++ b/tools/test/xregs_sig/c2x2c_aarch64.S
@@ -5,9 +5,11 @@
  * $FreeBSD$
  */
 
-   .global cpu_to_xregs
-   .type cpu_to_xregs, @function
-cpu_to_xregs:
+   .text
+
+   .globl cpu_to_vfp
+   .type cpu_to_vfp, @function
+cpu_to_vfp:
stp  q0,  q1, [x0, #( 0 * 16)]
stp  q2,  q3, [x0, #( 2 * 16)]
stp  q4,  q5, [x0, #( 4 * 16)]
@@ -26,12 +28,12 @@ cpu_to_xregs:
stp q30, q31, [x0, #(30 * 16)]
ret
 
-   .size cpu_to_xregs, . - cpu_to_xregs
+   .size cpu_to_vfp, . - cpu_to_vfp
 
 
-   .global xregs_to_cpu
-   .type xregs_to_cpu, @function
-xregs_to_cpu:
+   .globl vfp_to_cpu
+   .type vfp_to_cpu, @function
+vfp_to_cpu:
ldp  q0,  q1, [x0, #( 0 * 16)]
ldp  q2,  q3, [x0, #( 2 * 16)]
ldp  q4,  q5, [x0, #( 4 * 16)]
@@ -50,6 +52,6 @@ xregs_to_cpu:
ldp q30, q31, [x0, #(30 * 16)]
ret
 
-   .size xregs_to_cpu, . - xregs_to_cpu
+   .size vfp_to_cpu, . - vfp_to_cpu
 
.section.note.GNU-stack,"",@progbits
diff --git a/tools/test/xregs_sig/c2x2c_amd64.S 
b/tools/test/xregs_sig/c2x2c_amd64.S
index e5ae5af99e97..7348e4871d53 100644
--- a/tools/test/xregs_sig/c2x2c_amd64.S
+++ b/tools/test/xregs_sig/c2x2c_amd64.S
@@ -5,9 +5,11 @@
  * $FreeBSD$
  */
 
-   .global cpu_to_xregs
-   .type cpu_to_xregs, @function
-cpu_to_xregs:
+   .text
+
+   .globl cpu_to_xmm
+   .type cpu_to_xmm, @function
+cpu_to_xmm:
movdqu  %xmm0, (%rdi)
movdqu  %xmm1, 1 * 16(%rdi)
movdqu  %xmm2, 2 * 16(%rdi)
@@ -26,12 +28,12 @@ cpu_to_xregs:
movdqu  %xmm15, 15 * 16(%rdi)
retq
 
-   .size cpu_to_xregs, . - cpu_to_xregs
+   .size cpu_to_xmm, . - cpu_to_xmm
 
 
-   .global xregs_to_cpu
-   .type xregs_to_cpu, @function
-xregs_to_cpu:
+   .globl xmm_to_cpu
+   .type xmm_to_cpu, @function
+xmm_to_cpu:
movdqu  (%rdi), %xmm0
movdqu  1 * 16(%rdi), %xmm1
movdqu  2 * 16(%rdi), %xmm2
@@ -50,6 +52,6 @@ xregs_to_cpu:
movdqu  15 * 16(%rdi), %xmm15
retq
 
-   .size xregs_to_cpu, . - xregs_to_cpu
+   .size xmm_to_cpu, . - xmm_to_cpu
 
.section.note.GNU-stack,"",@progbits
diff --git a/tools/test/xregs_sig/xregs_sig.c b/tools/test/xregs_sig/xregs_sig.c
index a67379a0080e..4e29165d39e2 100644
--- a/tools/test/xregs_sig/xregs_sig.c
+++ b/tools/test/xregs_sig/xregs_sig.c
@@ -44,30 +44,49 @@
 #ifndef __unused
 #define__unused__attribute__((__unused__))
 #endif
-#ifndef nitems
-#definenitems(x)   (sizeof((x)) / sizeof((x)[0]))
-#endif
 
-#if defined(__amd64__)
-#defineXREGSRNAM   "xmm"
-#defineNREGS   16
-#elif defined(__aarch64__)
-#defineXREGSRNAM   "q"
-#defineNREGS   32
-#endif
-
-struct xregsreg {
-   uint8_t xregs_bytes[16];
+struct xregs_bank {
+   const char  *b_name;
+   const char  *r_name;
+   uint32_tregs;
+   uint32_tbytes;
+   void(*x2c)(uint8_t *);
+   void(*c2x)(uint8_t *);
 };
 
-struct xregs {
-   struct xregsreg xregsreg[NREGS];
+#if defined(__amd64__)
+void cpu_to_xmm(uint8_t *);
+void xmm_to_cpu(uint8_t *);
+
+static const struct xregs_bank xregs_banks[] = {
+   {
+   .b_name = "SSE",
+   .r_name = "xmm",
+   .regs   = 16,
+   .bytes  = 16,
+   .x2c= xmm_to_cpu,
+   .c2x= cpu_to_xmm,
+   },
 };
-
-void cpu_to_xregs(struct xregs *xregs);
-void xregs_to_cpu(struct xregs *xregs);
+#elif defined(__aarch64__)
+void cpu_to_vfp(uint8_t *);
+void vfp_to_cpu(uint8_t *);
+
+static const struct xregs_bank xregs_banks[] = {
+   {
+   .b_name = "VFP",
+   .r_name = "q",
+   .regs   = 32,
+   .bytes  = 16,
+   .x2c= vfp_to_cpu,
+   .c2x= cpu_to_vfp,
+   },
+};
+#endif
 
 static atomic_uint sigs;
+static 

git: c8dbef44ffbe - main - xregs_sig: Add avx registers to test

2023-06-04 Thread Dmitry Chagin
The branch main has been updated by dchagin:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=c8dbef44ffbe8d8acf33a5f20e20ca6b48beb4fa

commit c8dbef44ffbe8d8acf33a5f20e20ca6b48beb4fa
Author: Dmitry Chagin 
AuthorDate: 2023-06-04 09:07:02 +
Commit: Dmitry Chagin 
CommitDate: 2023-06-04 09:07:02 +

xregs_sig: Add avx registers to test

Reviewed by:kib
Differential Revision:  https://reviews.freebsd.org/D40384
---
 tools/test/xregs_sig/c2x2c_aarch64.S |  9 
 tools/test/xregs_sig/c2x2c_amd64.S   | 85 
 tools/test/xregs_sig/xregs_sig.c | 14 +-
 3 files changed, 107 insertions(+), 1 deletion(-)

diff --git a/tools/test/xregs_sig/c2x2c_aarch64.S 
b/tools/test/xregs_sig/c2x2c_aarch64.S
index f53550b867fd..ef29cac8a087 100644
--- a/tools/test/xregs_sig/c2x2c_aarch64.S
+++ b/tools/test/xregs_sig/c2x2c_aarch64.S
@@ -7,6 +7,15 @@
 
.text
 
+   .globl xregs_banks_max
+   .type xregs_banks_max, @function
+xregs_banks_max:
+   mov  x0, #0
+   ret
+
+   .size xregs_banks_max, . - xregs_banks_max
+
+
.globl cpu_to_vfp
.type cpu_to_vfp, @function
 cpu_to_vfp:
diff --git a/tools/test/xregs_sig/c2x2c_amd64.S 
b/tools/test/xregs_sig/c2x2c_amd64.S
index 7348e4871d53..bdc0d782e5c8 100644
--- a/tools/test/xregs_sig/c2x2c_amd64.S
+++ b/tools/test/xregs_sig/c2x2c_amd64.S
@@ -5,8 +5,45 @@
  * $FreeBSD$
  */
 
+#if defined(__FreeBSD__)
+#include 
+#else
+#defineCPUID2_OSXSAVE  0x0800
+#defineCPUID2_AVX  0x1000
+#defineXFEATURE_ENABLED_X870x0001
+#defineXFEATURE_ENABLED_SSE0x0002
+#defineXFEATURE_ENABLED_AVX0x0004
+#defineXFEATURE_AVX\
+(XFEATURE_ENABLED_X87 | XFEATURE_ENABLED_SSE | XFEATURE_ENABLED_AVX)
+#endif
+
.text
 
+   .globl xregs_banks_max
+   .type xregs_banks_max, @function
+xregs_banks_max:
+   pushq   %rbx
+   movl$1, %eax
+   cpuid
+   andl$(CPUID2_AVX|CPUID2_OSXSAVE), %ecx
+   cmpl$(CPUID2_AVX|CPUID2_OSXSAVE), %ecx
+   jne sse
+   xorl%ecx, %ecx
+   xgetbv
+   andl$XFEATURE_AVX, %eax
+   cmpl$XFEATURE_AVX, %eax
+   jne sse
+   movl$1, %eax
+   jmp out
+sse:
+   xorl%eax, %eax
+out:
+   popq%rbx
+   retq
+
+   .size xregs_banks_max, . - xregs_banks_max
+
+
.globl cpu_to_xmm
.type cpu_to_xmm, @function
 cpu_to_xmm:
@@ -54,4 +91,52 @@ xmm_to_cpu:
 
.size xmm_to_cpu, . - xmm_to_cpu
 
+
+   .globl cpu_to_avx
+   .type cpu_to_avx, @function
+cpu_to_avx:
+   vmovdqu %ymm0, (%rdi)
+   vmovdqu %ymm1, 1 * 32(%rdi)
+   vmovdqu %ymm2, 2 * 32(%rdi)
+   vmovdqu %ymm3, 3 * 32(%rdi)
+   vmovdqu %ymm4, 4 * 32(%rdi)
+   vmovdqu %ymm5, 5 * 32(%rdi)
+   vmovdqu %ymm6, 6 * 32(%rdi)
+   vmovdqu %ymm7, 7 * 32(%rdi)
+   vmovdqu %ymm8, 8 * 32(%rdi)
+   vmovdqu %ymm9, 9 * 32(%rdi)
+   vmovdqu %ymm10, 10 * 32(%rdi)
+   vmovdqu %ymm11, 11 * 32(%rdi)
+   vmovdqu %ymm12, 12 * 32(%rdi)
+   vmovdqu %ymm13, 13 * 32(%rdi)
+   vmovdqu %ymm14, 14 * 32(%rdi)
+   vmovdqu %ymm15, 15 * 32(%rdi)
+   retq
+
+   .size cpu_to_avx, . - cpu_to_avx
+
+
+   .globl avx_to_cpu
+   .type avx_to_cpu, @function
+avx_to_cpu:
+   vmovdqu (%rdi), %ymm0
+   vmovdqu 1 * 32(%rdi), %ymm1
+   vmovdqu 2 * 32(%rdi), %ymm2
+   vmovdqu 3 * 32(%rdi), %ymm3
+   vmovdqu 4 * 32(%rdi), %ymm4
+   vmovdqu 5 * 32(%rdi), %ymm5
+   vmovdqu 6 * 32(%rdi), %ymm6
+   vmovdqu 7 * 32(%rdi), %ymm7
+   vmovdqu 8 * 32(%rdi), %ymm8
+   vmovdqu 9 * 32(%rdi), %ymm9
+   vmovdqu 10 * 32(%rdi), %ymm10
+   vmovdqu 11 * 32(%rdi), %ymm11
+   vmovdqu 12 * 32(%rdi), %ymm12
+   vmovdqu 13 * 32(%rdi), %ymm13
+   vmovdqu 14 * 32(%rdi), %ymm14
+   vmovdqu 15 * 32(%rdi), %ymm15
+   retq
+
+   .size avx_to_cpu, . - avx_to_cpu
+
.section.note.GNU-stack,"",@progbits
diff --git a/tools/test/xregs_sig/xregs_sig.c b/tools/test/xregs_sig/xregs_sig.c
index 4e29165d39e2..2ed47b4eb3bc 100644
--- a/tools/test/xregs_sig/xregs_sig.c
+++ b/tools/test/xregs_sig/xregs_sig.c
@@ -54,9 +54,13 @@ struct xregs_bank {
void(*c2x)(uint8_t *);
 };
 
+int xregs_banks_max(void);
+
 #if defined(__amd64__)
 void cpu_to_xmm(uint8_t *);
 void xmm_to_cpu(uint8_t *);
+void cpu_to_avx(uint8_t *);
+void avx_to_cpu(uint8_t *);
 
 static const struct xregs_bank xregs_banks[] = {
{
@@ -67,6 +71,14 @@ static const struct xregs_bank xregs_banks[] = {
.x2c= xmm_to_cpu,
.c2x= cpu_to_xmm,
},
+   {
+   .b_name = "AVX",
+   .r_name = "ymm",
+   .regs   = 16,
+   .bytes  = 32,
+   .x2c= 

git: 9d5a47e13c17 - main - ossl: Provide a fallback definition of __uint128_t when needed

2023-06-04 Thread Mark Johnston
The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=9d5a47e13c175adf7486956847c3d060fe059f2c

commit 9d5a47e13c175adf7486956847c3d060fe059f2c
Author: Mark Johnston 
AuthorDate: 2023-06-02 22:18:05 +
Commit: Mark Johnston 
CommitDate: 2023-06-04 16:39:44 +

ossl: Provide a fallback definition of __uint128_t when needed

This is required on i386.  The patch has no functional change, since
AES-GCM isn't implemented for that platform.

Fixes:  9a3444d91c70 ("ossl: Add a VAES-based AES-GCM implementation for 
amd64")
Reported by:Jenkins
---
 sys/crypto/openssl/ossl_aes_gcm.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/sys/crypto/openssl/ossl_aes_gcm.h 
b/sys/crypto/openssl/ossl_aes_gcm.h
index 9ce8ee193483..cd0c1e324354 100644
--- a/sys/crypto/openssl/ossl_aes_gcm.h
+++ b/sys/crypto/openssl/ossl_aes_gcm.h
@@ -49,6 +49,10 @@ struct ossl_aes_gcm_ops {
size_t len);
 };
 
+#ifndef __SIZEOF_INT128__
+typedefstruct { uint64_t v[2]; } __uint128_t;
+#endif
+
 struct ossl_gcm_context {
struct {
union {



git: 02d90458669d - main - tslog: Handle curthread equal to NULL

2023-06-04 Thread Colin Percival
The branch main has been updated by cperciva:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=02d90458669d6f8063ef32e35069e9246f487b37

commit 02d90458669d6f8063ef32e35069e9246f487b37
Author: Colin Percival 
AuthorDate: 2023-05-21 20:03:33 +
Commit: Colin Percival 
CommitDate: 2023-06-04 17:16:22 +

tslog: Handle curthread equal to NULL

Early in the kernel boot, curthread goes through three stages:

1. Kernel crash when you try to access it, because PCPU doesn't exist.
2. NULL, because PCU exists but isn't initialized.
3. &thread0, which is where most of the kernel boot process runs.

This broke TSLOG from inside hammer_time since the scripts which parse
logged records didn't understand that NULL meant &thread0.

Tell tslog to record &thread0 as the active thread if passed NULL.

Sponsored by:   https://www.patreon.com/cperciva
Differential Revision:  https://reviews.freebsd.org/D40324
---
 sys/kern/kern_tslog.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/sys/kern/kern_tslog.c b/sys/kern/kern_tslog.c
index 5eba7719880d..3629f7d88a93 100644
--- a/sys/kern/kern_tslog.c
+++ b/sys/kern/kern_tslog.c
@@ -59,6 +59,10 @@ tslog(void * td, int type, const char * f, const char * s)
uint64_t tsc = get_cyclecount();
long pos;
 
+   /* A NULL thread is thread0 before curthread is set. */
+   if (td == NULL)
+   td = &thread0;
+
/* Grab a slot. */
pos = atomic_fetchadd_long(&nrecs, 1);
 



git: 469cfa3c30ee - main - tslog: Annotate some early boot functions

2023-06-04 Thread Colin Percival
The branch main has been updated by cperciva:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=469cfa3c30ee7a5ddeb597d0a8c3e7cac909b27a

commit 469cfa3c30ee7a5ddeb597d0a8c3e7cac909b27a
Author: Colin Percival 
AuthorDate: 2023-05-22 09:54:04 +
Commit: Colin Percival 
CommitDate: 2023-06-04 17:16:22 +

tslog: Annotate some early boot functions

Booting an amd64 kernel on Firecracker with 1 CPU and 128 MB of RAM,
hammer_time takes roughly 2740 us:
* 55 us in xen_pvh_parse_preload_data
  * 20 us in boot_parse_cmdline_delim
  * 20 us in boot_env_to_howto
* 15 us in identify_hypervisor
* 1320 us in link_elf_reloc
  * 1310 us in relocate_file1 handling ef->rela
* 25 us in init_param1
* 30 us in dpcpu_init
* 355 us in initializecpu
  * 255 us in initializecpu calling load_cr4
* 425 us in getmemsize
  * 280 us in pmap_bootstrap
* 205 us in create_pagetables
* 10 us in init_param2
* 25 us in pci_early_quirks
* 60 us in cninit
* 90 us in kdb_init
* 105 us in msgbufinit
* 20 us in fpuinit
* 205 us elsewhere in hammer_time

Some of these are unavoidable (e.g. identify_hypervisor uses CPUID and
load_cr4 loads the CR4 register, both of which trap to the hypervisor)
but others may deserve attention.

Sponsored by:   https://www.patreon.com/cperciva
Differential Revision:  https://reviews.freebsd.org/D40325
---
 sys/amd64/amd64/fpu.c  | 3 +++
 sys/amd64/amd64/initcpu.c  | 4 
 sys/amd64/amd64/machdep.c  | 2 ++
 sys/amd64/amd64/pmap.c | 4 
 sys/kern/kern_cons.c   | 3 +++
 sys/kern/link_elf.c| 7 +++
 sys/kern/subr_boot.c   | 5 +
 sys/kern/subr_kdb.c| 3 +++
 sys/kern/subr_param.c  | 4 
 sys/kern/subr_pcpu.c   | 2 ++
 sys/kern/subr_prf.c| 3 +++
 sys/x86/pci/pci_early_quirks.c | 3 +++
 sys/x86/x86/identcpu.c | 7 ++-
 sys/x86/xen/pv.c   | 3 +++
 14 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c
index a3421cf0d496..1310a27911fe 100644
--- a/sys/amd64/amd64/fpu.c
+++ b/sys/amd64/amd64/fpu.c
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -360,6 +361,7 @@ fpuinit(void)
u_int mxcsr;
u_short control;
 
+   TSENTER();
if (IS_BSP())
fpuinit_bsp1();
 
@@ -401,6 +403,7 @@ fpuinit(void)
ldmxcsr(mxcsr);
start_emulating();
intr_restore(saveintr);
+   TSEXIT();
 }
 
 /*
diff --git a/sys/amd64/amd64/initcpu.c b/sys/amd64/amd64/initcpu.c
index a17ef89ba9f8..0de4bc3e2d60 100644
--- a/sys/amd64/amd64/initcpu.c
+++ b/sys/amd64/amd64/initcpu.c
@@ -276,6 +276,7 @@ initializecpu(void)
uint64_t msr;
uint32_t cr4;
 
+   TSENTER();
cr4 = rcr4();
if ((cpu_feature & CPUID_XMM) && (cpu_feature & CPUID_FXSR)) {
cr4 |= CR4_FXSR | CR4_XMM;
@@ -311,7 +312,9 @@ initializecpu(void)
if (cpu_stdext_feature & CPUID_STDEXT_SMAP)
cr4 |= CR4_SMAP;
}
+   TSENTER2("load_cr4");
load_cr4(cr4);
+   TSEXIT2("load_cr4");
/* Reload cpu ext features to reflect cr4 changes */
if (IS_BSP() && cold)
identify_cpu_ext_features();
@@ -340,6 +343,7 @@ initializecpu(void)
 
if (!IS_BSP())
cpu_init_small_core();
+   TSEXIT();
 }
 
 void
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 29a0bd6f9db4..dfd60777110f 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -870,6 +870,7 @@ getmemsize(caddr_t kmdp, u_int64_t first)
quad_t dcons_addr, dcons_size;
int page_counter;
 
+   TSENTER();
/*
 * Tell the physical memory allocator about pages used to store
 * the kernel and preloaded data.  See kmem_bootstrap_free().
@@ -1125,6 +1126,7 @@ do_next:
 
/* Map the message buffer. */
msgbufp = (struct msgbuf *)PHYS_TO_DMAP(phys_avail[pa_indx]);
+   TSEXIT();
 }
 
 static caddr_t
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 6de7f955d624..889311d598d6 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -1668,6 +1668,7 @@ create_pagetables(vm_paddr_t *firstaddr)
 #endif
int i, j, ndm1g, nkpdpe, nkdmpde;
 
+   TSENTER();
/* Allocate page table pages for the direct map */
ndmpdp = howmany(ptoa(Maxmem), NBPDP);
if (ndmpdp < 4) /* Minimum 4GB of dirmap */
@@ -1884,6 +1885,7 @@ create_pagetables(vm_paddr_t *firstaddr)
}
 
kernel_pml4 = (pml4_entry_t *)PHYS_TO_DMAP(KPML4phys);
+   TSEXIT();
 }
 
 /*
@@ -1906,6 +1908,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
u_long res;
int i;
 
+   TSENTER();
KERNend = *firstaddr;

git: 2404380aac7e - main - tslog: Optionally instrument pmap_zero_page

2023-06-04 Thread Colin Percival
The branch main has been updated by cperciva:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=2404380aac7eaf8019aa0939224bbce2d561d01f

commit 2404380aac7eaf8019aa0939224bbce2d561d01f
Author: Colin Percival 
AuthorDate: 2023-05-29 23:03:14 +
Commit: Colin Percival 
CommitDate: 2023-06-04 17:16:31 +

tslog: Optionally instrument pmap_zero_page

Booting an amd64 kernel on Firecracker with 1 CPU and 128 MB of RAM,
pmap_zero_page is responsible for 4.6 ms of the 25.0 ms of boot time.
This is not in fact time spent zeroing pages though; almost all of
that time is spent in a first-touch penalty, presumably due to the
host Linux kernel faulting in backing pages one by one.

There's probably a way to improve that by teaching Firecracker to
fault in all the VM's pages from the start rather than having them
faulted in one at a time, but that's outside of FreeBSD's control.

This commit adds a TSLOG_PAGEZERO option which enables TSLOG on the
amd64 pmap_zero_page function; it's a separate option (turned off
by default even if TSLOG is enabled) since zeroing pages happens
enough that it can easily fill the TSLOG buffer and prevent other
timing information from being recorded.

Sponsored by:   https://www.patreon.com/cperciva
Differential Revision:  https://reviews.freebsd.org/D40326
---
 sys/amd64/amd64/pmap.c | 9 -
 sys/conf/NOTES | 3 +++
 sys/conf/options   | 1 +
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 889311d598d6..657ba67cd619 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -8155,9 +8155,16 @@ pmap_vmspace_copy(pmap_t dst_pmap, pmap_t src_pmap)
 void
 pmap_zero_page(vm_page_t m)
 {
-   vm_offset_t va = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m));
+   vm_offset_t va;
 
+#ifdef TSLOG_PAGEZERO
+   TSENTER();
+#endif
+   va = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m));
pagezero((void *)va);
+#ifdef TSLOG_PAGEZERO
+   TSEXIT();
+#endif
 }
 
 /*
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index 8725d11a5434..23ec7b5c45c9 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -615,6 +615,9 @@ options NUM_CORE_FILES=5
 # before it is possible to use more sophisticated tools like DTrace.
 # The TSLOGSIZE option controls the size of the (preallocated, fixed
 # length) buffer used for storing these events (default: 262144 records).
+# The TSLOG_PAGEZERO option enables TSLOG of pmap_zero_page; this must be
+# enabled separately since it typically generates too many records to be
+# useful.
 #
 # For security reasons the TSLOG option should not be enabled on systems
 # used in production.
diff --git a/sys/conf/options b/sys/conf/options
index a8b441e320cb..7a34fa0f7333 100644
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -67,6 +67,7 @@ SYSCTL_DEBUG  opt_sysctl.h
 TEXTDUMP_PREFERRED opt_ddb.h
 TEXTDUMP_VERBOSE   opt_ddb.h
 TSLOG  opt_global.h
+TSLOG_PAGEZERO opt_global.h
 TSLOGSIZE  opt_global.h
 
 # Miscellaneous options.



git: 45cc8519f590 - main - tslog: Annotate parts of SYSINIT cpu

2023-06-04 Thread Colin Percival
The branch main has been updated by cperciva:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=45cc8519f5900574826dfd22c851b136023d044e

commit 45cc8519f5900574826dfd22c851b136023d044e
Author: Colin Percival 
AuthorDate: 2023-05-30 00:29:24 +
Commit: Colin Percival 
CommitDate: 2023-06-04 17:16:35 +

tslog: Annotate parts of SYSINIT cpu

Booting an amd64 kernel on Firecracker with 1 CPU and 128 MB of RAM,
SYSINIT cpu takes roughly 2770 us:
* 2280 us in vm_ksubmap_init
  * 535 us in kmem_malloc
* 450 us in pmap_zero_page
  * 1720 us in pmap_growkernel
* 1620 us in pmap_zero_page
* 80 us in bufinit
* 480 us in cpu_setregs
  * 430 us in cpu_setregs calling load_cr0

Much of this is hypervisor overhead: load_cr0 is slow because it traps
to the hypervisor, and 99% of the time in pmap_zero_page is spent when
we first touch the page, presumably due to the host Linux kernel
faulting in backing pages one by one.

Sponsored by:   https://www.patreon.com/cperciva
Differential Revision:  https://reviews.freebsd.org/D40327
---
 sys/amd64/amd64/machdep.c |  4 
 sys/amd64/amd64/pmap.c|  7 ++-
 sys/kern/vfs_bio.c|  2 ++
 sys/vm/vm_init.c  |  2 ++
 sys/vm/vm_kern.c  | 12 ++--
 5 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index dfd60777110f..fa3ffe84bfe1 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -326,13 +326,17 @@ cpu_setregs(void)
 {
register_t cr0;
 
+   TSENTER();
cr0 = rcr0();
/*
 * CR0_MP, CR0_NE and CR0_TS are also set by npx_probe() for the
 * BSP.  See the comments there about why we set them.
 */
cr0 |= CR0_MP | CR0_NE | CR0_TS | CR0_WP | CR0_AM;
+   TSENTER2("load_cr0");
load_cr0(cr0);
+   TSEXIT2("load_cr0");
+   TSEXIT();
 }
 
 /*
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 657ba67cd619..123811ed573f 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -5049,6 +5049,7 @@ pmap_growkernel(vm_offset_t addr)
pdp_entry_t *pdpe;
vm_offset_t end;
 
+   TSENTER();
mtx_assert(&kernel_map->system_mtx, MA_OWNED);
 
/*
@@ -5075,8 +5076,10 @@ pmap_growkernel(vm_offset_t addr)
 */
if (KERNBASE < addr) {
end = KERNBASE + nkpt * NBPDR;
-   if (end == 0)
+   if (end == 0) {
+   TSEXIT();
return;
+   }
} else {
end = kernel_vm_end;
}
@@ -5089,6 +5092,7 @@ pmap_growkernel(vm_offset_t addr)
 * The grown region is already mapped, so there is
 * nothing to do.
 */
+   TSEXIT();
return;
}
 
@@ -5136,6 +5140,7 @@ pmap_growkernel(vm_offset_t addr)
kernel_vm_end = end;
else
nkpt = howmany(end - KERNBASE, NBPDR);
+   TSEXIT();
 }
 
 /***
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index a76ea26d8859..cf01d2a239ea 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -1201,6 +1201,7 @@ bufinit(void)
struct buf *bp;
int i;
 
+   TSENTER();
KASSERT(maxbcachebuf >= MAXBSIZE,
("maxbcachebuf (%d) must be >= MAXBSIZE (%d)\n", maxbcachebuf,
MAXBSIZE));
@@ -1336,6 +1337,7 @@ bufinit(void)
buffreekvacnt = counter_u64_alloc(M_WAITOK);
bufdefragcnt = counter_u64_alloc(M_WAITOK);
bufkvaspace = counter_u64_alloc(M_WAITOK);
+   TSEXIT();
 }
 
 #ifdef INVARIANTS
diff --git a/sys/vm/vm_init.c b/sys/vm/vm_init.c
index c5a58c7a0ac7..86b1ade64cb6 100644
--- a/sys/vm/vm_init.c
+++ b/sys/vm/vm_init.c
@@ -156,6 +156,7 @@ vm_ksubmap_init(struct kva_md_info *kmi)
vm_offset_t minaddr;
vm_offset_t maxaddr;
 
+   TSENTER();
/*
 * Allocate space for system data structures.
 * The first available kernel virtual address is in "v".
@@ -252,4 +253,5 @@ again:
exec_map_entries * exec_map_entry_size + 64 * PAGE_SIZE, false);
kmem_subinit(pipe_map, kernel_map, &minaddr, &maxaddr, maxpipekva,
false);
+   TSEXIT();
 }
diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c
index 10fe07cc86da..8b4e69dbebc2 100644
--- a/sys/vm/vm_kern.c
+++ b/sys/vm/vm_kern.c
@@ -451,8 +451,12 @@ kmem_malloc_domain(int domain, vm_size_t size, int flags)
 void *
 kmem_malloc(vm_size_t size, int flags)
 {
+   void * p;
 
-   return (kmem_malloc_domainset(DOMAINSET_RR(), size, flags));
+   TSENTER();
+   p = kmem_malloc_domainset(DOMAINSET_RR(), size, flags);
+   TSEXIT();
+   return (p);
 }
 
 void *
@@ -731,17 +735,21 @@ kva_import(void *unused, vmem_size_t size, int flags, 
vmem_addr_t *addrp)
 

git: 89bd147dbf8e - stable/13 - ffs: restore backward compatibility of newfs and makefs with older binaries

2023-06-04 Thread Chuck Silvers
The branch stable/13 has been updated by chs:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=89bd147dbf8e30acf76838a4170025261c2f3b38

commit 89bd147dbf8e30acf76838a4170025261c2f3b38
Author: Chuck Silvers 
AuthorDate: 2023-05-30 02:26:28 +
Commit: Chuck Silvers 
CommitDate: 2023-06-04 11:00:22 +

ffs: restore backward compatibility of newfs and makefs with older binaries

The previous change to CGSIZE had the unintended side-effect of allowing
newfs and makefs to create file systems that would fail validation when
examined by older commands and kernels, by allowing newfs/makefs to pack
slightly more blocks into a CG than those older binaries think is valid.
Fix this by having newfs/makefs artificially restrict the number of blocks
in a CG to the slightly smaller value that those older binaries will accept.
The validation code will continue to accept the slightly larger value
that the current newfs/makefs (before this change) could create.

Fixes:  0a6e34e950cd5889122a199c34519b67569be9cc
Reviewed by:mckusick
MFC after:  3 days
Sponsored by:   Netflix

(cherry picked from commit d464a7698de8fe18530ea65fac90dce56b860a59)
---
 sbin/newfs/mkfs.c  | 26 +++---
 usr.sbin/makefs/ffs/mkfs.c | 26 +++---
 2 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c
index 42866f9b1426..7b55c5c1f229 100644
--- a/sbin/newfs/mkfs.c
+++ b/sbin/newfs/mkfs.c
@@ -76,6 +76,23 @@ __FBSDID("$FreeBSD$");
 #define UMASK  0755
 #define POWEROF2(num)  (((num) & ((num) - 1)) == 0)
 
+/*
+ * The definition of "struct cg" used to contain an extra field at the end
+ * to represent the variable-length data that followed the fixed structure.
+ * This had the effect of artificially limiting the number of blocks that
+ * newfs would put in a CG, since newfs thought that the fixed-size header
+ * was bigger than it really was.  When we started validating that the CG
+ * header data actually fit into one fs block, the placeholder field caused
+ * a problem because it caused struct cg to be a different size depending on
+ * platform.  The placeholder field was later removed, but this caused a
+ * backward compatibility problem with older binaries that still thought
+ * struct cg was larger, and a new file system could fail validation if
+ * viewed by the older binaries.  To avoid this compatibility problem, we
+ * now artificially reduce the amount of space that the variable-length data
+ * can use such that new file systems will pass validation by older binaries.
+ */
+#define CGSIZEFUDGE 8
+
 static struct  csum *fscs;
 #definesblock  disk.d_fs
 #defineacg disk.d_cg
@@ -369,7 +386,8 @@ retry:
sblock.fs_fpg = minfpg;
sblock.fs_ipg = roundup(howmany(sblock.fs_fpg, fragsperinode),
INOPB(&sblock));
-   if (CGSIZE(&sblock) < (unsigned long)sblock.fs_bsize)
+   if (CGSIZE(&sblock) < (unsigned long)sblock.fs_bsize -
+   CGSIZEFUDGE)
break;
density -= sblock.fs_fsize;
}
@@ -388,9 +406,11 @@ retry:
if (Oflag > 1 || (Oflag == 1 && sblock.fs_ipg <= 0x7fff)) {
if (sblock.fs_size / sblock.fs_fpg < MINCYLGRPS)
break;
-   if (CGSIZE(&sblock) < (unsigned long)sblock.fs_bsize)
+   if (CGSIZE(&sblock) < (unsigned long)sblock.fs_bsize -
+   CGSIZEFUDGE)
continue;
-   if (CGSIZE(&sblock) == (unsigned long)sblock.fs_bsize)
+   if (CGSIZE(&sblock) == (unsigned long)sblock.fs_bsize -
+   CGSIZEFUDGE)
break;
}
sblock.fs_fpg -= sblock.fs_frag;
diff --git a/usr.sbin/makefs/ffs/mkfs.c b/usr.sbin/makefs/ffs/mkfs.c
index d48dc65aac68..4e88dae7aae8 100644
--- a/usr.sbin/makefs/ffs/mkfs.c
+++ b/usr.sbin/makefs/ffs/mkfs.c
@@ -80,6 +80,23 @@ static int count_digits(int);
 #defineUMASK   0755
 #definePOWEROF2(num)   (((num) & ((num) - 1)) == 0)
 
+/*
+ * The definition of "struct cg" used to contain an extra field at the end
+ * to represent the variable-length data that followed the fixed structure.
+ * This had the effect of artificially limiting the number of blocks that
+ * newfs would put in a CG, since newfs thought that the fixed-size header
+ * was bigger than it really was.  When we started validating that the CG
+ * header data actually fit into one fs block, the placeholder field caused
+ * a problem because it caused struct cg to be a different size depending on
+ * platform.  The placeholder field was later removed, but this caused a
+ * backward compatibility problem with older binaries t

git: 59588a546f55 - main - Revert "tslog: Annotate some early boot functions"

2023-06-04 Thread Colin Percival
The branch main has been updated by cperciva:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=59588a546f55523d6fd37ab42eb08b719311d7d6

commit 59588a546f55523d6fd37ab42eb08b719311d7d6
Author: Colin Percival 
AuthorDate: 2023-06-04 18:39:45 +
Commit: Colin Percival 
CommitDate: 2023-06-04 18:39:45 +

Revert "tslog: Annotate some early boot functions"

The change to subr_boot.c broke the libsa build because the TSLOG
macros have their own definitions for the boot loader -- I didn't
realize that the loader code used subr_boot.c.

I'm currently testing a fix and I'll revert this revert once I'm
satisfied that everything works, but I don't want to leave the
tree broken for too long.

This reverts commit 469cfa3c30ee7a5ddeb597d0a8c3e7cac909b27a.
---
 sys/amd64/amd64/fpu.c  | 3 ---
 sys/amd64/amd64/initcpu.c  | 4 
 sys/amd64/amd64/machdep.c  | 2 --
 sys/amd64/amd64/pmap.c | 4 
 sys/kern/kern_cons.c   | 3 ---
 sys/kern/link_elf.c| 7 ---
 sys/kern/subr_boot.c   | 5 -
 sys/kern/subr_kdb.c| 3 ---
 sys/kern/subr_param.c  | 4 
 sys/kern/subr_pcpu.c   | 2 --
 sys/kern/subr_prf.c| 3 ---
 sys/x86/pci/pci_early_quirks.c | 3 ---
 sys/x86/x86/identcpu.c | 7 +--
 sys/x86/xen/pv.c   | 3 ---
 14 files changed, 1 insertion(+), 52 deletions(-)

diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c
index 1310a27911fe..a3421cf0d496 100644
--- a/sys/amd64/amd64/fpu.c
+++ b/sys/amd64/amd64/fpu.c
@@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -361,7 +360,6 @@ fpuinit(void)
u_int mxcsr;
u_short control;
 
-   TSENTER();
if (IS_BSP())
fpuinit_bsp1();
 
@@ -403,7 +401,6 @@ fpuinit(void)
ldmxcsr(mxcsr);
start_emulating();
intr_restore(saveintr);
-   TSEXIT();
 }
 
 /*
diff --git a/sys/amd64/amd64/initcpu.c b/sys/amd64/amd64/initcpu.c
index 0de4bc3e2d60..a17ef89ba9f8 100644
--- a/sys/amd64/amd64/initcpu.c
+++ b/sys/amd64/amd64/initcpu.c
@@ -276,7 +276,6 @@ initializecpu(void)
uint64_t msr;
uint32_t cr4;
 
-   TSENTER();
cr4 = rcr4();
if ((cpu_feature & CPUID_XMM) && (cpu_feature & CPUID_FXSR)) {
cr4 |= CR4_FXSR | CR4_XMM;
@@ -312,9 +311,7 @@ initializecpu(void)
if (cpu_stdext_feature & CPUID_STDEXT_SMAP)
cr4 |= CR4_SMAP;
}
-   TSENTER2("load_cr4");
load_cr4(cr4);
-   TSEXIT2("load_cr4");
/* Reload cpu ext features to reflect cr4 changes */
if (IS_BSP() && cold)
identify_cpu_ext_features();
@@ -343,7 +340,6 @@ initializecpu(void)
 
if (!IS_BSP())
cpu_init_small_core();
-   TSEXIT();
 }
 
 void
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index fa3ffe84bfe1..757606311123 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -874,7 +874,6 @@ getmemsize(caddr_t kmdp, u_int64_t first)
quad_t dcons_addr, dcons_size;
int page_counter;
 
-   TSENTER();
/*
 * Tell the physical memory allocator about pages used to store
 * the kernel and preloaded data.  See kmem_bootstrap_free().
@@ -1130,7 +1129,6 @@ do_next:
 
/* Map the message buffer. */
msgbufp = (struct msgbuf *)PHYS_TO_DMAP(phys_avail[pa_indx]);
-   TSEXIT();
 }
 
 static caddr_t
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 123811ed573f..b2abab429730 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -1668,7 +1668,6 @@ create_pagetables(vm_paddr_t *firstaddr)
 #endif
int i, j, ndm1g, nkpdpe, nkdmpde;
 
-   TSENTER();
/* Allocate page table pages for the direct map */
ndmpdp = howmany(ptoa(Maxmem), NBPDP);
if (ndmpdp < 4) /* Minimum 4GB of dirmap */
@@ -1885,7 +1884,6 @@ create_pagetables(vm_paddr_t *firstaddr)
}
 
kernel_pml4 = (pml4_entry_t *)PHYS_TO_DMAP(KPML4phys);
-   TSEXIT();
 }
 
 /*
@@ -1908,7 +1906,6 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
u_long res;
int i;
 
-   TSENTER();
KERNend = *firstaddr;
res = atop(KERNend - (vm_paddr_t)kernphys);
 
@@ -2064,7 +2061,6 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
 */
load_cr4(rcr4() | CR4_PCIDE);
}
-   TSEXIT();
 }
 
 /*
diff --git a/sys/kern/kern_cons.c b/sys/kern/kern_cons.c
index ff57b2bdfd8a..7c63b8e4ed9c 100644
--- a/sys/kern/kern_cons.c
+++ b/sys/kern/kern_cons.c
@@ -64,7 +64,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -135,7 +134,6 @@ cninit(void)
 {
struct consdev *best_cn, *cn, **list;
 
-   TSENTER();
/*
 * Check if we should mute the console (for s

git: 5c7d0391c35e - Create tag vendor/llvm-project/llvmorg-16.0.5-0-g185b81e034ba

2023-06-04 Thread Dimitry Andric
The annotated tag vendor/llvm-project/llvmorg-16.0.5-0-g185b81e034ba has been 
created by dim:

URL: 
https://cgit.FreeBSD.org/src/tag/?h=vendor/llvm-project/llvmorg-16.0.5-0-g185b81e034ba

tag vendor/llvm-project/llvmorg-16.0.5-0-g185b81e034ba
Tagger: Dimitry Andric 
TaggerDate: 2023-06-04 19:00:38 +

Tag llvm-project branch release/16.x llvmorg-16.0.5-0-g185b81e034ba (aka 16.0.5 
release).

commit 3b922bd9516f6dc5146815ed8d4363fcbe97997f
Author: Dimitry Andric 
AuthorDate: 2023-06-04 19:00:19 +
Commit: Dimitry Andric 
CommitDate: 2023-06-04 19:00:19 +

Vendor import of llvm-project branch release/16.x 
llvmorg-16.0.5-0-g185b81e034ba (aka 16.0.5 release).



git: 791701a7dc62..3b922bd9516f - vendor/llvm-project/release-16.x - vendor branch updated

2023-06-04 Thread Dimitry Andric
The branch vendor/llvm-project/release-16.x has been updated by dim:

URL: https://cgit.FreeBSD.org/src/log/?id=791701a7dc62..3b922bd9516f

3b922bd9516f Vendor import of llvm-project branch release/16.x 
llvmorg-16.0.5-0-g185b81e034ba (aka 16.0.5 release).



git: 6fa30de4d3ca - main - nfsuserd.8: Change machines to machine's

2023-06-04 Thread Rick Macklem
The branch main has been updated by rmacklem:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=6fa30de4d3caf5be3fd4dd44bf73fda0fb7616c5

commit 6fa30de4d3caf5be3fd4dd44bf73fda0fb7616c5
Author: Rick Macklem 
AuthorDate: 2023-06-04 19:52:04 +
Commit: Rick Macklem 
CommitDate: 2023-06-04 19:52:04 +

nfsuserd.8: Change machines to machine's

Change machines to machine's.

Suggested by:   grahamperrin
Differential Revision:  https://reviews.freebsd.org/D39877
---
 usr.sbin/nfsuserd/nfsuserd.8 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.sbin/nfsuserd/nfsuserd.8 b/usr.sbin/nfsuserd/nfsuserd.8
index 9fff5cd12a30..1912043668b5 100644
--- a/usr.sbin/nfsuserd/nfsuserd.8
+++ b/usr.sbin/nfsuserd/nfsuserd.8
@@ -53,7 +53,7 @@ owner and owner_group strings.
 It also provides support for manage-gids and must be running on the server if
 this is being used for any version of NFS.
 .Pp
-Upon startup, it loads the machines DNS domain name, plus timeout and cache 
size
+Upon startup, it loads the machine's DNS domain name, plus timeout and cache 
size
 limit into the kernel.
 It then preloads the cache with group and user information, up to the cache 
size
 limit and forks off



git: 4d779448adb3 - main - gve: Fix build on i386 and enable LINT builds.

2023-06-04 Thread Xin LI
The branch main has been updated by delphij:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=4d779448adb32ef6424abb781dab87065964d42f

commit 4d779448adb32ef6424abb781dab87065964d42f
Author: Xin LI 
AuthorDate: 2023-06-04 23:35:00 +
Commit: Xin LI 
CommitDate: 2023-06-04 23:35:00 +

gve: Fix build on i386 and enable LINT builds.

Reviewed-by:imp
Differential Revision: https://reviews.freebsd.org/D40419
---
 share/man/man4/Makefile  | 5 +
 sys/amd64/conf/LINT-NOIP | 1 +
 sys/amd64/conf/NOTES | 3 +++
 sys/arm64/conf/NOTES | 3 +++
 sys/dev/gve/gve_qpl.c| 6 +++---
 sys/i386/conf/NOTES  | 3 +++
 sys/modules/Makefile | 5 +
 7 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index 9149a562383f..2567cde793ee 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -891,15 +891,12 @@ _nvme.4=  nvme.4
 
 .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \
 ${MACHINE_CPUARCH} == "aarch64"
+_gve.4=gve.4
 _ipmi.4=   ipmi.4
 _linux.4=  linux.4
 _ossl.4=   ossl.4
 .endif
 
-.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "aarch64"
-_gve.4=gve.4
-.endif
-
 .if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "aarch64" || \
 ${MACHINE_CPUARCH} == "riscv"
 _cgem.4=   cgem.4
diff --git a/sys/amd64/conf/LINT-NOIP b/sys/amd64/conf/LINT-NOIP
index 0d4ec1e8c1ac..05b1ce75f57f 100644
--- a/sys/amd64/conf/LINT-NOIP
+++ b/sys/amd64/conf/LINT-NOIP
@@ -13,6 +13,7 @@ nodevice ale
 nodevice bxe
 nodevice em
 nodevice fxp
+nodevice gve
 nodevice jme
 nodevice lio
 nodevice msk
diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES
index ef0f7076633f..3ae61c8ac922 100644
--- a/sys/amd64/conf/NOTES
+++ b/sys/amd64/conf/NOTES
@@ -499,6 +499,9 @@ device  virtio_console  # VirtIO Console device
 # Linux KVM paravirtualization support
 device kvm_clock   # KVM paravirtual clock driver
 
+# Google Virtual NIC
+device gve # Google Virtual NIC (gVNIC) driver
+
 # Microsoft Hyper-V enhancement support
 device hyperv  # HyperV drivers
 device hvhid   # HyperV HID device
diff --git a/sys/arm64/conf/NOTES b/sys/arm64/conf/NOTES
index ce5b071e5ab5..d309ee346b67 100644
--- a/sys/arm64/conf/NOTES
+++ b/sys/arm64/conf/NOTES
@@ -68,6 +68,9 @@ devicevirtio_mmio
 device virtio_blk
 device vtnet
 
+# Google Virtual NIC
+device gve # Google Virtual NIC (gVNIC) driver
+
 # Microsoft Hyper-V
 device hyperv
 
diff --git a/sys/dev/gve/gve_qpl.c b/sys/dev/gve/gve_qpl.c
index 891d132d2f10..3c6d9af6feee 100644
--- a/sys/dev/gve/gve_qpl.c
+++ b/sys/dev/gve/gve_qpl.c
@@ -101,9 +101,9 @@ gve_alloc_qpl(struct gve_priv *priv, uint32_t id, int 
npages, bool single_kva)
int i;
 
if (npages + priv->num_registered_pages > priv->max_registered_pages) {
-   device_printf(priv->dev, "Reached max number of registered 
pages %lu > %lu\n",
-   npages + priv->num_registered_pages,
-   priv->max_registered_pages);
+   device_printf(priv->dev, "Reached max number of registered 
pages %ju > %ju\n",
+   (uintmax_t)npages + priv->num_registered_pages,
+   (uintmax_t)priv->max_registered_pages);
return (EINVAL);
}
 
diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES
index 4e4c6193ebab..65218529e565 100644
--- a/sys/i386/conf/NOTES
+++ b/sys/i386/conf/NOTES
@@ -701,6 +701,9 @@ device  virtio_console  # VirtIO Console device
 # Linux KVM paravirtualization support
 device kvm_clock   # KVM paravirtual clock driver
 
+# Google Virtual NIC
+device gve # Google Virtual NIC (gVNIC) driver
+
 optionsHYPERV
 device hyperv  # HyperV drivers
 device hvhid   # HyperV HID device
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 8e91e20720ca..67b95a8db6f7 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -555,13 +555,10 @@ _mlx5ib=  mlx5ib
 .endif
 .endif
 
-.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64"
-_gve=  gve
-.endif
-
 .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
 ${MACHINE_CPUARCH} == "i386"
 _ena=  ena
+_gve=  gve
 _iwlwifi=  iwlwifi
 .if ${MK_SOURCELESS_UCODE} != "no"
 _iwlwififw=iwlwififw



git: 37e3f5b23b07 - main - Enable support for printing 8-byte integers. For some reason, most of the code for this was present, but disabled. This is required for POSIX compliance on platforms with 8

2023-06-04 Thread Xin LI
The branch main has been updated by delphij:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=37e3f5b23b0720223186f5a00108fdb8d3e88150

commit 37e3f5b23b0720223186f5a00108fdb8d3e88150
Author: Ben Harris 
AuthorDate: 2001-12-07 13:37:39 +
Commit: Xin LI 
CommitDate: 2023-06-05 02:23:35 +

Enable support for printing 8-byte integers.  For some reason, most of the
code for this was present, but disabled.
This is required for POSIX compliance on platforms with 8-byte longs.

Obtained-From:  NetBSD
PR: 238586
Reported-By:Mohamed Akram 
MFC after:  2 weeks
---
 usr.bin/hexdump/display.c | 2 +-
 usr.bin/hexdump/parse.c   | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/usr.bin/hexdump/display.c b/usr.bin/hexdump/display.c
index 5e5b30b73fd0..cad548e1ec41 100644
--- a/usr.bin/hexdump/display.c
+++ b/usr.bin/hexdump/display.c
@@ -123,8 +123,8 @@ print(PR *pr, u_char *bp)
   double f8;
float f4;
  int16_t s2;
-  int8_t s8;
  int32_t s4;
+ int64_t s8;
u_int16_t u2;
u_int32_t u4;
u_int64_t u8;
diff --git a/usr.bin/hexdump/parse.c b/usr.bin/hexdump/parse.c
index f59f0d9b6356..c6616fdd24d7 100644
--- a/usr.bin/hexdump/parse.c
+++ b/usr.bin/hexdump/parse.c
@@ -303,6 +303,9 @@ isint:  cs[2] = '\0';
case 2:
pr->bcnt = 2;
break;
+   case 8:
+   pr->bcnt = 8;
+   break;
default:
p1[1] = '\0';
badcnt(p1);



git: ea656f7cdcc1 - stable/13 - sqlite3: Vendor import of sqlite3 3.42.0

2023-06-04 Thread Cy Schubert
The branch stable/13 has been updated by cy:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=ea656f7cdcc1fedd5cd62bc9b983c748f814fca2

commit ea656f7cdcc1fedd5cd62bc9b983c748f814fca2
Author: Cy Schubert 
AuthorDate: 2023-05-28 14:31:36 +
Commit: Cy Schubert 
CommitDate: 2023-06-05 01:38:55 +

sqlite3: Vendor import of sqlite3 3.42.0

Release notes at https://www.sqlite.org/releaselog/3_42_0.html.

Obtained from:  https://www.sqlite.org/2023/sqlite-autoconf-342.tar.gz

Merge commit '92b2b066353ddd32e1d59f8c52c430d552d9a9a5' into sqlite3/main

(cherry picked from commit 402cee1f19b613bae844a176156a41cdfa507585)
---
 contrib/sqlite3/configure|   20 +-
 contrib/sqlite3/configure.ac |2 +-
 contrib/sqlite3/shell.c  | 1016 --
 contrib/sqlite3/sqlite3.c| 6955 +-
 contrib/sqlite3/sqlite3.h|  202 +-
 contrib/sqlite3/sqlite3rc.h  |2 +-
 contrib/sqlite3/tea/configure|   18 +-
 contrib/sqlite3/tea/configure.ac |2 +-
 8 files changed, 5524 insertions(+), 2693 deletions(-)

diff --git a/contrib/sqlite3/configure b/contrib/sqlite3/configure
index dea9860d00ee..1016e350c37f 100755
--- a/contrib/sqlite3/configure
+++ b/contrib/sqlite3/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for sqlite 3.41.2.
+# Generated by GNU Autoconf 2.71 for sqlite 3.42.0.
 #
 # Report bugs to .
 #
@@ -621,8 +621,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='sqlite'
 PACKAGE_TARNAME='sqlite'
-PACKAGE_VERSION='3.41.2'
-PACKAGE_STRING='sqlite 3.41.2'
+PACKAGE_VERSION='3.42.0'
+PACKAGE_STRING='sqlite 3.42.0'
 PACKAGE_BUGREPORT='http://www.sqlite.org'
 PACKAGE_URL=''
 
@@ -1367,7 +1367,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures sqlite 3.41.2 to adapt to many kinds of systems.
+\`configure' configures sqlite 3.42.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1438,7 +1438,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
- short | recursive ) echo "Configuration of sqlite 3.41.2:";;
+ short | recursive ) echo "Configuration of sqlite 3.42.0:";;
esac
   cat <<\_ACEOF
 
@@ -1563,7 +1563,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-sqlite configure 3.41.2
+sqlite configure 3.42.0
 generated by GNU Autoconf 2.71
 
 Copyright (C) 2021 Free Software Foundation, Inc.
@@ -1833,7 +1833,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by sqlite $as_me 3.41.2, which was
+It was created by sqlite $as_me 3.42.0, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   $ $0$ac_configure_args_raw
@@ -3106,7 +3106,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='sqlite'
- VERSION='3.41.2'
+ VERSION='3.42.0'
 
 
 printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -15314,7 +15314,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by sqlite $as_me 3.41.2, which was
+This file was extended by sqlite $as_me 3.42.0, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   CONFIG_FILES= $CONFIG_FILES
@@ -15373,7 +15373,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | 
sed "s/^ //; s/'/'
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config='$ac_cs_config_escaped'
 ac_cs_version="\\
-sqlite config.status 3.41.2
+sqlite config.status 3.42.0
 configured by $0, generated by GNU Autoconf 2.71,
   with options \\"\$ac_cs_config\\"
 
diff --git a/contrib/sqlite3/configure.ac b/contrib/sqlite3/configure.ac
index 290f160afc56..a706a4753049 100644
--- a/contrib/sqlite3/configure.ac
+++ b/contrib/sqlite3/configure.ac
@@ -10,7 +10,7 @@
 #
 
 AC_PREREQ(2.61)
-AC_INIT(sqlite, 3.41.2, http://www.sqlite.org)
+AC_INIT(sqlite, 3.42.0, http://www.sqlite.org)
 AC_CONFIG_SRCDIR([sqlite3.c])
 AC_CONFIG_AUX_DIR([.])
 
diff --git a/contrib/sqlite3/shell.c b/contrib/sqlite3/shell.c
index e6495d75128e..647a214226cc 100644
--- a/contrib/sqlite3/shell.c
+++ b/contrib/sqlite3/shell.c
@@ -117,6 +117,7 @@ typedef unsigned short int u16;
 #include 
 #include 
 #include 
+#include 
 #include "sqlite3.h"
 typedef sqlite3_int64 i64;
 typedef sqlite3_uint64 u64;
@@ -245,6 +246,7 @@ typedef unsigned char u8;
 #if SQLITE_OS_WINRT
 #include 
 #endif
+#define WIN32_LEAN_AND_MEAN
 #include 
 
 /* string conversion routines only needed on Win32 */
@@ -459,11 +461,25 @@ static void endTime

git: 60ab53f3a67b - stable/12 - sqlite3: Vendor import of sqlite3 3.42.0

2023-06-04 Thread Cy Schubert
The branch stable/12 has been updated by cy:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=60ab53f3a67be68174f5a8ef4a64b03f52b60201

commit 60ab53f3a67be68174f5a8ef4a64b03f52b60201
Author: Cy Schubert 
AuthorDate: 2023-05-28 14:31:36 +
Commit: Cy Schubert 
CommitDate: 2023-06-05 03:42:08 +

sqlite3: Vendor import of sqlite3 3.42.0

Release notes at https://www.sqlite.org/releaselog/3_42_0.html.

Obtained from:  https://www.sqlite.org/2023/sqlite-autoconf-342.tar.gz

Merge commit '92b2b066353ddd32e1d59f8c52c430d552d9a9a5' into sqlite3/main

(cherry picked from commit 402cee1f19b613bae844a176156a41cdfa507585)
---
 contrib/sqlite3/configure|   20 +-
 contrib/sqlite3/configure.ac |2 +-
 contrib/sqlite3/shell.c  | 1016 --
 contrib/sqlite3/sqlite3.c| 6955 +-
 contrib/sqlite3/sqlite3.h|  202 +-
 contrib/sqlite3/sqlite3rc.h  |2 +-
 contrib/sqlite3/tea/configure|   18 +-
 contrib/sqlite3/tea/configure.ac |2 +-
 8 files changed, 5524 insertions(+), 2693 deletions(-)

diff --git a/contrib/sqlite3/configure b/contrib/sqlite3/configure
index dea9860d00ee..1016e350c37f 100755
--- a/contrib/sqlite3/configure
+++ b/contrib/sqlite3/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for sqlite 3.41.2.
+# Generated by GNU Autoconf 2.71 for sqlite 3.42.0.
 #
 # Report bugs to .
 #
@@ -621,8 +621,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='sqlite'
 PACKAGE_TARNAME='sqlite'
-PACKAGE_VERSION='3.41.2'
-PACKAGE_STRING='sqlite 3.41.2'
+PACKAGE_VERSION='3.42.0'
+PACKAGE_STRING='sqlite 3.42.0'
 PACKAGE_BUGREPORT='http://www.sqlite.org'
 PACKAGE_URL=''
 
@@ -1367,7 +1367,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures sqlite 3.41.2 to adapt to many kinds of systems.
+\`configure' configures sqlite 3.42.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1438,7 +1438,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
- short | recursive ) echo "Configuration of sqlite 3.41.2:";;
+ short | recursive ) echo "Configuration of sqlite 3.42.0:";;
esac
   cat <<\_ACEOF
 
@@ -1563,7 +1563,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-sqlite configure 3.41.2
+sqlite configure 3.42.0
 generated by GNU Autoconf 2.71
 
 Copyright (C) 2021 Free Software Foundation, Inc.
@@ -1833,7 +1833,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by sqlite $as_me 3.41.2, which was
+It was created by sqlite $as_me 3.42.0, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   $ $0$ac_configure_args_raw
@@ -3106,7 +3106,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='sqlite'
- VERSION='3.41.2'
+ VERSION='3.42.0'
 
 
 printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -15314,7 +15314,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by sqlite $as_me 3.41.2, which was
+This file was extended by sqlite $as_me 3.42.0, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   CONFIG_FILES= $CONFIG_FILES
@@ -15373,7 +15373,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | 
sed "s/^ //; s/'/'
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config='$ac_cs_config_escaped'
 ac_cs_version="\\
-sqlite config.status 3.41.2
+sqlite config.status 3.42.0
 configured by $0, generated by GNU Autoconf 2.71,
   with options \\"\$ac_cs_config\\"
 
diff --git a/contrib/sqlite3/configure.ac b/contrib/sqlite3/configure.ac
index 290f160afc56..a706a4753049 100644
--- a/contrib/sqlite3/configure.ac
+++ b/contrib/sqlite3/configure.ac
@@ -10,7 +10,7 @@
 #
 
 AC_PREREQ(2.61)
-AC_INIT(sqlite, 3.41.2, http://www.sqlite.org)
+AC_INIT(sqlite, 3.42.0, http://www.sqlite.org)
 AC_CONFIG_SRCDIR([sqlite3.c])
 AC_CONFIG_AUX_DIR([.])
 
diff --git a/contrib/sqlite3/shell.c b/contrib/sqlite3/shell.c
index e6495d75128e..647a214226cc 100644
--- a/contrib/sqlite3/shell.c
+++ b/contrib/sqlite3/shell.c
@@ -117,6 +117,7 @@ typedef unsigned short int u16;
 #include 
 #include 
 #include 
+#include 
 #include "sqlite3.h"
 typedef sqlite3_int64 i64;
 typedef sqlite3_uint64 u64;
@@ -245,6 +246,7 @@ typedef unsigned char u8;
 #if SQLITE_OS_WINRT
 #include 
 #endif
+#define WIN32_LEAN_AND_MEAN
 #include 
 
 /* string conversion routines only needed on Win32 */
@@ -459,11 +461,25 @@ static void endTime

git: 1e4b7ab136b4 - main - tslog.h: Wrap in #ifdef _KERNEL

2023-06-04 Thread Colin Percival
The branch main has been updated by cperciva:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=1e4b7ab136b434dcb296833e509f87c95ac868bc

commit 1e4b7ab136b434dcb296833e509f87c95ac868bc
Author: Colin Percival 
AuthorDate: 2023-06-04 22:59:10 +
Commit: Colin Percival 
CommitDate: 2023-06-05 05:49:38 +

tslog.h: Wrap in #ifdef _KERNEL

This is not intended to be used from outside of the kernel; in
particular, the boot loader has its own version of tslog.
---
 sys/sys/tslog.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/sys/tslog.h b/sys/sys/tslog.h
index af3c0931cac8..dcbfd266c5c2 100644
--- a/sys/sys/tslog.h
+++ b/sys/sys/tslog.h
@@ -29,6 +29,7 @@
 #ifndef _TSLOG_H_
 #define_TSLOG_H_
 
+#ifdef _KERNEL
 #ifdef TSLOG
 #include 
 #include 
@@ -66,4 +67,5 @@ void tslog_user(pid_t, pid_t, const char *, const char *);
 #define TSRAW_USER(a, b, c, d) /* Timestamp logging disabled */
 #endif
 
+#endif /* _KERNEL */
 #endif /* _TSLOG_H_ */



git: 9d6ae1e3c26a - main - Revert "Revert "tslog: Annotate some early boot functions""

2023-06-04 Thread Colin Percival
The branch main has been updated by cperciva:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=9d6ae1e3c26a0c3334a268b587f17dccb9a503d7

commit 9d6ae1e3c26a0c3334a268b587f17dccb9a503d7
Author: Colin Percival 
AuthorDate: 2023-06-04 23:01:31 +
Commit: Colin Percival 
CommitDate: 2023-06-05 05:49:38 +

Revert "Revert "tslog: Annotate some early boot functions""

Now that  is wrapped in #ifdef _KERNEL, it's safe to have
tslog annotations in files which might be built from userland (i.e. in
subr_boot.c, which is built as part of the boot loader).

This reverts commit 59588a546f55523d6fd37ab42eb08b719311d7d6.
---
 sys/amd64/amd64/fpu.c  | 3 +++
 sys/amd64/amd64/initcpu.c  | 4 
 sys/amd64/amd64/machdep.c  | 2 ++
 sys/amd64/amd64/pmap.c | 4 
 sys/kern/kern_cons.c   | 3 +++
 sys/kern/link_elf.c| 7 +++
 sys/kern/subr_boot.c   | 5 +
 sys/kern/subr_kdb.c| 3 +++
 sys/kern/subr_param.c  | 4 
 sys/kern/subr_pcpu.c   | 2 ++
 sys/kern/subr_prf.c| 3 +++
 sys/x86/pci/pci_early_quirks.c | 3 +++
 sys/x86/x86/identcpu.c | 7 ++-
 sys/x86/xen/pv.c   | 3 +++
 14 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c
index a3421cf0d496..1310a27911fe 100644
--- a/sys/amd64/amd64/fpu.c
+++ b/sys/amd64/amd64/fpu.c
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -360,6 +361,7 @@ fpuinit(void)
u_int mxcsr;
u_short control;
 
+   TSENTER();
if (IS_BSP())
fpuinit_bsp1();
 
@@ -401,6 +403,7 @@ fpuinit(void)
ldmxcsr(mxcsr);
start_emulating();
intr_restore(saveintr);
+   TSEXIT();
 }
 
 /*
diff --git a/sys/amd64/amd64/initcpu.c b/sys/amd64/amd64/initcpu.c
index a17ef89ba9f8..0de4bc3e2d60 100644
--- a/sys/amd64/amd64/initcpu.c
+++ b/sys/amd64/amd64/initcpu.c
@@ -276,6 +276,7 @@ initializecpu(void)
uint64_t msr;
uint32_t cr4;
 
+   TSENTER();
cr4 = rcr4();
if ((cpu_feature & CPUID_XMM) && (cpu_feature & CPUID_FXSR)) {
cr4 |= CR4_FXSR | CR4_XMM;
@@ -311,7 +312,9 @@ initializecpu(void)
if (cpu_stdext_feature & CPUID_STDEXT_SMAP)
cr4 |= CR4_SMAP;
}
+   TSENTER2("load_cr4");
load_cr4(cr4);
+   TSEXIT2("load_cr4");
/* Reload cpu ext features to reflect cr4 changes */
if (IS_BSP() && cold)
identify_cpu_ext_features();
@@ -340,6 +343,7 @@ initializecpu(void)
 
if (!IS_BSP())
cpu_init_small_core();
+   TSEXIT();
 }
 
 void
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 757606311123..fa3ffe84bfe1 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -874,6 +874,7 @@ getmemsize(caddr_t kmdp, u_int64_t first)
quad_t dcons_addr, dcons_size;
int page_counter;
 
+   TSENTER();
/*
 * Tell the physical memory allocator about pages used to store
 * the kernel and preloaded data.  See kmem_bootstrap_free().
@@ -1129,6 +1130,7 @@ do_next:
 
/* Map the message buffer. */
msgbufp = (struct msgbuf *)PHYS_TO_DMAP(phys_avail[pa_indx]);
+   TSEXIT();
 }
 
 static caddr_t
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index b2abab429730..123811ed573f 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -1668,6 +1668,7 @@ create_pagetables(vm_paddr_t *firstaddr)
 #endif
int i, j, ndm1g, nkpdpe, nkdmpde;
 
+   TSENTER();
/* Allocate page table pages for the direct map */
ndmpdp = howmany(ptoa(Maxmem), NBPDP);
if (ndmpdp < 4) /* Minimum 4GB of dirmap */
@@ -1884,6 +1885,7 @@ create_pagetables(vm_paddr_t *firstaddr)
}
 
kernel_pml4 = (pml4_entry_t *)PHYS_TO_DMAP(KPML4phys);
+   TSEXIT();
 }
 
 /*
@@ -1906,6 +1908,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
u_long res;
int i;
 
+   TSENTER();
KERNend = *firstaddr;
res = atop(KERNend - (vm_paddr_t)kernphys);
 
@@ -2061,6 +2064,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
 */
load_cr4(rcr4() | CR4_PCIDE);
}
+   TSEXIT();
 }
 
 /*
diff --git a/sys/kern/kern_cons.c b/sys/kern/kern_cons.c
index 7c63b8e4ed9c..ff57b2bdfd8a 100644
--- a/sys/kern/kern_cons.c
+++ b/sys/kern/kern_cons.c
@@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -134,6 +135,7 @@ cninit(void)
 {
struct consdev *best_cn, *cn, **list;
 
+   TSENTER();
/*
 * Check if we should mute the console (for security reasons perhaps)
 * It can be changes dynamically using sysctl kern.consmute
@@ -195,6 +197,7 @@ cninit(void)
 */
early_put