HVM hypercalls

classic Classic list List threaded Threaded
24 messages Options
12
Reply | Threaded
Open this post in threaded view
|

HVM hypercalls

Ruslan Nikolaev-2
Hi

I need to use hypercalls from HVM domain (e.g. HYPERVISOR_add_to_physmap). However, it does not work when I am trying to invoke it from HVM Linux guest. Basically, I don't see that anything happens on hypervisor's side. I also grep'ed the guest code for 'vmmcall'/'vmcall' and did not find anything. Is it possible to do it at all? Is it possible to make hypercalls from HVM domains or are they simply used for tools responsible to load HVM domain? Also, are they allowed (if allowed at all) from stubdom, ioemu, or both configurations?

I am using latest Xen version (xen-4.0.1-rc). I also tried both official Linux distribution as an HVM domain and the version from Xen repositary. The computer has Nehalem processor with VMX.

Thanks,
Ruslan.



     

_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xensource.com/xen-devel
Reply | Threaded
Open this post in threaded view
|

RE: HVM hypercalls

Dan Magenheimer-2
Xen only allows certain hypercalls from an HVM guest
and the list is kept in tables in arch/x86/hvm/hvm.c.
See http://xenbits.xensource.com/xen-unstable.hg?rev/72c6228b5f0f 
for an example of adding an existing hypercall so that
it will be sent through to Xen.  Note that there is
no guarantee that any particular hypercall will work
properly from an HVM guest... this is just the mechanism
for getting a hypercall to be allowed by Xen.

> -----Original Message-----
> From: Ruslan Nikolaev [mailto:[hidden email]]
> Sent: Wednesday, July 28, 2010 1:23 PM
> To: [hidden email]
> Subject: [Xen-devel] HVM hypercalls
>
> Hi
>
> I need to use hypercalls from HVM domain (e.g.
> HYPERVISOR_add_to_physmap). However, it does not work when I am trying
> to invoke it from HVM Linux guest. Basically, I don't see that anything
> happens on hypervisor's side. I also grep'ed the guest code for
> 'vmmcall'/'vmcall' and did not find anything. Is it possible to do it
> at all? Is it possible to make hypercalls from HVM domains or are they
> simply used for tools responsible to load HVM domain? Also, are they
> allowed (if allowed at all) from stubdom, ioemu, or both
> configurations?
>
> I am using latest Xen version (xen-4.0.1-rc). I also tried both
> official Linux distribution as an HVM domain and the version from Xen
> repositary. The computer has Nehalem processor with VMX.
>
> Thanks,
> Ruslan.
>
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> [hidden email]
> http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xensource.com/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: HVM hypercalls

Juergen Gross-2
In reply to this post by Ruslan Nikolaev-2
On 07/28/2010 09:22 PM, Ruslan Nikolaev wrote:
> Hi
>
> I need to use hypercalls from HVM domain (e.g. HYPERVISOR_add_to_physmap). However, it does not work when I am trying to invoke it from HVM Linux guest. Basically, I don't see that anything happens on hypervisor's side. I also grep'ed the guest code for 'vmmcall'/'vmcall' and did not find anything. Is it possible to do it at all? Is it possible to make hypercalls from HVM domains or are they simply used for tools responsible to load HVM domain? Also, are they allowed (if allowed at all) from stubdom, ioemu, or both configurations?
>
> I am using latest Xen version (xen-4.0.1-rc). I also tried both official Linux distribution as an HVM domain and the version from Xen repositary. The computer has Nehalem processor with VMX.

This should work.
We are using hypercalls from HVM domains without any problem on xen 3.3 and
4.0, one of them being HYPERVISOR_add_to_physmap. There must be something
you are doing wrong.

The following steps are required:

- use the cpuid instruction to search for Xen signature. You should begin with
   index 0x40000000 and look for the text "XenVMMXenVMM" in the returned
   registers ebx, ecx and edx. Increment the index by 0x100 up to 0x40001000 if
   necessary.
- get the xen msr register number via cpuid with index 0x40000x002 (x from
   step 1). The msr register number will be in register ebx.
- write the physical address of a 4k page to the obtained msr register via
   wrmsr. This page will be used by the hypervisor to write the appropriate
   code for the hypercalls to.
- each entry in that page occupies 32 bytes. You can do a specific hypercall
   by calling the function at the specific entry with the hypercall number as
   index


Juergen

--
Juergen Gross                 Principal Developer Operating Systems
TSP ES&S SWE OS6                       Telephone: +49 (0) 89 3222 2967
Fujitsu Technology Solutions              e-mail: [hidden email]
Domagkstr. 28                           Internet: ts.fujitsu.com
D-80807 Muenchen                 Company details: ts.fujitsu.com/imprint.html

_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xensource.com/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: HVM hypercalls

Ruslan Nikolaev-2
Thank you very much! I'll try this. BTW is it required to do this for every module with HVM hypercalls or there is some shared initialization code in HVM guest (Linux) similar to one used in paravirtualized guests?

If it's supposed to be in a module, is there any good example I can look at?

AFAIK hypercall_page is being initialized on Xen side with appropriate vmcall/vmmcall code. Is this CPUID mechanism a standard way to obtain hypercall_page reference on HVM domain?

Thank you!
Ruslan.

--- On Thu, 7/29/10, Juergen Gross <[hidden email]> wrote:

