Date: Mon, 21 Jun 2021 03:29:13 GMT From: Colin Percival <cperciva@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: fe51b5a76de3 - main - kern_tslog: Include tslog data from loader Message-ID: <202106210329.15L3TD10076371@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=fe51b5a76de38d20cddc05a4c6cb1103d1a0547e commit fe51b5a76de38d20cddc05a4c6cb1103d1a0547e Author: Colin Percival <cperciva@FreeBSD.org> AuthorDate: 2021-05-30 23:25:01 +0000 Commit: Colin Percival <cperciva@FreeBSD.org> CommitDate: 2021-06-21 03:09:47 +0000 kern_tslog: Include tslog data from loader The i386 loader (and hopefully others to come) now passes tslog data as a "preloaded module". Include this in the data returned by the debug.tslog sysctl. Reviewed by: kevans --- sys/kern/kern_tslog.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sys/kern/kern_tslog.c b/sys/kern/kern_tslog.c index a0cb230f191c..dd3b25158340 100644 --- a/sys/kern/kern_tslog.c +++ b/sys/kern/kern_tslog.c @@ -28,6 +28,8 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> +#include <sys/kernel.h> +#include <sys/linker.h> #include <sys/sbuf.h> #include <sys/sysctl.h> #include <sys/systm.h> @@ -74,6 +76,9 @@ sysctl_debug_tslog(SYSCTL_HANDLER_ARGS) int error; struct sbuf *sb; size_t i, limit; + caddr_t loader_tslog; + void * loader_tslog_buf; + size_t loader_tslog_len; /* * This code can race against the code in tslog() which stores @@ -84,6 +89,16 @@ sysctl_debug_tslog(SYSCTL_HANDLER_ARGS) * anyone will ever experience this race. */ sb = sbuf_new_for_sysctl(NULL, NULL, 1024, req); + + /* Get data from the boot loader, if it provided any. */ + loader_tslog = preload_search_by_type("TSLOG data"); + if (loader_tslog != NULL) { + loader_tslog_buf = preload_fetch_addr(loader_tslog); + loader_tslog_len = preload_fetch_size(loader_tslog); + sbuf_bcat(sb, loader_tslog_buf, loader_tslog_len); + } + + /* Add data logged within the kernel. */ limit = MIN(nrecs, nitems(timestamps)); for (i = 0; i < limit; i++) { sbuf_printf(sb, "%p", timestamps[i].td);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106210329.15L3TD10076371>