Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Nov 2006 10:35:50 +0100
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        John Birrell <jb@FreeBSD.org>
Cc:        cvs-src@FreeBSD.org, 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 ...
Message-ID:  <20061101093550.GK15861@garage.freebsd.pl>
In-Reply-To: <200611010454.kA14spYn014613@repoman.freebsd.org>
References:  <200611010454.kA14spYn014613@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--V3eawNQxI9TAjvgi
Content-Type: text/plain; charset=iso-8859-2
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Nov 01, 2006 at 04:54:51AM +0000, John Birrell wrote:
> jb          2006-11-01 04:54:51 UTC
>=20
>   FreeBSD src repository
>=20
>   Modified files:
>     sys/amd64/amd64      genassym.c=20
>     sys/arm/arm          genassym.c=20
>     sys/i386/i386        genassym.c=20
>     sys/ia64/ia64        genassym.c=20
>     sys/kern             subr_prf.c tty_cons.c=20
>     sys/powerpc/powerpc  genassym.c=20
>     sys/sparc64/sparc64  genassym.c=20
>     sys/sys              cons.h pcpu.h=20
>   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 >=3D (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?

--=20
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

--V3eawNQxI9TAjvgi
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (FreeBSD)

iD8DBQFFSGp2ForvXbEpPzQRAgoZAJ9UwG4IP/871t60BCNiHs+E1GxGwwCg49ac
s0cTJZbNJi07w7aJp8/R3U8=
=CWZO
-----END PGP SIGNATURE-----

--V3eawNQxI9TAjvgi--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061101093550.GK15861>