> From: Juergen Gross <[hidden email]>
> Subject: Re: [Xen-devel] HVM hypercalls
> To: "Ruslan Nikolaev" <[hidden email]>
> Cc: [hidden email]
> Date: Thursday, July 29, 2010, 11:30 AM
> On 07/28/2010 09:22 PM, Ruslan
> Nikolaev wrote:
> > Hi
> >
> > I need to use hypercalls from HVM domain (e.g.
> HYPERVISOR_add_to_physmap). However, it does not work when I
> am trying to invoke it from HVM Linux guest. Basically, I
> don't see that anything happens on hypervisor's side. I also
> grep'ed the guest code for 'vmmcall'/'vmcall' and did not
> find anything. Is it possible to do it at all? Is it
> possible to make hypercalls from HVM domains or are they
> simply used for tools responsible to load HVM domain? Also,
> are they allowed (if allowed at all) from stubdom, ioemu, or
> both configurations?
> >
> > I am using latest Xen version (xen-4.0.1-rc). I also
> tried both official Linux distribution as an HVM domain and
> the version from Xen repositary. The computer has Nehalem
> processor with VMX.
>
> This should work.
> We are using hypercalls from HVM domains without any
> problem on xen 3.3 and
> 4.0, one of them being HYPERVISOR_add_to_physmap. There
> must be something
> you are doing wrong.
>
> The following steps are required:
>
> - use the cpuid instruction to search for Xen signature.
> You should begin with
>   index 0x40000000 and look for the text
> "XenVMMXenVMM" in the returned
>   registers ebx, ecx and edx. Increment the index by
> 0x100 up to 0x40001000 if
>   necessary.
> - get the xen msr register number via cpuid with index
> 0x40000x002 (x from
>   step 1). The msr register number will be in register
> ebx.
> - write the physical address of a 4k page to the obtained
> msr register via
>   wrmsr. This page will be used by the hypervisor to
> write the appropriate
>   code for the hypercalls to.
> - each entry in that page occupies 32 bytes. You can do a
> specific hypercall
>   by calling the function at the specific entry with
> the hypercall number as
>   index
>
>
> Juergen
>
> -- Juergen Gross           
>      Principal Developer Operating
> Systems
> TSP ES&S SWE OS6         
>          
>    Telephone: +49 (0) 89 3222 2967
> Fujitsu Technology Solutions       
>       e-mail: [hidden email]
> Domagkstr. 28           
>            
>    Internet: ts.fujitsu.com
> D-80807 Muenchen           
>      Company details:
> ts.fujitsu.com/imprint.html
>
> _______________________________________________
> Xen-devel mailing list
> [hidden email]
> http://lists.xensource.com/xen-devel
>




_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xensource.com/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: HVM hypercalls

Jeremy Fitzhardinge
  On 07/29/2010 11:55 AM, Ruslan Nikolaev wrote:
> Thank you very much! I'll try this. BTW is it required to do this for every module with HVM hypercalls or there is some shared initialization code in HVM guest (Linux) similar to one used in paravirtualized guests?
>
> If it's supposed to be in a module, is there any good example I can look at?
>
> AFAIK hypercall_page is being initialized on Xen side with appropriate vmcall/vmmcall code. Is this CPUID mechanism a standard way to obtain hypercall_page reference on HVM domain?

What kernel are you working with?  There's already code to implement
pv-on-hvm support for various recent pvops kernels, so you can just base
your work on those.

     J


_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xensource.com/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: HVM hypercalls

Ruslan Nikolaev-2
I have 2 kernels:

1. From Xen repositary pvops-git (2.6.31.13).
2. From kernel.org: 2.6.32.16

Thank you!
Ruslan.


--- On Thu, 7/29/10, Jeremy Fitzhardinge <[hidden email]> wrote:

> From: Jeremy Fitzhardinge <[hidden email]>
> Subject: Re: [Xen-devel] HVM hypercalls
> To: "Ruslan Nikolaev" <[hidden email]>
> Cc: [hidden email]
> Date: Thursday, July 29, 2010, 11:47 PM
>  On 07/29/2010 11:55 AM, Ruslan
> Nikolaev wrote:
> > Thank you very much! I'll try this. BTW is it required
> to do this for every module with HVM hypercalls or there is
> some shared initialization code in HVM guest (Linux) similar
> to one used in paravirtualized guests?
> >
> > If it's supposed to be in a module, is there any good
> example I can look at?
> >
> > AFAIK hypercall_page is being initialized on Xen side
> with appropriate vmcall/vmmcall code. Is this CPUID
> mechanism a standard way to obtain hypercall_page reference
> on HVM domain?
>
> What kernel are you working with?  There's already
> code to implement pv-on-hvm support for various recent pvops
> kernels, so you can just base your work on those.
>
>     J
>
>




_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xensource.com/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: HVM hypercalls

Jeremy Fitzhardinge
  On 07/30/2010 09:06 AM, Ruslan Nikolaev wrote:
> I have 2 kernels:
>
> 1. From Xen repositary pvops-git (2.6.31.13).

You want 2.6.32.16 from xen.git - the branch is xen/stable-2.6.32.x

     J

> 2. From kernel.org: 2.6.32.16
>
> Thank you!
> Ruslan.
>
>
> --- On Thu, 7/29/10, Jeremy Fitzhardinge<[hidden email]>  wrote:
>
>> From: Jeremy Fitzhardinge<[hidden email]>
>> Subject: Re: [Xen-devel] HVM hypercalls
>> To: "Ruslan Nikolaev"<[hidden email]>
>> Cc: [hidden email]
>> Date: Thursday, July 29, 2010, 11:47 PM
>>   On 07/29/2010 11:55 AM, Ruslan
>> Nikolaev wrote:
>>> Thank you very much! I'll try this. BTW is it required
>> to do this for every module with HVM hypercalls or there is
>> some shared initialization code in HVM guest (Linux) similar
>> to one used in paravirtualized guests?
>>> If it's supposed to be in a module, is there any good
>> example I can look at?
>>> AFAIK hypercall_page is being initialized on Xen side
>> with appropriate vmcall/vmmcall code. Is this CPUID
>> mechanism a standard way to obtain hypercall_page reference
>> on HVM domain?
>>
>> What kernel are you working with?  There's already
>> code to implement pv-on-hvm support for various recent pvops
>> kernels, so you can just base your work on those.
>>
>>      J
>>
>>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> [hidden email]
> http://lists.xensource.com/xen-devel
>


