From owner-freebsd-current Sat Feb 1 7: 0:45 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 93F3837B401 for ; Sat, 1 Feb 2003 07:00:43 -0800 (PST) Received: from tesla.distributel.net (nat.MTL.distributel.NET [66.38.181.24]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5EF4943F79 for ; Sat, 1 Feb 2003 07:00:42 -0800 (PST) (envelope-from bmilekic@unixdaemons.com) Received: (from bmilekic@localhost) by tesla.distributel.net (8.11.6/8.11.6) id h11F1KF11987; Sat, 1 Feb 2003 10:01:20 -0500 (EST) (envelope-from bmilekic@unixdaemons.com) Date: Sat, 1 Feb 2003 10:01:20 -0500 From: Bosko Milekic To: Peter Wemm Cc: Matthew Dillon , "Daniel C. Sobral" , Trish Lynch , freebsd-current@FreeBSD.ORG Subject: Re: Hyperthreading and machdep.cpu_idle_hlt Message-ID: <20030201100120.A11945@unixdaemons.com> References: <20030131141700.A7526@unixdaemons.com> <20030131194817.335B72A89E@canning.wemm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20030131194817.335B72A89E@canning.wemm.org>; from peter@wemm.org on Fri, Jan 31, 2003 at 11:48:17AM -0800 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, Jan 31, 2003 at 11:48:17AM -0800, Peter Wemm wrote: > The cache and most of the execution hardware is shared. The execution > units can run something like 4 instructions per clock. If the "idle" > logical core is in a spinloop, then it is generating instructions for > execution, so you are dividing the execution resources between one context > that is doing real work, and the other context that is burning off the > "excess" resources. Overall, it is a huge loss. It is absolutely essential > that logical cpus be halted when they are not doing useful work. What bothers me is that we have systems like UMA and mb_alloc (and possibly others) which have per-CPU structures, i.e., per-CPU caches, and when HTT is enabled, even the logical CPUs get their own cache when, in fact, it would probably be better (and less cache polluting) if the "logical units" (states) shared the same per-CPU structures. Briefly back to the cpu_idle_hlt story: Would it be possible to, at runtime - besides for just getting cpuid which gives us the logical unit number - get the actual physical CPU number that we're executing on? e.g., in a 2 x 4 Xeon with HTT enabled, cpuid will range from 0 to 3, would it be possible to have an equivalent variable that will give us only the physical unit number (in this case, it would range from 0 to 1, as there are two physical execution units). That way, we can count how many times we issue 'hlt' for a thread running on physical unit number N, for example, and if we have 2 logical units per physical unit for instance, then when the count hits 1 no longer do the 'hlt' to not lose a tick? The counter would have to be re-set at the next tick everytime a logical unit comes out of hlt and schedules a process. You know what I mean? It sounds a little complicated and I'm not sure it would be worth the effort, but it would get us the best of both scenarios, i.e., halt the logical unit when another logical unit on the same core is executing Real Code, and not halt the logical unit if both logical units on the given execution engine are idle. In any case, even if the above is not worth it, I'd still like to know if it's possible to get the physical unit number, as opposed to the logical unit number, at runtime? [...] > Cheers, > -Peter > -- > Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com > "All of this is for nothing if we don't go to the stars" - JMS/B5 -- Bosko Milekic * bmilekic@unixdaemons.com * bmilekic@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message