Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Jun 2012 09:47:48 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-arch@freebsd.org
Cc:        Dag-Erling =?utf-8?q?Sm=C3=B8rgrav?= <des@des.no>
Subject:   Re: KTR_SPAREx
Message-ID:  <201206050947.48750.jhb@freebsd.org>
In-Reply-To: <86bokyvtc2.fsf@ds4.des.no>
References:  <86bokyvtc2.fsf@ds4.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday, June 05, 2012 8:25:33 am Dag-Erling Sm=C3=B8rgrav wrote:
> Most of this is in device drivers, which should use KTR_DEV.  There is
> one major use of KTR_SPAREx in common code: KTR_SPARE2 is used for clock
> events.  It is also used incorrectly by the sparc64 pmap core (there is
> a separate KTR_PMAP for that).
>=20
> I suggest that we
>=20
> 1) rename one of the spare KTRs to KTR_CLOCK and use that for clock
>    events.  I already have a patch for that.
>=20
> 2) eliminate all other use of KTR_SPARE[0-9] in non-device code.  I
>    think the existing KTRs should already cover most cases.
>=20
> 3) modify device drivers to use KTR_DEV for events that aren't covered
>    by existing, more specific KTRs, which is almost none.  For instance,
>    there is no reason why cxgb shouldn't just use KTR_NET.

There is a reason in that you may want to only get those specific events and
not drown in noise from the network stack itself for example.  What I tend =
to
do in drivers where I want to do this is have something like this:

#if 0
#define KTR_CXGB KTR_DEV
#else
#define KTR_CXGB 0
#endif

and then use 'KTR_CXGB' instead of 'KTR_DEV' or 'KTR_SPARE2' explicitly.  I=
t=20
looks like most of the drivers are already doing this and if it is #if 0'd =
by
default, then I would just let them be.  The two CTR()s in tom/cxgb_cpl_io.c
should probably be using KTR_TOM instead of KTR_SPARE2 directly.

As a long term goal I would like to switch to using individual ints instead=
 of=20
a 32-bit bitmask as that would let us add new trace classes with ease.  I=20
haven't figured out a design for that that I fully like yet however.

=2D-=20
John Baldwin



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