_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xensource.com/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: HVM hypercalls

Ruslan Nikolaev-2
In reply to this post by Ruslan Nikolaev-2
Thanks!


> --- On Sat, 7/31/10, Jeremy Fitzhardinge <[hidden email]>
> wrote:
>
> > From: Jeremy Fitzhardinge <[hidden email]>
> > Subject: Re: [Xen-devel] HVM hypercalls
> > To: "Ruslan Nikolaev" <[hidden email]>
> > Cc: [hidden email]
> > Date: Saturday, July 31, 2010, 4:07 AM
> >   On 07/30/2010 09:06 AM, Ruslan
> > Nikolaev wrote:
> > > I have 2 kernels:
> > >
> > > 1. From Xen repositary pvops-git (2.6.31.13).
> >
> > You want 2.6.32.16 from xen.git - the branch is
> > xen/stable-2.6.32.x
> >
> >      J
> >
> > > 2. From kernel.org: 2.6.32.16
> > >
> > > Thank you!
> > > Ruslan.
> > >
> > >
> > > --- On Thu, 7/29/10, Jeremy Fitzhardinge<[hidden email]
> > wrote:
> > >
> > >> From: Jeremy Fitzhardinge<[hidden email]>
> > >> Subject: Re: [Xen-devel] HVM hypercalls
> > >> To: "Ruslan Nikolaev"<[hidden email]>
> > >> Cc: [hidden email]
> > >> Date: Thursday, July 29, 2010, 11:47 PM
> > >>   On 07/29/2010 11:55 AM, Ruslan
> > >> Nikolaev wrote:
> > >>> Thank you very much! I'll try this. BTW
> is it
> > required
> > >> to do this for every module with HVM
> hypercalls or
> > there is
> > >> some shared initialization code in HVM guest
> > (Linux) similar
> > >> to one used in paravirtualized guests?
> > >>> If it's supposed to be in a module, is
> there
> > any good
> > >> example I can look at?
> > >>> AFAIK hypercall_page is being initialized
> on
> > Xen side
> > >> with appropriate vmcall/vmmcall code. Is
> this
> > CPUID
> > >> mechanism a standard way to obtain
> hypercall_page
> > reference
> > >> on HVM domain?
> > >>
> > >> What kernel are you working with?  There's
> > already
> > >> code to implement pv-on-hvm support for
> various
> > recent pvops
> > >> kernels, so you can just base your work on
> those.
> > >>
> > >>      J
> > >>
> > >>
> > >
> > >
> > >
> > > _______________________________________________
> > > Xen-devel mailing list
> > > [hidden email]
> > > http://lists.xensource.com/xen-devel
> > >
> >
> >
>
>
>
>




_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xensource.com/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: HVM hypercalls

Ruslan Nikolaev-2
In reply to this post by Jeremy Fitzhardinge
I've just tried to configure newever version (2.6.32.16) from repositary. However, boot fails because no root device is found. I am using disk image (the line in HVM config is disk = [ 'file:/home/ruslan/fs1.img,hda,w' ])
I also tried to compile kernel with 'blktap' driver which is disabled in default kernel config, but it does not help.

The previous version (2.6.31.13) worked fine with the same disk image and default configuration.

Thanks,
Ruslan.

--- On Sat, 7/31/10, Jeremy Fitzhardinge <[hidden email]> wrote:

> From: Jeremy Fitzhardinge <[hidden email]>
> Subject: Re: [Xen-devel] HVM hypercalls
> To: "Ruslan Nikolaev" <[hidden email]>
> Cc: [hidden email]
> Date: Saturday, July 31, 2010, 4:07 AM
>   On 07/30/2010 09:06 AM, Ruslan
> Nikolaev wrote:
> > I have 2 kernels:
> >
> > 1. From Xen repositary pvops-git (2.6.31.13).
>
> You want 2.6.32.16 from xen.git - the branch is
> xen/stable-2.6.32.x
>
>      J
>
> > 2. From kernel.org: 2.6.32.16
> >
> > Thank you!
> > Ruslan.
> >
> >
> > --- On Thu, 7/29/10, Jeremy Fitzhardinge<[hidden email]
> wrote:
> >
> >> From: Jeremy Fitzhardinge<[hidden email]>
> >> Subject: Re: [Xen-devel] HVM hypercalls
> >> To: "Ruslan Nikolaev"<[hidden email]>
> >> Cc: [hidden email]
> >> Date: Thursday, July 29, 2010, 11:47 PM
> >>   On 07/29/2010 11:55 AM, Ruslan
> >> Nikolaev wrote:
> >>> Thank you very much! I'll try this. BTW is it
> required
> >> to do this for every module with HVM hypercalls or
> there is
> >> some shared initialization code in HVM guest
> (Linux) similar
> >> to one used in paravirtualized guests?
> >>> If it's supposed to be in a module, is there
> any good
> >> example I can look at?
> >>> AFAIK hypercall_page is being initialized on
> Xen side
> >> with appropriate vmcall/vmmcall code. Is this
> CPUID
> >> mechanism a standard way to obtain hypercall_page
> reference
> >> on HVM domain?
> >>
> >> What kernel are you working with?  There's
> already
> >> code to implement pv-on-hvm support for various
> recent pvops
> >> kernels, so you can just base your work on those.
> >>
> >>      J
> >>
> >>
> >
> >
> >
> > _______________________________________________
> > Xen-devel mailing list
> > [hidden email]
> > http://lists.xensource.com/xen-devel
> >
>
>
> _______________________________________________
> Xen-devel mailing list
> [hidden email]
> http://lists.xensource.com/xen-devel
>




_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xensource.com/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: HVM hypercalls

