qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] kvm: sync registers?
@ 2008-11-07 10:22 Gerd Hoffmann
  2008-11-07 14:03 ` Anthony Liguori
  0 siblings, 1 reply; 8+ messages in thread
From: Gerd Hoffmann @ 2008-11-07 10:22 UTC (permalink / raw)
  To: qemu-devel

  Hi,

How does kvm sync registers between kernel and qemu env?
I see there are kvm_arch_{get,put}_registers() functions in
target-i386/kvm.c, but grep doesn't find a single call of them?

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] kvm: sync registers?
  2008-11-07 10:22 [Qemu-devel] kvm: sync registers? Gerd Hoffmann
@ 2008-11-07 14:03 ` Anthony Liguori
  2008-11-07 15:57   ` Gerd Hoffmann
  2008-11-07 16:31   ` Paul Brook
  0 siblings, 2 replies; 8+ messages in thread
From: Anthony Liguori @ 2008-11-07 14:03 UTC (permalink / raw)
  To: qemu-devel

Gerd Hoffmann wrote:
>   Hi,
>
> How does kvm sync registers between kernel and qemu env?
> I see there are kvm_arch_{get,put}_registers() functions in
> target-i386/kvm.c, but grep doesn't find a single call of them?
>   

Right now, it doesn't.  We should probably sync registers in the same 
places that kvm-userspace does (gdbstubs, vmport, etc.).

I tried to always sync registers on every exit but this causes boot to 
fail. The same is true of kvm-userspace though and I've been meaning to 
dig into why this is.

Regards,

Anthony Liguori

> cheers,
>   Gerd
>
>
>   

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] kvm: sync registers?
  2008-11-07 14:03 ` Anthony Liguori
@ 2008-11-07 15:57   ` Gerd Hoffmann
  2008-11-07 16:25     ` Gerd Hoffmann
  2008-11-07 16:31   ` Paul Brook
  1 sibling, 1 reply; 8+ messages in thread
From: Gerd Hoffmann @ 2008-11-07 15:57 UTC (permalink / raw)
  To: qemu-devel

Anthony Liguori wrote:
> Gerd Hoffmann wrote:
>>   Hi,
>>
>> How does kvm sync registers between kernel and qemu env?
>> I see there are kvm_arch_{get,put}_registers() functions in
>> target-i386/kvm.c, but grep doesn't find a single call of them?
> 
> Right now, it doesn't.

Ok.  No wonder xenner doesn't boot xen pv guest kernels then.  kvm
doesn't see the protected-mode start-of-day setup done ...

> We should probably sync registers in the same 
> places that kvm-userspace does (gdbstubs, vmport, etc.).

Yep.

> I tried to always sync registers on every exit but this causes boot to
> fail. The same is true of kvm-userspace though and I've been meaning to
> dig into why this is.

Or that.  And maybe have a flag indicating qemu changed register state,
i.e. next vmenter must sync too.

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] kvm: sync registers?
  2008-11-07 15:57   ` Gerd Hoffmann
@ 2008-11-07 16:25     ` Gerd Hoffmann
  0 siblings, 0 replies; 8+ messages in thread
From: Gerd Hoffmann @ 2008-11-07 16:25 UTC (permalink / raw)
  To: qemu-devel

Gerd Hoffmann wrote:
> Anthony Liguori wrote:
>> Gerd Hoffmann wrote:
>>>   Hi,
>>>
>>> How does kvm sync registers between kernel and qemu env?
>>> I see there are kvm_arch_{get,put}_registers() functions in
>>> target-i386/kvm.c, but grep doesn't find a single call of them?
>> Right now, it doesn't.
> 
> Ok.  No wonder xenner doesn't boot xen pv guest kernels then.  kvm
> doesn't see the protected-mode start-of-day setup done ...

And sprinkle in a kvm_arch_put_registers() call to the right place fixed
it nicely.

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] kvm: sync registers?
  2008-11-07 14:03 ` Anthony Liguori
  2008-11-07 15:57   ` Gerd Hoffmann
