qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Amit Shah <amit.shah@redhat.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [6567] KVM: Get all cpuid values from function 2 (Amit Shah)
Date: Mon, 9 Feb 2009 22:33:16 +0530	[thread overview]
Message-ID: <20090209170316.GA4214@amit-x200.pnq.redhat.com> (raw)
In-Reply-To: <49905DE1.7070808@codemonkey.ws>

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

  reply	other threads:[~2009-02-09 17:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-09 15:50 [Qemu-devel] [6567] KVM: Get all cpuid values from function 2 (Amit Shah) Anthony Liguori
2009-02-09 16:06 ` Avi Kivity
2009-02-09 16:46   ` Anthony Liguori
2009-02-09 17:03     ` Amit Shah [this message]
2009-02-09 18:27     ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090209170316.GA4214@amit-x200.pnq.redhat.com \
    --to=amit.shah@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).