qemu-devel
[Top][All Lists]
Advanced

[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: Avi Kivity
Subject: Re: [Qemu-devel] [6567] KVM: Get all cpuid values from function 2 (Amit Shah)
Date: Mon, 09 Feb 2009 20:27:56 +0200
User-agent: Thunderbird 2.0.0.19 (X11/20090105)

Anthony Liguori wrote:

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.

The problem is not mismatched cpus, it's hidden state within the cpu.

If you look at the code, it just calls cpuid(2) repeatedly, and expects different results for the same inputs. That means the cpuid code in the cpu looks something like this:

   if (function == 2) {
       switch (hidden_function_2_state++) {
             // return different results
       }
   }

this hidden state is of course not maintained across context switches. Only the kernel can extract this information reliably. Note that we also need save this hidden state as part of savevm.

The word "unfortunate" doesn't even begin to describe it, even if one favors understatements.

--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]