From owner-cvs-all@FreeBSD.ORG Tue Oct 18 14:05:24 2005 Return-Path: X-Original-To: cvs-all@FreeBSD.org Delivered-To: cvs-all@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A4AE516A41F; Tue, 18 Oct 2005 14:05:24 +0000 (GMT) (envelope-from gallatin@cs.duke.edu) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3377F43D45; Tue, 18 Oct 2005 14:05:24 +0000 (GMT) (envelope-from gallatin@cs.duke.edu) Received: from grasshopper.cs.duke.edu (grasshopper.cs.duke.edu [152.3.145.30]) by duke.cs.duke.edu (8.13.4/8.13.4) with ESMTP id j9IE5NVU008917 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 18 Oct 2005 10:05:23 -0400 (EDT) Received: (from gallatin@localhost) by grasshopper.cs.duke.edu (8.12.9p2/8.12.9/Submit) id j9IE5IbW029245; Tue, 18 Oct 2005 10:05:18 -0400 (EDT) (envelope-from gallatin) From: Andrew Gallatin MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17237.286.236279.883806@grasshopper.cs.duke.edu> Date: Tue, 18 Oct 2005 10:05:18 -0400 (EDT) To: "Poul-Henning Kamp" In-Reply-To: <68671.1129643256@critter.freebsd.dk> References: <20051018094402.A29138@grasshopper.cs.duke.edu> <68671.1129643256@critter.freebsd.dk> X-Mailer: VM 6.75 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/amd64/amd64 cpu_switch.S machdep.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2005 14:05:24 -0000 Poul-Henning Kamp writes: > In message <20051018094402.A29138@grasshopper.cs.duke.edu>, Andrew Gallatin wri > tes: > > >It is a shame we can't find a way to use the TSC as a timecounter on > >SMP systems. It seems that about 40% of the context switch time is > >spent just waiting for the PIO read of the ACPI-fast or i8254 to > >return. > > No, the shame is that the scheduler tries to partition time rather > than cpu cycles because that approximation got goldplated in some > random standard years back. Sorry if I mi-spoke. I guess the shame twofold. First we insist on not trying keep the TSC in sync and so we don't use it for SMP timekeeping like other OSes do, which means that getting a micro-second granularity timestamp is orders of magnitude more expensive for us. To compound the problem, we insist on using the expensive non-TSC binuptime() to get a runtime measurement on each context switch, rather than being able to use something cheap like ticks, or a per-cpu cycle counter. If anybody is looking for low-hanging fruit in the SMP context switch path, figuring some acceptable way to avoid reading the ACPI or i8254 timecounter is it. Drew