Ruslan Nikolaev-2
In reply to this post by Ruslan Nikolaev-2
I've just tried to configure newever version (2.6.32.16) from repositary. However, boot fails because no root device is found. I am using disk image (the line in HVM config is disk = [ 'file:/home/ruslan/fs1.img,hda,w' ])
I also tried to compile kernel with 'blktap' driver which is disabled in default kernel config, but it does not help.

The previous version (2.6.31.13) worked fine with the same disk image and default configuration.

Thanks,
Ruslan.

>
> --- On Sat, 7/31/10, Jeremy Fitzhardinge <[hidden email]>
> wrote:
>
> > From: Jeremy Fitzhardinge <[hidden email]>
> > Subject: Re: [Xen-devel] HVM hypercalls
> > To: "Ruslan Nikolaev" <[hidden email]>
> > Cc: [hidden email]
> > Date: Saturday, July 31, 2010, 4:07 AM
> >   On 07/30/2010 09:06 AM, Ruslan
> > Nikolaev wrote:
> > > I have 2 kernels:
> > >
> > > 1. From Xen repositary pvops-git (2.6.31.13).
> >
> > You want 2.6.32.16 from xen.git - the branch is
> > xen/stable-2.6.32.x
> >
> >      J
> >
> > > 2. From kernel.org: 2.6.32.16
> > >
> > > Thank you!
> > > Ruslan.
> > >
> > >
> > > --- On Thu, 7/29/10, Jeremy Fitzhardinge<[hidden email]
> > wrote:
> > >
> > >> From: Jeremy Fitzhardinge<[hidden email]>
> > >> Subject: Re: [Xen-devel] HVM hypercalls
> > >> To: "Ruslan Nikolaev"<[hidden email]>
> > >> Cc: [hidden email]
> > >> Date: Thursday, July 29, 2010, 11:47 PM
> > >>   On 07/29/2010 11:55 AM, Ruslan
> > >> Nikolaev wrote:
> > >>> Thank you very much! I'll try this. BTW
> is it
> > required
> > >> to do this for every module with HVM
> hypercalls or
> > there is
> > >> some shared initialization code in HVM guest
> > (Linux) similar
> > >> to one used in paravirtualized guests?
> > >>> If it's supposed to be in a module, is
> there
> > any good
> > >> example I can look at?
> > >>> AFAIK hypercall_page is being initialized
> on
> > Xen side
> > >> with appropriate vmcall/vmmcall code. Is
> this
> > CPUID
> > >> mechanism a standard way to obtain
> hypercall_page
> > reference
> > >> on HVM domain?
> > >>
> > >> What kernel are you working with?  There's
> > already
> > >> code to implement pv-on-hvm support for
> various
> > recent pvops
> > >> kernels, so you can just base your work on
> those.
> > >>
> > >>      J
> > >>
> > >>
> > >
> > >
> > >
> > > _______________________________________________
> > > Xen-devel mailing list
> > > [hidden email]
> > > http://lists.xensource.com/xen-devel
> > >
> >
> >
> > _______________________________________________
> > Xen-devel mailing list
> > [hidden email]
> > http://lists.xensource.com/xen-devel
> >
>
>
>
>




_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xensource.com/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: HVM hypercalls

Jeremy Fitzhardinge
In reply to this post by Ruslan Nikolaev-2
  On 08/03/2010 12:48 PM, Ruslan Nikolaev wrote:
> I've just tried to configure newever version (2.6.32.16) from repositary. However, boot fails because no root device is found. I am using disk image (the line in HVM config is disk = [ 'file:/home/ruslan/fs1.img,hda,w' ])
> I also tried to compile kernel with 'blktap' driver which is disabled in default kernel config, but it does not help.

What is your root= parameter?  If you're using pv-on-hvm drivers, then
the device will be named /dev/xvd[a-d] (for the moment).  It's very
strongly recommended that you don't use a device-based root name (ie,
use LABEL= UUID= or LVM for your root device) so that your config is
failsafe against root device name changes.

     J

> The previous version (2.6.31.13) worked fine with the same disk image and default configuration.
>
> Thanks,
> Ruslan.
>
> --- On Sat, 7/31/10, Jeremy Fitzhardinge<[hidden email]>  wrote:
>
>> From: Jeremy Fitzhardinge<[hidden email]>
>> Subject: Re: [Xen-devel] HVM hypercalls
>> To: "Ruslan Nikolaev"<[hidden email]>
>> Cc: [hidden email]
>> Date: Saturday, July 31, 2010, 4:07 AM
>>    On 07/30/2010 09:06 AM, Ruslan
>> Nikolaev wrote:
>>> I have 2 kernels:
>>>
>>> 1. From Xen repositary pvops-git (2.6.31.13).
>> You want 2.6.32.16 from xen.git - the branch is
>> xen/stable-2.6.32.x
>>
>>       J
>>
>>> 2. From kernel.org: 2.6.32.16
>>>
>>> Thank you!
>>> Ruslan.
>>>
>>>
>>> --- On Thu, 7/29/10, Jeremy Fitzhardinge<[hidden email]>
>> wrote:
>>>> From: Jeremy Fitzhardinge<[hidden email]>
>>>> Subject: Re: [Xen-devel] HVM hypercalls
>>>> To: "Ruslan Nikolaev"<[hidden email]>
>>>> Cc: [hidden email]
>>>> Date: Thursday, July 29, 2010, 11:47 PM
>>>>     On 07/29/2010 11:55 AM, Ruslan
>>>> Nikolaev wrote:
>>>>> Thank you very much! I'll try this. BTW is it
>> required
>>>> to do this for every module with HVM hypercalls or
>> there is
>>>> some shared initialization code in HVM guest
>> (Linux) similar
>>>> to one used in paravirtualized guests?
>>>>> If it's supposed to be in a module, is there
>> any good
>>>> example I can look at?
>>>>> AFAIK hypercall_page is being initialized on
>> Xen side
>>>> with appropriate vmcall/vmmcall code. Is this
>> CPUID
>>>> mechanism a standard way to obtain hypercall_page
>> reference
>>>> on HVM domain?
>>>>
>>>> What kernel are you working with?  There's
>> already
>>>> code to implement pv-on-hvm support for various
>> recent pvops
>>>> kernels, so you can just base your work on those.
>>>>
>>>>        J
>>>>
>>>>
>>>
>>>
>>> _______________________________________________
>>> Xen-devel mailing list
>>> [hidden email]
>>> http://lists.xensource.com/xen-devel
>>>
>>
>> _______________________________________________
>> Xen-devel mailing list
>> [hidden email]
>> http://lists.xensource.com/xen-devel
>>
>
>
>


