public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* Stupid Xen vs KVM question
@ 2014-12-04 22:59 Andy Lutomirski
  2014-12-05  2:24 ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Lutomirski @ 2014-12-04 22:59 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, kvm list, Rusty Russell

This code in arch/x86/kernel/entry_32.S is wrong:

#ifdef CONFIG_PARAVIRT
    /*
     * The kernel can't run on a non-flat stack if paravirt mode
     * is active.  Rather than try to fixup the high bits of
     * ESP, bypass this code entirely.  This may break DOSemu
     * and/or Wine support in a paravirt VM, although the option
     * is still available to implement the setting of the high
     * 16-bits in the INTERRUPT_RETURN paravirt-op.
     */
    cmpl $0, pv_info+PARAVIRT_enabled
    jne restore_nocheck
#endif

On KVM guests, it notices that paravirt is enabled and bails.  It
should work fine on KVM -- the condition it should be checking is
whether we have native segmentation.

Do you know the right way to ask that?

Thanks,
Andy

-- 
Andy Lutomirski
AMA Capital Management, LLC

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

* Re: Stupid Xen vs KVM question
  2014-12-04 22:59 Stupid Xen vs KVM question Andy Lutomirski
@ 2014-12-05  2:24 ` Konrad Rzeszutek Wilk
  2014-12-05  7:29   ` Paolo Bonzini
  0 siblings, 1 reply; 5+ messages in thread
From: Konrad Rzeszutek Wilk @ 2014-12-05  2:24 UTC (permalink / raw)
  To: Andy Lutomirski; +Cc: kvm list, Rusty Russell

On Thu, Dec 04, 2014 at 02:59:48PM -0800, Andy Lutomirski wrote:
> This code in arch/x86/kernel/entry_32.S is wrong:
> 
> #ifdef CONFIG_PARAVIRT
>     /*
>      * The kernel can't run on a non-flat stack if paravirt mode
>      * is active.  Rather than try to fixup the high bits of
>      * ESP, bypass this code entirely.  This may break DOSemu
>      * and/or Wine support in a paravirt VM, although the option
>      * is still available to implement the setting of the high
>      * 16-bits in the INTERRUPT_RETURN paravirt-op.
>      */
>     cmpl $0, pv_info+PARAVIRT_enabled
>     jne restore_nocheck
> #endif
> 
> On KVM guests, it notices that paravirt is enabled and bails.  It
> should work fine on KVM -- the condition it should be checking is
> whether we have native segmentation.
> 
> Do you know the right way to ask that?

We could do a simple thing - which is that the paravirt_enabled
could have the value 1 for Xen and 2 for KVM. The assembler logic
would be inverted and just check for 1. I am not going to attempt
to write the assembler code :-)

> 
> Thanks,
> Andy
> 
> -- 
> Andy Lutomirski
> AMA Capital Management, LLC

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

* Re: Stupid Xen vs KVM question
  2014-12-05  2:24 ` Konrad Rzeszutek Wilk
@ 2014-12-05  7:29   ` Paolo Bonzini
  2014-12-05 16:09     ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2014-12-05  7:29 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Andy Lutomirski; +Cc: kvm list, Rusty Russell



On 05/12/2014 03:24, Konrad Rzeszutek Wilk wrote:
> We could do a simple thing - which is that the paravirt_enabled
> could have the value 1 for Xen and 2 for KVM. The assembler logic
> would be inverted and just check for 1. I am not going to attempt
> to write the assembler code :-)

Wouldn't Xen HVM also want to be 2?

Paolo

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

* Re: Stupid Xen vs KVM question
  2014-12-05  7:29   ` Paolo Bonzini
@ 2014-12-05 16:09     ` Konrad Rzeszutek Wilk
  2014-12-05 17:52       ` Andy Lutomirski
  0 siblings, 1 reply; 5+ messages in thread
From: Konrad Rzeszutek Wilk @ 2014-12-05 16:09 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Andy Lutomirski, kvm list, Rusty Russell

On Fri, Dec 05, 2014 at 08:29:54AM +0100, Paolo Bonzini wrote:
> 
> 
> On 05/12/2014 03:24, Konrad Rzeszutek Wilk wrote:
> > We could do a simple thing - which is that the paravirt_enabled
> > could have the value 1 for Xen and 2 for KVM. The assembler logic
> > would be inverted and just check for 1. I am not going to attempt
> > to write the assembler code :-)
> 
> Wouldn't Xen HVM also want to be 2?

Oddly enough it was never set!

Looking at where the paravit_enabled() macro is used, on KVM it could
be just set to zero.
> 
> Paolo

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

* Re: Stupid Xen vs KVM question
  2014-12-05 16:09     ` Konrad Rzeszutek Wilk
@ 2014-12-05 17:52       ` Andy Lutomirski
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Lutomirski @ 2014-12-05 17:52 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: kvm list, Paolo Bonzini, Rusty Russell

On Dec 5, 2014 8:09 AM, "Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com> wrote:
>
> On Fri, Dec 05, 2014 at 08:29:54AM +0100, Paolo Bonzini wrote:
> >
> >
> > On 05/12/2014 03:24, Konrad Rzeszutek Wilk wrote:
> > > We could do a simple thing - which is that the paravirt_enabled
> > > could have the value 1 for Xen and 2 for KVM. The assembler logic
> > > would be inverted and just check for 1. I am not going to attempt
> > > to write the assembler code :-)
> >
> > Wouldn't Xen HVM also want to be 2?
>
> Oddly enough it was never set!
>
> Looking at where the paravit_enabled() macro is used, on KVM it could
> be just set to zero.

I noticed that KVM is setting paravirt_enabled = 1 twice, once the
main kvm guest code and once in kvmclock.

Will the EBDA code in head.c care?

That would also increase sanity a little IMO.  We currently have
"paravirt" meaning that the normal HW architecture isn't present (Den,
lguest) and "paravirt" meaning that there are extra optional-to-use
hypervisor features (KVM, etc).

--Andy

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

end of thread, other threads:[~2014-12-05 17:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-04 22:59 Stupid Xen vs KVM question Andy Lutomirski
2014-12-05  2:24 ` Konrad Rzeszutek Wilk
2014-12-05  7:29   ` Paolo Bonzini
2014-12-05 16:09     ` Konrad Rzeszutek Wilk
2014-12-05 17:52       ` Andy Lutomirski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox