Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Feb 2004 14:10:15 -0800
From:      Marcel Moolenaar <marcel@xcllnt.net>
To:        Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc:        hackers@freebsd.org
Subject:   Re: Neat little, not so simple project...
Message-ID:  <20040215221015.GA67309@dhcp01.pn.xcllnt.net>
In-Reply-To: <16511.1076880750@critter.freebsd.dk>
References:  <16511.1076880750@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Feb 15, 2004 at 10:32:30PM +0100, Poul-Henning Kamp wrote:
> 
> Modify the code GCC inserts, so that it records if giant was held
> in one bit, and if not held in another, ie:
> 
> 	if (giant)
> 		*counter_loc |= 1;
> 	else
> 		*counter_loc |= 2;

Alternatively, modify the profiling code to "or" a global, like:

	*counter_loc |= global_state;

And have each binary condition be represented by two bits. For giant
this can be:
	NO_GIANT		1
	GIANT			2

To see if code is executed with interrupts enabled or disabled, one
can add:
	INT_ENABLE		4
	INT_DISABLE		8

and so forth.

When we grab or release giant, we change the global state as follows:
	grab:	global_state = (global_state & ~NO_GIANT) | GIANT;
	rel:	global_state = (global_state & ~GIAN) | NO_GIANT;

Likewise for other binary conditions.

> 	black - not executed.
> 	red - executed with giant always
> 	yellow - executed with mixed giant holding
> 	green - never executed with giant.

The two bit per binary condition then gives the above:
	0 = black
	1 = green
	2 = red
	3 = yellow

Just a thought,

-- 
 Marcel Moolenaar	  USPA: A-39004		 marcel@xcllnt.net



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