@ 2008-11-07 16:31   ` Paul Brook
  2008-11-07 16:40     ` Anthony Liguori
  2008-11-07 17:01     ` Gerd Hoffmann
  1 sibling, 2 replies; 8+ messages in thread
From: Paul Brook @ 2008-11-07 16:31 UTC (permalink / raw)
  To: qemu-devel

On Friday 07 November 2008, Anthony Liguori wrote:
> Gerd Hoffmann wrote:
> >   Hi,
> >
> > How does kvm sync registers between kernel and qemu env?
> > I see there are kvm_arch_{get,put}_registers() functions in
> > target-i386/kvm.c, but grep doesn't find a single call of them?
>
> Right now, it doesn't.  We should probably sync registers in the same
> places that kvm-userspace does (gdbstubs, vmport, etc.).
>
> I tried to always sync registers on every exit but this causes boot to
> fail. The same is true of kvm-userspace though and I've been meaning to
> dig into why this is.

Maybe due to do with inconsistencies between the segment register contents and 
the descriptor tables? I know I've written code that relies on this feature.

Paul

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] kvm: sync registers?
  2008-11-07 16:31   ` Paul Brook
@ 2008-11-07 16:40     ` Anthony Liguori
  2008-11-09 14:30       ` Avi Kivity
  2008-11-07 17:01     ` Gerd Hoffmann
  1 sibling, 1 reply; 8+ messages in thread
From: Anthony Liguori @ 2008-11-07 16:40 UTC (permalink / raw)
  To: Paul Brook; +Cc: qemu-devel

Paul Brook wrote:
> On Friday 07 November 2008, Anthony Liguori wrote:
>   
>> Gerd Hoffmann wrote:
>>     
>>>   Hi,
>>>
>>> How does kvm sync registers between kernel and qemu env?
>>> I see there are kvm_arch_{get,put}_registers() functions in
>>> target-i386/kvm.c, but grep doesn't find a single call of them?
>>>       
>> Right now, it doesn't.  We should probably sync registers in the same
>> places that kvm-userspace does (gdbstubs, vmport, etc.).
>>
>> I tried to always sync registers on every exit but this causes boot to
>> fail. The same is true of kvm-userspace though and I've been meaning to
>> dig into why this is.
>>     
>
> Maybe due to do with inconsistencies between the segment register contents and 
> the descriptor tables? I know I've written code that relies on this feature.
>   

VT/SVM actually allow you to get at the descriptor tables/cache and we 
save/restore them in KVM.  I only see this issue if I always 
save/restore registers so it leads me to think it's something more subtle.

Regards,

Anthony Liguori

> Paul
>   

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] kvm: sync registers?
  2008-11-07 16:31   ` Paul Brook
  2008-11-07 16:40     ` Anthony Liguori
@ 2008-11-07 17:01     ` Gerd Hoffmann
  1 sibling, 0 replies; 8+ messages in thread
From: Gerd Hoffmann @ 2008-11-07 17:01 UTC (permalink / raw)
  To: qemu-devel

Paul Brook wrote:
> On Friday 07 November 2008, Anthony Liguori wrote:
>> Gerd Hoffmann wrote:
>>>   Hi,
>>>
>>> How does kvm sync registers between kernel and qemu env?
>>> I see there are kvm_arch_{get,put}_registers() functions in
>>> target-i386/kvm.c, but grep doesn't find a single call of them?
>> Right now, it doesn't.  We should probably sync registers in the same
>> places that kvm-userspace does (gdbstubs, vmport, etc.).
>>
>> I tried to always sync registers on every exit but this causes boot to
>> fail. The same is true of kvm-userspace though and I've been meaning to
>> dig into why this is.
> 
> Maybe due to do with inconsistencies between the segment register contents and 
> the descriptor tables? I know I've written code that relies on this feature.

Unlikely.  xenner depends on that too, and also on kvm supporting it.
start-of-day actually sets up the segment registers only, not any
descriptor tables, then starts the guest in protected mode.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] kvm: sync registers?
  2008-11-07 16:40     ` Anthony Liguori
@ 2008-11-09 14:30       ` Avi Kivity
  0 siblings, 0 replies; 8+ messages in thread
From: Avi Kivity @ 2008-11-09 14:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paul Brook

Anthony Liguori wrote:
>
> VT/SVM actually allow you to get at the descriptor tables/cache and we 
> save/restore them in KVM.  I only see this issue if I always 
> save/restore registers so it leads me to think it's something more 
> subtle.

Perhaps it's related to the segment hacking we do on vmx in real mode.

-- 
error compiling committee.c: too many arguments to function

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-11-09 14:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-07 10:22 [Qemu-devel] kvm: sync registers? Gerd Hoffmann
2008-11-07 14:03 ` Anthony Liguori
2008-11-07 15:57   ` Gerd Hoffmann
2008-11-07 16:25     ` Gerd Hoffmann
2008-11-07 16:31   ` Paul Brook
2008-11-07 16:40     ` Anthony Liguori
2008-11-09 14:30       ` Avi Kivity
2008-11-07 17:01     ` Gerd Hoffmann

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).