From nobody Fri Mar 11 10:05:30 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 697F61A11821; Fri, 11 Mar 2022 10:05:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KFM4q0H3bz4jRs; Fri, 11 Mar 2022 10:05:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646993131; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cAm/W9ANhak7stisya5VjHF/5QQ30aVqMk8TwRKqjS4=; b=hGiQyHKcEfduiF5TDXuoR7ykRZTPJFikIil+YolO91sod/c2XHmFEeoRor2LMMy06vM4YX q7EipP7LxaqnLGnryMZMDn1NVwu/8JgtohaCHqLrNBA2tG3loej/fwPwSACYrFSd72CcHE 50ckvevLOAofoohX+5RO1asMWrWVl831zgpXZwNSOuOYJfcWjJbaK82yagr0Q8NLrhttms CFfLeN8gzcvhkNHC8Nzj1MlJFHTKXfojMew1vHfuoMiW4GndpK5G6V1a7fY/vnUFlVxGCI lMwFbumwswWcbGSJiae4kDfp3z4pntPCJjCjT6xFdzIxmqdGuPfh0MX5hw8yaA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3C331766A; Fri, 11 Mar 2022 10:05:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 22BA5U0o061071; Fri, 11 Mar 2022 10:05:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22BA5UOf061070; Fri, 11 Mar 2022 10:05:30 GMT (envelope-from git) Date: Fri, 11 Mar 2022 10:05:30 GMT Message-Id: <202203111005.22BA5UOf061070@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 759880b587fa - stable/12 - tslog.4: Document TSLOG List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 759880b587fac820a05a689030f4c985788ec0a2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646993131; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cAm/W9ANhak7stisya5VjHF/5QQ30aVqMk8TwRKqjS4=; b=OuqshnCz6mMQ7A+VGcropezUy1B26TB2okSEg1ZVVxkBdGUl2HwI8S5+RNEFSnMR2+KZJT mwyK98STulss6WY/zoYxcoANoW3laxBdTrlgGclwvH82gYL2b4YNgX8ELtI8SxNVeloUdx 0e8FilBSwy3jzpVvkr0YdnDnBqYF7DzpP88/YxsKGX+jFyDZCR2jzHv/hxpq9uVkSIQnZ+ 59ANgLB0SaekXKwankMQzLwQ2deOLUBhQpt1mP6O6HQVr8CIgZm51e4p61HDXe4YrY/dmd mHOEdhfJAGrFq5JrPgZh7co7MTnmh2HLDBUfTZXgY+GJJ5ILKt7l/gVainrTHg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646993131; a=rsa-sha256; cv=none; b=XOz43gfgQKdrfDNZEzMp4+U3Nzhjnb1CZHRtQj+Ju7TFcXwO4Xs9U5EGX/9RA46HyZOhGe LlOon6PBezq053Pn54A5lmSl/7EX1HSAS72sdEIbD5LAMLpsmtzWtSvfR7ycFfCHSkRzqi gHpleFqTq9dxLZUKpQ3vaMT63IsW3TNpEYzg9gDEOg1al4uG/XJGrBHoqY9JGnIgKBz2H/ zEjbwrCPPfe5LClHMT6WFnxxSzsD/Z4OkfTJhte3YwwwSj4iEmBUE0ZrOJRfGbNMxkcqbJ axWsDKeLY7TycIYuYi0UZs7KGaG6OPry14nIRNa0rhzzr302DxVOyph2OCEz9A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=759880b587fac820a05a689030f4c985788ec0a2 commit 759880b587fac820a05a689030f4c985788ec0a2 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2022-03-04 19:33:22 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2022-03-11 09:56:36 +0000 tslog.4: Document TSLOG Based on commit messages and Colin Percival's presentation from BSDCan 2018 [1]. [1]: https://papers.freebsd.org/2018/bsdcan/percival-Profiling_the_FreeBSD_kernel_boot.files/percival-Profiling_the_FreeBSD_kernel_boot.pdf Reviewed by: cperciva, debdrup MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D34430 (cherry picked from commit 5675bb582985654b172a4c1dd191e2b3bb8e78bb) --- share/man/man4/Makefile | 1 + share/man/man4/tslog.4 | 135 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index ea7430a5ba3f..bf78f5476ea0 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -555,6 +555,7 @@ MAN= aac.4 \ tl.4 \ ${_tpm.4} \ trm.4 \ + tslog.4 \ tty.4 \ tun.4 \ twa.4 \ diff --git a/share/man/man4/tslog.4 b/share/man/man4/tslog.4 new file mode 100644 index 000000000000..7d36898a6533 --- /dev/null +++ b/share/man/man4/tslog.4 @@ -0,0 +1,135 @@ +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2022 Mateusz Piotrowski <0mp@FreeBSD.org> +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd March 4, 2022 +.Dt TSLOG 4 +.Os +.Sh NAME +.Nm tslog +.Nd Boot-time event tracing facility +.Sh SYNOPSIS +To compile this boot-time event tracing facility into the kernel, +place the following line in the kernel configuration file: +.Bd -ragged -offset indent +.Cd "option TSLOG" +.Ed +.Sh DESCRIPTION +.Nm +is a boot-time event tracing facility. +Its purpose is to ease diagnosing and reducing the overall +.Fx +boot time by generating detailed timing information. +.Pp +.Nm +is able to trace the boot loader, kernel initialization, and userland processes. +.Pp +In userland, it records the following details for each process ID: +.Bl -dash +.It +The timestamp of the +.Xr fork 2 +which creates the given process ID and the parent process ID. +.It +The path passed to +.Xr execve 2 , +if any. +.It +The first path resolved by +.Xr namei 9 , +if any. +.It +The timestamp of the +.Xr exit 3 +which terminates the process. +.El +.Sh SYSCTL VARIABLES +The following +.Xr sysctl 8 +variables are available: +.Bl -tag -width indent +.It Va debug.tslog +Dump the +.Nm +buffer of recorded loader and kernel event timestamps. +.It Va debug.tslog_user +Dump the +.Nm +buffer +of recorded userland event timestamps. +.El +.Sh FLAMEGRAPHS +The +.Nm +buffer dumps +can be used to generate flamegraphs of the +.Fx +boot process for visual analysis. +See +.Lk https://github.com/cperciva/freebsd-boot-profiling +for more information. +.Sh SEE ALSO +.Xr dtrace 1 , +.Xr boottrace 4 , +.Xr ktr 4 +.Sh HISTORY +.Nm +first appeared in +.Fx 12.0 . +Support for tracing boot loaders and userland process +was added in +.Fx 14.0 . +.Ss TSLOG vs. Boottrace +.Nm +is oriented towards system developers while +.Xr boottrace 4 +is meant to be easy to use by system administrators. +Both faciliities provide an overview of timing and resource usage of the boot +process. +.Ss TSLOG vs. DTrace +.Xr dtrace 1 +is not always the right tool for profiling early kernel initialization. +The reason is it requires some kernel subroutines +which are not yet available early in the boot process, e.g.: +traps, memory allocation, or thread schedulling. +.Nm +depends on fewer kernel subroutines than +.Xr dtrace 1 +and because of that can trace early kernel initialization. +.Ss TSLOG vs. KTR +.Xr ktr 4 +has a couple of limitations which prevent it from +being able to run at the start of the boot process. +In contrast, +.Nm +is designed for logging timestamped events for boot +profiling. +.Sh AUTHORS +.An -nosplit +.Nm +was written by +.An Colin Percival Aq Mt cperciva@FreeBSD.org . +.Pp +This manual page was written by +.An Mateusz Piotrowski Aq Mt 0mp@FreeBSD.org .