diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-01-22 10:59:03 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-01-22 10:59:03 +0000 |
commit | d6aaa9ee0f8ba5d2d8ff1187b05ed9becee0b40c (patch) | |
tree | 3b69d194167117b66f08f86321756f58703a44e7 /tools/libxc/xc_misc.c | |
parent | 379e63ed3da8f6d874d9bc5d6fa05a85afb60238 (diff) | |
download | xen-d6aaa9ee0f8ba5d2d8ff1187b05ed9becee0b40c.tar.gz xen-d6aaa9ee0f8ba5d2d8ff1187b05ed9becee0b40c.tar.bz2 xen-d6aaa9ee0f8ba5d2d8ff1187b05ed9becee0b40c.zip |
libxc: New hcall_buf_{prep,release} pre-mlock interface
Allow certain performance-critical hypercall wrappers to register data
buffers via a new interface which allows them to be 'bounced' into a
pre-mlock'ed page-sized per-thread data area. This saves the cost of
mlock/munlock on every such hypercall, which can be very expensive on
modern kernels.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'tools/libxc/xc_misc.c')
-rw-r--r-- | tools/libxc/xc_misc.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c index e237b7862d..44039b03be 100644 --- a/tools/libxc/xc_misc.c +++ b/tools/libxc/xc_misc.c @@ -175,29 +175,29 @@ int xc_hvm_set_pci_intx_level( unsigned int level) { DECLARE_HYPERCALL; - struct xen_hvm_set_pci_intx_level arg; + struct xen_hvm_set_pci_intx_level _arg, *arg = &_arg; int rc; - hypercall.op = __HYPERVISOR_hvm_op; - hypercall.arg[0] = HVMOP_set_pci_intx_level; - hypercall.arg[1] = (unsigned long)&arg; - - arg.domid = dom; - arg.domain = domain; - arg.bus = bus; - arg.device = device; - arg.intx = intx; - arg.level = level; - - if ( (rc = lock_pages(&arg, sizeof(arg))) != 0 ) + if ( (rc = hcall_buf_prep((void **)&arg, sizeof(*arg))) != 0 ) { PERROR("Could not lock memory"); return rc; } + hypercall.op = __HYPERVISOR_hvm_op; + hypercall.arg[0] = HVMOP_set_pci_intx_level; + hypercall.arg[1] = (unsigned long)arg; + + arg->domid = dom; + arg->domain = domain; + arg->bus = bus; + arg->device = device; + arg->intx = intx; + arg->level = level; + rc = do_xen_hypercall(xc_handle, &hypercall); - unlock_pages(&arg, sizeof(arg)); + hcall_buf_release((void **)&arg, sizeof(*arg)); return rc; } @@ -208,26 +208,26 @@ int xc_hvm_set_isa_irq_level( unsigned int level) { DECLARE_HYPERCALL; - struct xen_hvm_set_isa_irq_level arg; + struct xen_hvm_set_isa_irq_level _arg, *arg = &_arg; int rc; - hypercall.op = __HYPERVISOR_hvm_op; - hypercall.arg[0] = HVMOP_set_isa_irq_level; - hypercall.arg[1] = (unsigned long)&arg; - - arg.domid = dom; - arg.isa_irq = isa_irq; - arg.level = level; - - if ( (rc = lock_pages(&arg, sizeof(arg))) != 0 ) + if ( (rc = hcall_buf_prep((void **)&arg, sizeof(*arg))) != 0 ) { PERROR("Could not lock memory"); return rc; } + hypercall.op = __HYPERVISOR_hvm_op; + hypercall.arg[0] = HVMOP_set_isa_irq_level; + hypercall.arg[1] = (unsigned long)arg; + + arg->domid = dom; + arg->isa_irq = isa_irq; + arg->level = level; + rc = do_xen_hypercall(xc_handle, &hypercall); - unlock_pages(&arg, sizeof(arg)); + hcall_buf_release((void **)&arg, sizeof(*arg)); return rc; } |