[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] HVMOP_altp2m_vcpu_enable_notify code example usage



The problem is in hypervisor checking definitely. I deeper debugged the code, I met vmcall instruction execution. This means EFAULT is coming from hypervisor.

Best Regards,
Rockosov Dmitry

2016-08-22 18:09 GMT+03:00 Dmitry Rockosov <rockosov@xxxxxxxxx>:
Hello Tamas,

Thank you for the answer!

I installed the same xen source code (4.7.0) as on dom0 to domU, built dist-tools, installed xen-tools, updated rc.d configuration and rebooted.
IOCTL channel to privcmd driver is working fine, but all requests to hypervisor like hvm_get_param, translate_foreign_address, altp2m_vcpu_enable_notify return EFAULT errno (Bad access).

Just for experiment I wrote below code in usermode:
===================================
...
rc = xc_hvm_param_get(xch, DOMID_SELF, HVM_PARAM_CONSOLE_PFN, &value);
if (rc < 0) {
    PERROR("Fail to get CONSOLE PFN HVM PARAM\n");
    goto exit;
}
DPRINTF("CONSOLE PFN == %llx", (unsigned long long)value);
...
===================================

and below code in kernelmode:
===================================
...
printk(KERN_INFO "We are in Xen domain HVM = %d\n", xen_hvm_domain());
err = hvm_get_parameter(HVM_PARAM_CONSOLE_PFN, &value);
printk(KERN_INFO "err = %d\n", err);
printk(KERN_INFO "CONSOLE PFN = %llx\n", value);
...
===================================

In the usermode I got an error:
===================================
Fail to get CONSOLE PFN HVM PARAM
: Bad address
===================================

In the kernelmode code executed fine:
===================================
[23261.230188] We are in Xen domain HVM = 1
[23261.307840] err = 0
[23261.352587] CONSOLE PFN = fefff
===================================

Looks like usermode wrappers don't support many requests to hypervisor, right?

Best Regards,
Rockosov Dmitry

2016-08-21 20:27 GMT+03:00 Tamas K Lengyel <tamas.k.lengyel@xxxxxxxxx>:
Hi Dmitry,
as long as you are testing with a HVM Linux guest you should be able
to just compile the Xen tools in the guest and then use libxc from
within the guest to issue that hypercall via
xc_altp2m_set_vcpu_enable_notify. You will need to load a couple Xen
related kernel-modules for it to work (like xen-privcmd). Let us know
if you got it working!

Cheers,
Tamas

On Fri, Aug 19, 2016 at 1:19 PM, Dmitry Rockosov <rockosov@xxxxxxxxx> wrote:
> Hello Xen Team!
>
> Does anybody have any code examples of HVMOP_altp2m_vcpu_enable_notify?
>
> I want to fully test #VE, VMFUNC and EPTP Switching VM Function 0 in Xen,
> but doesn't have any documentations/examples for it.
> I tried xen-access test from tools/tests/xen-access, but looks like it
> doesn't use VMFUNC and #VE, it simply changes VMCS entries with vmwrite, w/o
> VMFUNC 0 (EPTP Switching).
>
> Thanks in advance!
>
> Best Regards,
> Rockosov Dmitry
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> https://lists.xen.org/xen-devel
>


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.