From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 6 15:39:55 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A4BF106567A for ; Tue, 6 Mar 2012 15:39:55 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 20E3C8FC15 for ; Tue, 6 Mar 2012 15:39:55 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id C98CB46B58; Tue, 6 Mar 2012 10:39:54 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 3DAE7B974; Tue, 6 Mar 2012 10:39:54 -0500 (EST) From: John Baldwin To: Maninya M Date: Tue, 6 Mar 2012 08:34:08 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <201203051221.08681.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201203060834.08160.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 06 Mar 2012 10:39:54 -0500 (EST) Cc: freebsd-hackers@freebsd.org Subject: Re: CPUID and CPU STATE X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Mar 2012 15:39:55 -0000 On Tuesday, March 06, 2012 2:16:03 am Maninya M wrote: > Thank you. > How do we get hardware cpuid? > Can we change the number of CPUs available to the scheduler (in the > scheduler code) dynamically, say completely cutting off a specific cpu core > from being used at all? The hardware cpuid is machine-dependent. If you are in the kernel, you can use PCPU_GET(apic_id) on x86 to get the local APIC ID. Other platforms have a similar per-CPU variable. As far as getting it from userland, we do not have a good way of getting it currently aside from scraping /var/run/dmesg.boot or using libkvm to grovel around in kernel variables. As far as offlining a CPU, we do not have a way to do that currently (though you can take it out of the default cpuset which will prevent user threads from using it). > On 5 March 2012 22:51, John Baldwin wrote: > > > On Friday, March 02, 2012 2:20:00 am Maninya M wrote: > > > I was unable to get this information about the cpuid variable in the > > > scheduler source code. > > > How does cpuid get its value from the hardware? > > > > The cpuid is a software ID value assigned during boot. It is not > > directly related to any specific hardware IDs. > > > > > How is the CPUSTATES value obtained/changed with hardware in the source > > > code? > > > > Do you mean, does cp_time[] handle hardware changes (hotplug CPUs, etc.)? > > Currently that isn't supported, the kernel assumes the set of CPUs is > > static for a given boot's lifetime. > > > > -- > > John Baldwin > > > > > > -- > Maninya > -- John Baldwin