Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Dec 2017 22:05:11 +0800
From:      blubee blubeeme <gurenchan@gmail.com>
To:        Colin Percival <cperciva@tarsnap.com>
Cc:        "freebsd-current@freebsd.org" <freebsd-current@freebsd.org>
Subject:   Re: [Request for review] Profiling the FreeBSD kernel boot
Message-ID:  <CALM2mEmLcHFsyNMMZPbyNRm_eVuoa17BxrgYBhfOFKwzVSaOYw@mail.gmail.com>
In-Reply-To: <010001607d9c59d5-15b6b788-a7ea-4edf-96e4-1235dd1a5c26-000000@email.amazonses.com>
References:  <010001607d9c59d5-15b6b788-a7ea-4edf-96e4-1235dd1a5c26-000000@email.amazonses.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Dec 22, 2017 at 5:44 PM, Colin Percival <cperciva@tarsnap.com>
wrote:

> Hi everyone,
>
> For the past few months I've been working on code for profiling the FreeBSD
> "kernel boot", i.e., everything between when kernel code starts running and
> when we first enter userland as init(8).  This is not trivial since it's
> impossible to use tools like dtrace to monitor things prior to when said
> tools are running.  The goal of this exercise is to help me track down the
> places where we're wasting time during the boot, and then to fix them.
>
> The approach I've taken is to add some macros -- most notably TSENTER() and
> TSEXIT() -- which by default compile to nothing, but if the TSLOG kernel
> option is enabled they compile to code which logs the cycle count (e.g., on
> x86 the value from the RDTSC instruction) along with some other data (in
> the
> case of TSENTER and TSEXIT, the fact that we're entering/exiting a
> function).
> This can then be dumped via a sysctl (debug.tslog) and processed in
> userland
> to convert function entries/exits into stacks and to visualize the time
> spent
> in the boot process.
>
> Two examples:
>
> A flame chart of my laptop booting HEAD:
> http://www.daemonology.net/timestamping/tslog-laptop.svg
>
> A flame chart of an EC2 c5.4xlarge instance booting 11.1-RELEASE:
> http://www.daemonology.net/timestamping/tslog-c5.4xlarge.svg
>
> The patches (10 of them, to be applied in order), userland scripts, and
> very
> brief usage instructions are at:
> http://www.daemonology.net/timestamping/tslog.tgz
>
> I hope to commit the patches in the next week, since I'm planning on
> writing
> a paper to submit to AsiaBSDCon (which has a deadline of December 31st); so
> if anyone has interest/time to look at this in the near future (I mean,
> it's
> not like anyone is going to be busy this weekend, right?) I'd love to have
> some feedback before it goes into the tree.
>
> --
> Colin Percival
> Security Officer Emeritus, FreeBSD | The power to serve
> Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid
> _______________________________________________
> freebsd-current@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
>
I've gotta say  nice work with the tracing.
Hopefully your talk gets accepted, i'd love to hear it.



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