_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xensource.com/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: HVM hypercalls

Ruslan Nikolaev-2
Yes, I tried this but it does not seem to work. BTW in paravirtualized mode it works fine, the problem is only with HVM.

I tried to specify root=/dev/xvda (my disk image has no partitions, entire disk image is a single file system).

My config is (I also tried to comment out device model but it does not help):

import os, re
arch = os.uname()[4]
if re.search('64', arch):
    arch_libdir = 'lib64'
else:
    arch_libdir = 'lib'

kernel = "/usr/lib/xen/boot/hvmloader"

builder='hvm'

vcpus=1

memory = 1024
shadow_memory = 8
name = "xenhvm1"
disk = [ 'file:/home/ruslan/fs1.img,xvda,w' ]
device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm'
# boot on floppy (a), hard disk (c) or CD-ROM (d)
# default: hard disk, cd-rom, floppy
boot="c"

sdl=1
vnc=0
vncviewer=0
vncpasswd=''
stdvga=1
serial='pty'
usbdevice='tablet'

Thanks,
Ruslan

--- On Wed, 8/4/10, Jeremy Fitzhardinge <[hidden email]> wrote:

> From: Jeremy Fitzhardinge <[hidden email]>
> Subject: Re: [Xen-devel] HVM hypercalls
> To: "Ruslan Nikolaev" <[hidden email]>
> Cc: [hidden email]
> Date: Wednesday, August 4, 2010, 1:40 AM
>   On 08/03/2010 12:48 PM, Ruslan
> Nikolaev wrote:
> > I've just tried to configure newever version
> (2.6.32.16) from repositary. However, boot fails because no
> root device is found. I am using disk image (the line in HVM
> config is disk = [ 'file:/home/ruslan/fs1.img,hda,w' ])
> > I also tried to compile kernel with 'blktap' driver
> which is disabled in default kernel config, but it does not
> help.
>
> What is your root= parameter?  If you're using
> pv-on-hvm drivers, then
> the device will be named /dev/xvd[a-d] (for the
> moment).  It's very
> strongly recommended that you don't use a device-based root
> name (ie,
> use LABEL= UUID= or LVM for your root device) so that your
> config is
> failsafe against root device name changes.
>
>      J
>
> > The previous version (2.6.31.13) worked fine with the
> same disk image and default configuration.
> >
> > Thanks,
> > Ruslan.
> >
> > --- On Sat, 7/31/10, Jeremy Fitzhardinge<[hidden email]
> wrote:
> >
> >> From: Jeremy Fitzhardinge<[hidden email]>
> >> Subject: Re: [Xen-devel] HVM hypercalls
> >> To: "Ruslan Nikolaev"<[hidden email]>
> >> Cc: [hidden email]
> >> Date: Saturday, July 31, 2010, 4:07 AM
> >>    On 07/30/2010 09:06 AM, Ruslan
> >> Nikolaev wrote:
> >>> I have 2 kernels:
> >>>
> >>> 1. From Xen repositary pvops-git (2.6.31.13).
> >> You want 2.6.32.16 from xen.git - the branch is
> >> xen/stable-2.6.32.x
> >>
> >>       J
> >>
> >>> 2. From kernel.org: 2.6.32.16
> >>>
> >>> Thank you!
> >>> Ruslan.
> >>>
> >>>
> >>> --- On Thu, 7/29/10, Jeremy Fitzhardinge<[hidden email]>
> >> wrote:
> >>>> From: Jeremy Fitzhardinge<[hidden email]>
> >>>> Subject: Re: [Xen-devel] HVM hypercalls
> >>>> To: "Ruslan Nikolaev"<[hidden email]>
> >>>> Cc: [hidden email]
> >>>> Date: Thursday, July 29, 2010, 11:47 PM
> >>>>     On 07/29/2010
> 11:55 AM, Ruslan
> >>>> Nikolaev wrote:
> >>>>> Thank you very much! I'll try this.
> BTW is it
> >> required
> >>>> to do this for every module with HVM
> hypercalls or
> >> there is
> >>>> some shared initialization code in HVM
> guest
> >> (Linux) similar
> >>>> to one used in paravirtualized guests?
> >>>>> If it's supposed to be in a module, is
> there
> >> any good
> >>>> example I can look at?
> >>>>> AFAIK hypercall_page is being
> initialized on
> >> Xen side
> >>>> with appropriate vmcall/vmmcall code. Is
> this
> >> CPUID
> >>>> mechanism a standard way to obtain
> hypercall_page
> >> reference
> >>>> on HVM domain?
> >>>>
> >>>> What kernel are you working with? 
> There's
> >> already
> >>>> code to implement pv-on-hvm support for
> various
> >> recent pvops
> >>>> kernels, so you can just base your work on
> those.
> >>>>
> >>>>        J
> >>>>
> >>>>
> >>>
> >>>
> >>>
> _______________________________________________
> >>> Xen-devel mailing list
> >>> [hidden email]
> >>> http://lists.xensource.com/xen-devel
> >>>
> >>
> >> _______________________________________________
> >> Xen-devel mailing list
> >> [hidden email]
> >> http://lists.xensource.com/xen-devel
> >>
> >
> >
> >
>
>
> _______________________________________________
> Xen-devel mailing list
> [hidden email]
> http://lists.xensource.com/xen-devel
>





