From owner-svn-src-all@freebsd.org Fri Aug 10 02:25:35 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 C4C33105600D; Fri, 10 Aug 2018 02:25:35 +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 77AC2730F9; Fri, 10 Aug 2018 02:25:35 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (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 142C72ABF8; Fri, 10 Aug 2018 02:25:35 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-lf1-f44.google.com with SMTP id u14-v6so5533237lfu.0; Thu, 09 Aug 2018 19:25:35 -0700 (PDT) X-Gm-Message-State: AOUpUlGW7On0+0sHVYAskVS99GUSqC5lUKhn1hVbfygEKGu1zIKX0jy6 13R/u6eZLU68YtJuTzqacWSxx2R7oU+wHfdMKGs= X-Google-Smtp-Source: AA+uWPzMprydIxEsZvtQv3l/RCInGPF6P47UNrHbFXMrpZCwsvvMEC7xgJ32dqLksIqFrjIE60XZ1ujgUd/YdE9ompc= X-Received: by 2002:a19:1586:: with SMTP id 6-v6mr2879549lfv.51.1533867933683; Thu, 09 Aug 2018 19:25:33 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:5742:0:0:0:0:0 with HTTP; Thu, 9 Aug 2018 19:25:13 -0700 (PDT) In-Reply-To: <20180810115339.X1652@besplex.bde.org> References: <201808090132.w791WAQm057199@repo.freebsd.org> <20180810081913.P1108@besplex.bde.org> <20180810105239.J1482@besplex.bde.org> <20180810115339.X1652@besplex.bde.org> From: Kyle Evans Date: Thu, 9 Aug 2018 21:25:13 -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-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: Fri, 10 Aug 2018 02:25:36 -0000 On Thu, Aug 9, 2018 at 9:12 PM, Bruce Evans wrote: > On Fri, 10 Aug 2018, Bruce Evans wrote: > >> On Thu, 9 Aug 2018, Kyle Evans wrote: >> ... >>> >>> When you say you call msgbufinit() earlier-- before the static >>> environment is even setup, or at least after that? >> >> >> The above is with a simplified version that first calls msgbufinit() >> after the static env is set up. In other working versions, msgbufinit() >> is called long before the static env is set up. In a commented out >> version, a small MI msgbuf is statically initalized so that some msgbuf >> is always mapped, but msgbufmapped still starts as 0 and msgbufinit() >> must still be called to synchronize. Some synchronization is needed >> since the msgbuf uses broken mutex locking and mutexes use curthread and >> curthread is not initialized early. The simplified versions delay the >> msgbufinit() calls until mutexes are initialized enough, and this >> accidentally moves them after other initializations. >> >> So the tunable is unavailable in the best version :-(. The small initial >> msgbuf could even start with the statically initialized buffer containing >> the tag, and must if it is to be ready to go without a synchronization >> call. > > > The tag can be added later fairly easily, and this order corresponds to > the problem being solved (that we don't know where the data for the new boot > starts iff there is old data): > > - start with a small statically initialized msgbuf. No need for a tag; the > new data starts at the start of the buffer > - write new data to this buffer > - reinit is not really initialization, but supplies data from the previous > boot. Construct the new buffer as the concatenation of the old data, a > tag to delimit the new data, then the new data. > > But I think a variable tag is worse than a fixed tag. With a fixed tag, > it is easy for dmesg, syslogd and users to search for the tag and replace > it by a better one determined using full runtime resources. E.g., use > sed on /var/log/messages to find the last instance of the tag and replace > it by something depending on the current context, while a tunable tag must > be set earlier and then all utilities and methods for finding and modifying > must understand its variations. > I honestly have very low expectations for the tunable's use, but it's a low-cost addition and I find it more useful in a less automated context. One that I've had recently would have been implemented with the following process: 1. Boot -v into installed kernel with normal tag, ---<>-- 2. Briefly review `dmesg`, notice issue with clock driver 3. Install new kernel with changes to said clock driver. Tag it ---<>--, boot -v 4. Review `dmesg` again to observe changes The non-standard tag would certainly be an anomaly, but it gives me the benefit of discerning a standard boot from this one in which I fiddled with the A20 clock driver without having to compile a non-standard boot tag into the kernel. It also gives me a clear indicator as I'm paging through output to quickly at-a-glance realize that I've reached a new (or the correct) boot. I'll likely commit the modified version soon, anyways, and we can hash out any further details after 12 branches. Thanks, Kyle Evans