Stupid Xen vs KVM question

2014-12-04 Thread Andy Lutomirski
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
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Stupid Xen vs KVM question

2014-12-04 Thread Konrad Rzeszutek Wilk
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
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Stupid Xen vs KVM question

2014-12-04 Thread Paolo Bonzini


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
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Stupid Xen vs KVM question

2014-12-05 Thread Konrad Rzeszutek Wilk
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
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Stupid Xen vs KVM question

2014-12-05 Thread Andy Lutomirski
On Dec 5, 2014 8:09 AM, "Konrad Rzeszutek Wilk"  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
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html