From owner-svn-src-head@freebsd.org Fri Aug 10 00:02:47 2018 Return-Path: Delivered-To: svn-src-head@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 17AEA1077BA2; Fri, 10 Aug 2018 00:02:47 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C09908E81B; Fri, 10 Aug 2018 00:02:46 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 5F14529DE8; Fri, 10 Aug 2018 00:02:46 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-lj1-f178.google.com with SMTP id p10-v6so5852149ljg.2; Thu, 09 Aug 2018 17:02:46 -0700 (PDT) X-Gm-Message-State: AOUpUlEfdG+ZYFWOKB9NIzA18LZWJGmwk19Ws+mHRt/p69GbSw26L3v3 +kj5iRc1AaXBYtwANtORAWiETdtiET0Cie/2euQ= X-Google-Smtp-Source: AA+uWPwrH3M7/tnD6gsVzl43JBwUgDs5k57zk8pGqb0k8XSqfMsd1Xs17Easc/KP10w8AMf9i0mr699bVPKTvdkLAY0= X-Received: by 2002:a2e:144f:: with SMTP id 15-v6mr3177268lju.122.1533859364835; Thu, 09 Aug 2018 17:02:44 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:5742:0:0:0:0:0 with HTTP; Thu, 9 Aug 2018 17:02:20 -0700 (PDT) In-Reply-To: <20180810081913.P1108@besplex.bde.org> References: <201808090132.w791WAQm057199@repo.freebsd.org> <20180810081913.P1108@besplex.bde.org> From: Kyle Evans Date: Thu, 9 Aug 2018 19:02:20 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r337518 - in head/sys: kern sys To: Bruce Evans Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2018 00:02:47 -0000 On Thu, Aug 9, 2018 at 6:22 PM, Bruce Evans wrote: > 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. I've not seen a compelling reason to switch this to printf() rather than direct addition to the msgbuf after it's initialized, but I'll humor you on this one because I don't really care either way and you've been at this a lot longer than I have. When you say you call msgbufinit() earlier-- before the static environment is even setup, or at least after that? > 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 ... > Right- I tried to maintain the form of the original patch and also overlooked this. My revised patch [1] prints the boot tag only upon first init of the message buffer, swaps it over to printf, and adds a newline to whatever's been chosen as the boot tag. Thanks, Kyle Evans [1] https://people.freebsd.org/~kevans/bde-boottag.diff