_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xensource.com/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: HVM hypercalls

Christoph Egger-2
On Wednesday 04 August 2010 19:41:20 Ruslan Nikolaev wrote:
> Yes, I tried this but it does not seem to work. BTW in paravirtualized mode
> it works fine, the problem is only with HVM.
>
> I tried to specify root=/dev/xvda (my disk image has no partitions, entire
> disk image is a single file system).
>
> My config is (I also tried to comment out device model but it does not
> help):

You can simplify your guest config file:


> import os, re
> arch = os.uname()[4]
> if re.search('64', arch):
>     arch_libdir = 'lib64'
> else:
>     arch_libdir = 'lib'

Remove this part.

> kernel = "/usr/lib/xen/boot/hvmloader"

kernel = "hvmloader"

> builder='hvm'
>
> vcpus=1
>
> memory = 1024
> shadow_memory = 8
> name = "xenhvm1"
> disk = [ 'file:/home/ruslan/fs1.img,xvda,w' ]
> device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm'

device_model = "qemu-dm"

> # boot on floppy (a), hard disk (c) or CD-ROM (d)
> # default: hard disk, cd-rom, floppy
> boot="c"
>
> sdl=1
> vnc=0
> vncviewer=0
> vncpasswd=''
> stdvga=1
> serial='pty'
> usbdevice='tablet'


Christoph



--
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632


_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xensource.com/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: HVM hypercalls

Stefano Stabellini-3
In reply to this post by Ruslan Nikolaev-2
On Wed, 4 Aug 2010, Ruslan Nikolaev wrote:
> Yes, I tried this but it does not seem to work. BTW in paravirtualized mode it works fine, the problem is only with HVM.
>
> I tried to specify root=/dev/xvda (my disk image has no partitions, entire disk image is a single file system).
>

If your disk file represents a single partition and in your pv config file you
have a disk entry like this one:

disk = [ 'file:/home/ruslan/fs1.img,xvda1,w' ]

then your disk is not going to work in HVM mode.
Qemu must be able to handle your disk otherwise the bootloader won't be
able to boot your kernel.


> My config is (I also tried to comment out device model but it does not help):
>
> import os, re
> arch = os.uname()[4]
> if re.search('64', arch):
>     arch_libdir = 'lib64'
> else:
>     arch_libdir = 'lib'
>

remove this part if you are using xl

> kernel = "/usr/lib/xen/boot/hvmloader"
>
> builder='hvm'
>
> vcpus=1
>
> memory = 1024
> shadow_memory = 8
> name = "xenhvm1"
> disk = [ 'file:/home/ruslan/fs1.img,xvda,w' ]

Even though xvda is currently supported it would be better to specify
hda here if you only have one disk, because you need at least an IDE
interface to boot.

> device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm'

device_model='qemu-dm' especially if you are using xl



_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xensource.com/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: HVM hypercalls

Ruslan Nikolaev-2
In reply to this post by Ruslan Nikolaev-2
I tried these configs. The same result - it does not find root device.

However, if I disable 'CONFIG_XEN_PLATFORM_PCI', everything works. I can see my disk as /dev/sda.

If CONFIG_XEN_PLATFORM_PCI is enabled (by default), virtual ATA device appears, I can see GRUB, load the kernel. But when kernel tries to mount root device, it cannot find it. There is no /dev/xvda*, no /dev/hda*, no /dev/sda*, nothing! Apparently, it's a problem with actual kernel disk driver (not configuration). I get the same result also if I specify physical device.

Also, I noted weird messages in dom0:
XENBUS: Unable to read cpu state

P.S. For HVM domain I use Ubuntu 9.04

Thanks,
Ruslan.



--- On Thu, 8/5/10, Stefano Stabellini <[hidden email]> wrote:

> From: Stefano Stabellini <[hidden email]>
> Subject: Re: [Xen-devel] HVM hypercalls
> To: "Ruslan Nikolaev" <[hidden email]>
> Cc: "[hidden email]" <[hidden email]>, "Jeremy Fitzhardinge" <[hidden email]>
> Date: Thursday, August 5, 2010, 2:31 PM
> On Wed, 4 Aug 2010, Ruslan Nikolaev
> wrote:
> > Yes, I tried this but it does not seem to work. BTW in
> paravirtualized mode it works fine, the problem is only with
> HVM.
> >
> > I tried to specify root=/dev/xvda (my disk image has
> no partitions, entire disk image is a single file system).
> >
>
> If your disk file represents a single partition and in your
> pv config file you
> have a disk entry like this one:
>
> disk = [ 'file:/home/ruslan/fs1.img,xvda1,w' ]
>
> then your disk is not going to work in HVM mode.
> Qemu must be able to handle your disk otherwise the
> bootloader won't be
> able to boot your kernel.
>
>
> > My config is (I also tried to comment out device model
> but it does not help):
> >
> > import os, re
> > arch = os.uname()[4]
> > if re.search('64', arch):
> >     arch_libdir = 'lib64'
> > else:
> >     arch_libdir = 'lib'
> >
>
> remove this part if you are using xl
>
> > kernel = "/usr/lib/xen/boot/hvmloader"
> >
> > builder='hvm'
> >
> > vcpus=1
> >
> > memory = 1024
> > shadow_memory = 8
> > name = "xenhvm1"
> > disk = [ 'file:/home/ruslan/fs1.img,xvda,w' ]
>
> Even though xvda is currently supported it would be better
> to specify
> hda here if you only have one disk, because you need at
> least an IDE
> interface to boot.
>
> > device_model = '/usr/' + arch_libdir +
> '/xen/bin/qemu-dm'
>
> device_model='qemu-dm' especially if you are using xl
>
>
>






