From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LWa9S-0007F5-V5 for qemu-devel@nongnu.org; Mon, 09 Feb 2009 12:42:34 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LWa9Q-0007EU-Rt for qemu-devel@nongnu.org; Mon, 09 Feb 2009 12:42:34 -0500 Received: from [199.232.76.173] (port=47755 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LWa9Q-0007ER-Jd for qemu-devel@nongnu.org; Mon, 09 Feb 2009 12:42:32 -0500 Received: from mx2.redhat.com ([66.187.237.31]:38582) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LWa9P-0001Ge-GP for qemu-devel@nongnu.org; Mon, 09 Feb 2009 12:42:31 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n19HgUDf012738 for ; Mon, 9 Feb 2009 12:42:30 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n19HgUmS019022 for ; Mon, 9 Feb 2009 12:42:31 -0500 Received: from localhost.localdomain (vpn-10-207.str.redhat.com [10.32.10.207]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n19HgTtW015894 for ; Mon, 9 Feb 2009 12:42:30 -0500 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.14.3/8.14.3) with ESMTP id n19H3IEc004725 for ; Mon, 9 Feb 2009 22:33:20 +0530 Received: (from amit@localhost) by localhost.localdomain (8.14.3/8.14.3/Submit) id n19H3Grx004723 for qemu-devel@nongnu.org; Mon, 9 Feb 2009 22:33:16 +0530 Date: Mon, 9 Feb 2009 22:33:16 +0530 From: Amit Shah Subject: Re: [Qemu-devel] [6567] KVM: Get all cpuid values from function 2 (Amit Shah) Message-ID: <20090209170316.GA4214@amit-x200.pnq.redhat.com> References: <4990548C.60706@redhat.com> <49905DE1.7070808@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <49905DE1.7070808@codemonkey.ws> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On (Mon) Feb 09 2009 [10:46:25], Anthony Liguori wrote: > Avi Kivity wrote: >> Anthony Liguori wrote: >>> Revision: 6567 >>> http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6567 >>> Author: aliguori >>> Date: 2009-02-09 15:50:36 +0000 (Mon, 09 Feb 2009) >>> >>> Log Message: >>> ----------- >>> KVM: Get all cpuid values from function 2 (Amit Shah) >>> >>> cpuid function 2 can have multiple values to describe cache behaviour. >>> Loop till we have fetched all the values. >>> >> >> Note that if we are rescheduled on another cpu, or if another process >> calls cpuid 2 during the loop on the same cpu, this will break. > > That's unfortunate. If cpuid values can differ for individual > processors, than I don't see a great way to avoid this problem in > general. No, it won't differ for individual processors, but these values are stateful. cpuid 2 output depends on how many times it gets called. I can use sched_getaffinity() and then sched_setaffinity() if it's not pinned to one cpu to avoid the process jumping around; but can't think of how it can be avoided across scheduling points. Maybe a new ioctl(!) to return a struct with all these values? In any case, no current CPU has multiple values for cpuid fn 2. Amit