From owner-freebsd-current@FreeBSD.ORG Mon Apr 8 08:07:10 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 938E4EF8 for ; Mon, 8 Apr 2013 08:07:10 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from onlyone.friendlyhosting.spb.ru (onlyone.friendlyhosting.spb.ru [46.4.40.135]) by mx1.freebsd.org (Postfix) with ESMTP id 5C42892D for ; Mon, 8 Apr 2013 08:07:10 +0000 (UTC) Received: from lion.home.serebryakov.spb.ru (unknown [IPv6:2001:470:923f:1:900d:c887:884e:713b]) (Authenticated sender: lev@serebryakov.spb.ru) by onlyone.friendlyhosting.spb.ru (Postfix) with ESMTPA id 00F1B4AC57; Mon, 8 Apr 2013 12:07:08 +0400 (MSK) Date: Mon, 8 Apr 2013 12:07:06 +0400 From: Lev Serebryakov Organization: FreeBSD Project X-Priority: 3 (Normal) Message-ID: <1791586092.20130408120706@serebryakov.spb.ru> To: Jeremy Chadwick Subject: Re: Kernel output interleaved on boot In-Reply-To: <20130408045237.GA70548@icarus.home.lan> References: <20130408045237.GA70548@icarus.home.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: lev@FreeBSD.org List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Apr 2013 08:07:10 -0000 Hello, Jeremy. You wrote 8 =D0=B0=D0=BF=D1=80=D0=B5=D0=BB=D1=8F 2013 =D0=B3., 8:52:37: JC> And yes, I am aware of how GSoC works, but this really should have JC> become a GSoC project by now, otherwise the Foundation should have JC> funded someone to fix this. It makes kernel debugging basically JC> worthless. Ok, here is several noob questions about low-level kernel implementation: (1) Do we have some very low-level thread-local variables, which could be used here? (2) Do cpu-local variables helps here? Is here guarantee, that printf() could not be preempted (I afraid, answer is no)? (3) What is lowest level, which could call printf()? i.e., could printf() allocate, say, one page of mapped kernel memory (I hope, answer is yes)? Init UMA zone and allocate block in UMA zone (I think, answer is no)? What I want to say, that lock-less (and block-less) multiple-writers ring buffer is "possible" data structure, as far as I know (we use lock-less and block-less data structures a lot at work for massive-parallel programming, but not at such low level, of course), but I need to understand, what printf() could and what couldn't do. I understand, that it could not use any lock, as it is called from anywhere, but should be it limited to stack and/or static data structures? And, by the way, is here generic mechanism in kernel (loader?), which automatically (on load) allocate per-CPU static structures? And why output is garbaged, if printf() uses _stack_ based buffer, at first place?! Stack is thread-local by definition! --=20 // Black Lion AKA Lev Serebryakov