_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xensource.com/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: HVM hypercalls

Stefano Stabellini-3
On Fri, 6 Aug 2010, Ruslan Nikolaev wrote:
> I tried these configs. The same result - it does not find root device.
>
> However, if I disable 'CONFIG_XEN_PLATFORM_PCI', everything works. I can see my disk as /dev/sda.
>
> If CONFIG_XEN_PLATFORM_PCI is enabled (by default), virtual ATA device appears, I can see GRUB, load the kernel. But when kernel tries to mount root device, it cannot find it. There is no /dev/xvda*, no /dev/hda*, no /dev/sda*, nothing! Apparently, it's a problem with actual kernel disk driver (not configuration). I get the same result also if I specify physical device.
>
> Also, I noted weird messages in dom0:
> XENBUS: Unable to read cpu state
>

The disk might appear with a name starting with xvd but different from
xvda. Do you have any xvd devices at all?

_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xensource.com/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: HVM hypercalls

veeruyours
In reply to this post by Juergen Gross-2
Hi,

I recently started working on XEN, and I am looking for ways to invoke hypercalls from HVM.
I followed your instructions and succeeded in reading MSR register.
But when i attempt to write the physical address of a 4K page from my HVM guest (2.6.30 kernel), i observed the XEN hypervisor reporting it as bad GMFN as follows.

[root@f13 ~]# xm dmesg -c
(XEN) traps.c:664:d17 Bad GMFN ffff88001e925 (MFN ffffffffffffffff) to MSR 40000000

Could you please help me in understanding what went wrong in my implementation.

I am running XEN 4.0.1 on AMD 64bit machine with svm support and the dom0 kernel running 2.6.32.39.

The
Thanks & Regards,
VSR.
Reply | Threaded
Open this post in threaded view
|

Re: HVM hypercalls

Ian Campbell-10
On Mon, 2011-05-23 at 08:48 +0100, veeruyours wrote:

> Hi,
>
> I recently started working on XEN, and I am looking for ways to invoke
> hypercalls from HVM.
> I followed your instructions and succeeded in reading MSR register.
> But when i attempt to write the physical address of a 4K page from my HVM
> guest (2.6.30 kernel), i observed the XEN hypervisor reporting it as bad
> GMFN as follows.
>
> [root@f13 ~]# xm dmesg -c
> (XEN) traps.c:664:d17 Bad GMFN ffff88001e925 (MFN ffffffffffffffff) to MSR
> 40000000

That supposed GMFN (fff88001e925) looks an awful lot like a virtual
address and not a physical one to me, unless your guest really has >4TB
of RAM assigned...

>
> Could you please help me in understanding what went wrong in my
> implementation.
>
> I am running XEN 4.0.1 on AMD 64bit machine with svm support and the dom0
> kernel running 2.6.32.39.
>
> The
> Thanks & Regards,
> VSR.
>
>
> --
> View this message in context: http://xen.1045712.n5.nabble.com/HVM-hypercalls-tp2541346p4418332.html
> Sent from the Xen - Dev mailing list archive at Nabble.com.
>
> _______________________________________________
> Xen-devel mailing list
> [hidden email]
> http://lists.xensource.com/xen-devel



_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xensource.com/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: HVM hypercalls

veeruyours
Hi,

Thanks a lot for quick reply.

I modified my code to get physical page address and now i do not see error message on XEN hypervisor.
Could you please correct if am writing proper physical address or not?

We can write the page address to hypervisor using wrmsr() but who should set hypercall_page which is declared as extern in hypercall.h on HVM? Because when i try to invoke HYPERCALL_xxxx(), it reported hypercall_page not declared. Do we need to enable CONFIG_XEN in HVM kernel in order to invoke hypercalls to hypervisor?

Could you please share any sample code if you have to get a clear understanding of HVM hypercalls.

{
        char id[13];
        unsigned int msr1;
        unsigned long  my_hpage_phys;
        int my_hpage_lo, my_hpage_hi;

        __asm__ __volatile__(
                "cpuid"
                : "=b" (*(int *)(&id[0])),
                  "=d" (*(int *)(&id[8])),
                  "=c" (*(int *)(&id[4]))
                : "a" (0x40000000)
        );
        id[12]='\0';
        printk("CPU ID read- %s\n", id);

        /* Read MSR register */
        __asm__ __volatile__(
                "cpuid"
                : "=b" (*(int *)(&msr1))
                : "a" (0x40000002)
        );

        my_hpage_phys = __get_free_page(GFP_ATOMIC);
        hypercall_page = virt_to_phys(my_hpage_phys);
        printk("my_hpage_phys get_free = %lx\n", my_hpage_phys);
        printk("hypercal_page = %p\n", hypercall_page);

        my_hpage_lo = (unsigned long)hypercall_page & 0xffffffff;
        my_hpage_hi = (unsigned long)hypercall_page >> 32;
        printk("my_hpage lo = %x hi = %x\n", my_hpage_lo, my_hpage_hi);
        /* Write hypercall page address to MSR */
        wrmsr(msr1, my_hpage_lo, my_hpage_hi);

        return 0;
}

================= output on HVM ==========
[root@localhost src]# dmesg
my_hypercall_page @ ffffffffa0388000
CPU ID read- XenVMMXenVMM
my_hpage_phys get_free = ffff880005c0b000
hypercal_page = 0000000005c0b000
my_hpage lo = 5c0b000 hi = 0
============================

Thanks & Regards,
VSR.

