* Problems calling HVMOP_flush_tlbs
@ 2012-01-17 0:50 Antony Saba
2012-01-17 11:08 ` Tim Deegan
0 siblings, 1 reply; 3+ messages in thread
From: Antony Saba @ 2012-01-17 0:50 UTC (permalink / raw)
To: xen-devel@lists.xen.org
Hello xen-devel,
I am using xen 4.2.1 and have tried the following with kernel 3.0.0 and
3.2.1.
I am trying to invoke the HVMOP_flush_tlbs hypercall but have been
unsuccessful. I am basing my call on the functions in in xc_misc.c,
trying to guess what is meant by "@arg must be null" in the comment
where HVMOP_flush_tlbs is defined. What is the correct way to invoke
this hypercall?
If I call it like this, I receive an invalid parameter (EINVAL) error:
struct privcmd_hypercall
{
uint64_t op;
uint64_t arg[5];
} hypercall;
hypercall.op = __HYPERVISOR_hvm_op;
hypercall.arg[0] = HVMOP_flush_tlbs;
hypercall.arg[1] = 0;
ret = do_xen_hypercall(xch, (void*)&hypercall);
If I call it like this, I get function not implemented (ENOSYS), where 3
is a valid domain id:
hypercall.op = __HYPERVISOR_hvm_op;
hypercall.arg[0] = HVMOP_flush_tlbs;
hypercall.arg[1] = 3; /* 3 is the domain whose tlbs should be
flushed */
hypercall.arg[2] = 0;
I have also tried this, mimicking the arg struct for the other HVMOP
calls, which also returns ENOSYS:
typedef struct _arg_t {
domid_t domid;
uint64_t ptr;
} arg_t;
struct privcmd_hypercall {
uint64_t op;
uint64_t arg[5];
} hypercall;
DECLARE_HYPERCALL_BUFFER(arg_t, arg);
arg = xc_hypercall_buffer_alloc(xch, arg, sizeof(*arg));
hypercall.op = __HYPERVISOR_hvm_op;
hypercall.arg[0] = HVMOP_flush_tlbs;
hypercall.arg[1] = HYPERCALL_BUFFER_AS_ARG(arg);
hypercall.arg[2]= 0;
arg->ptr = 0;
arg->domid = 0; /* or a valid dom id, the results are the same */
Any help is appreciated.
-Tony
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Problems calling HVMOP_flush_tlbs
2012-01-17 0:50 Problems calling HVMOP_flush_tlbs Antony Saba
@ 2012-01-17 11:08 ` Tim Deegan
2012-01-17 12:52 ` Antony Saba
0 siblings, 1 reply; 3+ messages in thread
From: Tim Deegan @ 2012-01-17 11:08 UTC (permalink / raw)
To: Antony Saba; +Cc: xen-devel@lists.xen.org
Hi,
At 00:50 +0000 on 17 Jan (1326761401), Antony Saba wrote:
> Hello xen-devel,
>
> I am using xen 4.2.1 and have tried the following with kernel 3.0.0 and
> 3.2.1.
>
> I am trying to invoke the HVMOP_flush_tlbs hypercall but have been
> unsuccessful. I am basing my call on the functions in in xc_misc.c,
> trying to guess what is meant by "@arg must be null" in the comment
> where HVMOP_flush_tlbs is defined. What is the correct way to invoke
> this hypercall?
>
> If I call it like this, I receive an invalid parameter (EINVAL) error:
> struct privcmd_hypercall
> {
> uint64_t op;
> uint64_t arg[5];
> } hypercall;
> hypercall.op = __HYPERVISOR_hvm_op;
> hypercall.arg[0] = HVMOP_flush_tlbs;
> hypercall.arg[1] = 0;
> ret = do_xen_hypercall(xch, (void*)&hypercall);
>
>
> If I call it like this, I get function not implemented (ENOSYS), where 3
> is a valid domain id:
> hypercall.op = __HYPERVISOR_hvm_op;
> hypercall.arg[0] = HVMOP_flush_tlbs;
> hypercall.arg[1] = 3; /* 3 is the domain whose tlbs should be
> flushed */
> hypercall.arg[2] = 0;
Did you look at the code of Xen? A quick grep finds this:
case HVMOP_flush_tlbs:
rc = guest_handle_is_null(arg) ? hvmop_flush_tlb_all() : -ENOSYS;
break;
So that's what "@arg must ne null" means: if you provide an argument,
you get ENOSYS. And just inside hvmop_flush_tlb_all() is this:
if ( !is_hvm_domain(d) )
return -EINVAL;
So if you call from a non-HVM domain, you get EINVAL. That matches what
you're seeing.
I think the important detail is that HVMOP_flush_tlbs doesn't take a target
domain - it always flushes the _caller's_ TLBs. I guess you want to
flush the TLBs of another domain for some reason? AFAICS the version in
mainline Xen has never taken an argument so perhaps you could add one
(making sure to keep backward compatibility, of course).
Cheers,
Tim.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Problems calling HVMOP_flush_tlbs
2012-01-17 11:08 ` Tim Deegan
@ 2012-01-17 12:52 ` Antony Saba
0 siblings, 0 replies; 3+ messages in thread
From: Antony Saba @ 2012-01-17 12:52 UTC (permalink / raw)
To: Tim Deegan; +Cc: xen-devel@lists.xen.org
[-- Attachment #1.1: Type: text/plain, Size: 804 bytes --]
On 01/17/2012 04:08 AM, Tim Deegan wrote
I think the important detail is that HVMOP_flush_tlbs doesn't take a target
domain - it always flushes the _caller's_ TLBs. I guess you want to
flush the TLBs of another domain for some reason? AFAICS the version in
mainline Xen has never taken an argument so perhaps you could add one
(making sure to keep backward compatibility, of course).
Thanks, Tim.
Yes, I am trying flush a guests TLBs from dom0. I am using mem_events, and are seeing events that are not caught all the time. The difference appears to be that the guest does a mov cr3 in the case where they are caught.
I was hoping it was a simple matter of flushing the guest TLBs somehow.
-Tony
--
Antony Saba, antony.saba@mandiant.com<mailto:antony.saba@mandiant.com>
[-- Attachment #1.2: Type: text/html, Size: 1403 bytes --]
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-01-17 12:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-17 0:50 Problems calling HVMOP_flush_tlbs Antony Saba
2012-01-17 11:08 ` Tim Deegan
2012-01-17 12:52 ` Antony Saba
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).