From owner-svn-src-all@freebsd.org Thu Aug 9 23:22:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F10E10767AF; Thu, 9 Aug 2018 23:22:25 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id A61F68CC0D; Thu, 9 Aug 2018 23:22:24 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 8C9B9104F163; Fri, 10 Aug 2018 09:22:12 +1000 (AEST) Date: Fri, 10 Aug 2018 09:22:11 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Kyle Evans cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r337518 - in head/sys: kern sys In-Reply-To: <201808090132.w791WAQm057199@repo.freebsd.org> Message-ID: <20180810081913.P1108@besplex.bde.org> References: <201808090132.w791WAQm057199@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=EseilWUA c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=x7bEGLp0ZPQA:10 a=-dLe785RhlDCTkMXlmIA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Aug 2018 23:22:25 -0000 On Thu, 9 Aug 2018, Kyle Evans wrote: > Log: > kern: Add a BOOT_TAG marker at the beginning of boot dmesg > > From the "newly licensed to drive" PR department, add a BOOT_TAG marker (by > default, --<>--, to the beginning of each boot's dmesg. This makes it > easier to do textproc magic to locate the start of each boot and, of > particular interest to some, the dmesg of the current boot. > > The PR has a dmesg(8) component as well that I've opted not to include for > the moment- it was the more contentious part of this PR. > > bde@ also made the statement that this boot tag should be written with an > ordinary printf, which I've- for the moment- declined to change about this > patch to keep it more transparent to observer of the boot process. Yes, it should be written with an ordinary printf. > Modified: head/sys/kern/subr_prf.c > ============================================================================== > --- head/sys/kern/subr_prf.c Thu Aug 9 01:17:35 2018 (r337517) > +++ head/sys/kern/subr_prf.c Thu Aug 9 01:32:09 2018 (r337518) > @@ -1027,6 +1027,7 @@ msgbufinit(void *ptr, int size) > cp = (char *)ptr; > msgbufp = (struct msgbuf *)(cp + size); > msgbuf_reinit(msgbufp, cp, size); > + msgbuf_addstr(msgbufp, -1, BOOT_TAG, 0); > if (msgbufmapped && oldp != msgbufp) > msgbuf_copy(oldp, msgbufp); > msgbufmapped = 1; This seems to be wrong, since it writes the tag for all calls to msgbufinit(), giving multiple tags for multiple calls, but there should be only 1 per boot. msgbufinit() should be called multiple times to bootstrap it. My version does this. The only obvious bug in (a later version of) the output is a missing newline for the tag. My dmesg output on amd64: X ---<>------<>---Test of early printf to msgbuf X GDB: debug ports: sio X KDB: current port: sio X KDB: debugger backends: ddb gdb X KDB: current backend: ddb X Copyright (c) 1992-2018 The FreeBSD Project. X ... In -current, all of the lines before the copyright except the tag are broken by printf() of them to an unmapped msgbuf. (The above output is without -v. Many more lines are lost with -v.) In my version, msgbufinit() is called earlier with a small message buffer to hold the early output. Output across reboots also works right except for the missing newline: X ---<>------<>---Test of early printf to msgbuf X GDB: debug ports: sio X GDB: current port: sio X KDB: debugger backends: ddb gdb X KDB: current backend: ddb X Copyright (c) 1992-2018 The FreeBSD Project. X ... X Waiting (max 60 seconds) for system process `vnlru' to stop... done X Waiting (max 60 seconds) for system process `syncer' to stop... X Syncing disks, vnodes remaining... 0 0 0 done X Waiting (max 60 seconds) for system thread `bufdaemon' to stop... done X Waiting (max 60 seconds) for system thread `bufspacedaemon-0' to stop... done X Waiting (max 60 seconds) for system thread `bufspacedaemon-1' to stop... done X Waiting (max 60 seconds) for system thread `bufspacedaemon-2' to stop... done X Waiting (max 60 seconds) for system thread `bufspacedaemon-3' to stop... done X Waiting (max 60 seconds) for system thread `bufspacedaemon-4' to stop... done X Waiting (max 60 seconds) for system thread `bufspacedaemon-5' to stop... done X Waiting (max 60 seconds) for system thread `bufspacedaemon-6' to stop... done X All buffers synced. X ---<>------<>---Test of early printf to msgbuf X GDB: debug ports: sio X GDB: current port: sio X KDB: debugger backends: ddb gdb X KDB: current backend: ddb X Copyright (c) 1992-2018 The FreeBSD Project. X ... Bruce