On Mon, May 23, 2011 at 1:52 PM, Ian Campbell <[hidden email]> wrote:
On Mon, 2011-05-23 at 08:48 +0100, veeruyours wrote:
> Hi,
>
> I recently started working on XEN, and I am looking for ways to invoke
> hypercalls from HVM.
> I followed your instructions and succeeded in reading MSR register.
> But when i attempt to write the physical address of a 4K page from my HVM
> guest (2.6.30 kernel), i observed the XEN hypervisor reporting it as bad
> GMFN as follows.
>
> [root@f13 ~]# xm dmesg -c
> (XEN) traps.c:664:d17 Bad GMFN ffff88001e925 (MFN ffffffffffffffff) to MSR
> 40000000

That supposed GMFN (fff88001e925) looks an awful lot like a virtual
address and not a physical one to me, unless your guest really has >4TB
of RAM assigned...

>
> Could you please help me in understanding what went wrong in my
> implementation.
>
> I am running XEN 4.0.1 on AMD 64bit machine with svm support and the dom0
> kernel running 2.6.32.39.
>
> The
> Thanks & Regards,
> VSR.
>
>
> --
> View this message in context: http://xen.1045712.n5.nabble.com/HVM-hypercalls-tp2541346p4418332.html
> Sent from the Xen - Dev mailing list archive at Nabble.com.
>
> _______________________________________________
> Xen-devel mailing list
> [hidden email]
> http://lists.xensource.com/xen-devel




_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xensource.com/xen-devel
Reply | Threaded
Open this post in threaded view
|

Re: HVM hypercalls

Ian Campbell-12
On Mon, 2011-05-23 at 14:52 +0100, veerasena reddy wrote:

> Hi,
>
> Thanks a lot for quick reply.
>
> I modified my code to get physical page address and now i do not see
> error message on XEN hypervisor.
> Could you please correct if am writing proper physical address or not?
>
> We can write the page address to hypervisor using wrmsr() but who
> should set hypercall_page which is declared as extern in hypercall.h
> on HVM? Because when i try to invoke HYPERCALL_xxxx(), it reported
> hypercall_page not declared. Do we need to enable CONFIG_XEN in HVM
> kernel in order to invoke hypercalls to hypervisor?

Which kernel are you running with?

This should all be taken care of for you in a kernel with PVHVM support
enabled.

> Could you please share any sample code if you have to get a clear
> understanding of HVM hypercalls.
>
> {
>         char id[13];
>         unsigned int msr1;
>         unsigned long  my_hpage_phys;
>         int my_hpage_lo, my_hpage_hi;
>
>         __asm__ __volatile__(
>                 "cpuid"
>                 : "=b" (*(int *)(&id[0])),
>                   "=d" (*(int *)(&id[8])),
>                   "=c" (*(int *)(&id[4]))
>                 : "a" (0x40000000)
>         );
>         id[12]='\0';
>         printk("CPU ID read- %s\n", id);
>
>         /* Read MSR register */
>         __asm__ __volatile__(
>                 "cpuid"
>                 : "=b" (*(int *)(&msr1))
>                 : "a" (0x40000002)
>         );
>
>         my_hpage_phys = __get_free_page(GFP_ATOMIC);
>         hypercall_page = virt_to_phys(my_hpage_phys);
>         printk("my_hpage_phys get_free = %lx\n", my_hpage_phys);
>         printk("hypercal_page = %p\n", hypercall_page);
>
>         my_hpage_lo = (unsigned long)hypercall_page & 0xffffffff;
>         my_hpage_hi = (unsigned long)hypercall_page >> 32;
>         printk("my_hpage lo = %x hi = %x\n", my_hpage_lo,
> my_hpage_hi);
>         /* Write hypercall page address to MSR */
>         wrmsr(msr1, my_hpage_lo, my_hpage_hi);
>
>         return 0;
> }
>
> ================= output on HVM ==========
> [root@localhost src]# dmesg
> my_hypercall_page @ ffffffffa0388000
> CPU ID read- XenVMMXenVMM
> my_hpage_phys get_free = ffff880005c0b000
> hypercal_page = 0000000005c0b000
> my_hpage lo = 5c0b000 hi = 0
> ============================
>
> Thanks & Regards,
> VSR.
>
> On Mon, May 23, 2011 at 1:52 PM, Ian Campbell
> <[hidden email]> wrote:
>         On Mon, 2011-05-23 at 08:48 +0100, veeruyours wrote:
>         > Hi,
>         >
>         > I recently started working on XEN, and I am looking for ways
>         to invoke
>         > hypercalls from HVM.
>         > I followed your instructions and succeeded in reading MSR
>         register.
>         > But when i attempt to write the physical address of a 4K
>         page from my HVM
>         > guest (2.6.30 kernel), i observed the XEN hypervisor
>         reporting it as bad
>         > GMFN as follows.
>         >
>         > [root@f13 ~]# xm dmesg -c
>         > (XEN) traps.c:664:d17 Bad GMFN ffff88001e925 (MFN
>         ffffffffffffffff) to MSR
>         > 40000000
>        
>        
>         That supposed GMFN (fff88001e925) looks an awful lot like a
>         virtual
>         address and not a physical one to me, unless your guest really
>         has >4TB
>         of RAM assigned...
>        
>        
>         >
>         > Could you please help me in understanding what went wrong in
>         my
>         > implementation.
>         >
>         > I am running XEN 4.0.1 on AMD 64bit machine with svm support
>         and the dom0
>         > kernel running 2.6.32.39.
>         >
>         > The
>         > Thanks & Regards,
>         > VSR.
>         >
>         >
>         > --
>         > View this message in context:
>         http://xen.1045712.n5.nabble.com/HVM-hypercalls-tp2541346p4418332.html
>         > Sent from the Xen - Dev mailing list archive at Nabble.com.
>         >
>         > _______________________________________________
>         > Xen-devel mailing list
>         > [hidden email]
>         > http://lists.xensource.com/xen-devel
>        
>        
>        
>



_______________________________________________
Xen-devel mailing list
[hidden email]
http://lists.xensource.com/xen-devel
12