From owner-cvs-src@FreeBSD.ORG Wed Nov 1 15:27:40 2006 Return-Path: X-Original-To: cvs-src@freebsd.org Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EF91616A407; Wed, 1 Nov 2006 15:27:40 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3888943D45; Wed, 1 Nov 2006 15:27:39 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.6/8.13.6) with ESMTP id kA1FRa2K001625; Wed, 1 Nov 2006 10:27:36 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Pawel Jakub Dawidek Date: Wed, 1 Nov 2006 10:21:09 -0500 User-Agent: KMail/1.9.1 References: <200611010454.kA14spYn014613@repoman.freebsd.org> <20061101093550.GK15861@garage.freebsd.pl> In-Reply-To: <20061101093550.GK15861@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200611011021.10535.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Wed, 01 Nov 2006 10:27:37 -0500 (EST) X-Virus-Scanned: ClamAV 0.88.3/2138/Wed Nov 1 06:55:22 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: cvs-src@freebsd.org, John Birrell , src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/amd64/amd64 genassym.c src/sys/arm/arm genassym.c src/sys/i386/i386 genassym.c src/sys/ia64/ia64 genassym.c src/sys/kern subr_prf.c tty_cons.c src/sys/powerpc/powerpc genassym.c src/sys/sparc64/sparc64 ... X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Nov 2006 15:27:41 -0000 On Wednesday 01 November 2006 04:35, Pawel Jakub Dawidek wrote: > On Wed, Nov 01, 2006 at 04:54:51AM +0000, John Birrell wrote: > > jb 2006-11-01 04:54:51 UTC > > > > FreeBSD src repository > > > > Modified files: > > sys/amd64/amd64 genassym.c > > sys/arm/arm genassym.c > > sys/i386/i386 genassym.c > > sys/ia64/ia64 genassym.c > > sys/kern subr_prf.c tty_cons.c > > sys/powerpc/powerpc genassym.c > > sys/sparc64/sparc64 genassym.c > > sys/sys cons.h pcpu.h > > Log: > > Add a cnputs() function to write a string to the console with > > a lock to prevent interspersed strings written from different CPUs > > at the same time. > > Nice, this was very annoying, but I'd still like to have a recursive > lock, which could be used by printf(9) consumers. For example, I'm not > able to implement such macro in a way that ensure everything will be > printed in one line: > > #define G_MIRROR_DEBUG(lvl, ...) do { \ > if (g_mirror_debug >= (lvl)) { \ > printf("GEOM_MIRROR"); \ > if (g_mirror_debug > 0) \ > printf("[%u]", lvl); \ > printf(": "); \ > printf(__VA_ARGS__); \ > printf("\n"); \ > } \ > } while (0) > > What I'd like is a global printf_lock which will allow me to put many > separate printfs under it and be sure it won't be messed up by other > CPUs. Having it recursive could also eliminate the need for per-CPU > buffers, as I don't think we care about performance here. > > What do you think? Because printf is used for things like panics, I think it needs to be as robust as possible. I think adding a larger lock like you request would make it too fragile. -- John Baldwin