[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [6567] KVM: Get all cpuid values from function 2 (Amit
From: |
Amit Shah |
Subject: |
Re: [Qemu-devel] [6567] KVM: Get all cpuid values from function 2 (Amit Shah) |
Date: |
Mon, 9 Feb 2009 22:33:16 +0530 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
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