From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 15 14:10:16 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6050216A4CE for ; Sun, 15 Feb 2004 14:10:16 -0800 (PST) Received: from ns1.xcllnt.net (209-128-86-226.BAYAREA.NET [209.128.86.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3D7C643D1D for ; Sun, 15 Feb 2004 14:10:16 -0800 (PST) (envelope-from marcel@xcllnt.net) Received: from dhcp01.pn.xcllnt.net (dhcp01.pn.xcllnt.net [192.168.4.201]) by ns1.xcllnt.net (8.12.10/8.12.10) with ESMTP id i1FMAGOE051281; Sun, 15 Feb 2004 14:10:16 -0800 (PST) (envelope-from marcel@piii.pn.xcllnt.net) Received: from dhcp01.pn.xcllnt.net (localhost [127.0.0.1]) i1FMAFcM067409; Sun, 15 Feb 2004 14:10:15 -0800 (PST) (envelope-from marcel@dhcp01.pn.xcllnt.net) Received: (from marcel@localhost) by dhcp01.pn.xcllnt.net (8.12.10/8.12.10/Submit) id i1FMAFup067408; Sun, 15 Feb 2004 14:10:15 -0800 (PST) (envelope-from marcel) Date: Sun, 15 Feb 2004 14:10:15 -0800 From: Marcel Moolenaar To: Poul-Henning Kamp Message-ID: <20040215221015.GA67309@dhcp01.pn.xcllnt.net> References: <16511.1076880750@critter.freebsd.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16511.1076880750@critter.freebsd.dk> User-Agent: Mutt/1.4.1i cc: hackers@freebsd.org Subject: Re: Neat little, not so simple project... X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Feb 2004 22:10:16 -0000 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