From 3a9eeaa765cdfd3940dbf4b881957c057c6d6576 Mon Sep 17 00:00:00 2001 From: neel Date: Mon, 11 Feb 2013 20:36:07 +0000 Subject: Implement guest vcpu pinning using 'pthread_setaffinity_np(3)'. Prior to this change pinning was implemented via an ioctl (VM_SET_PINNING) that called 'sched_bind()' on behalf of the user thread. The ULE implementation of 'sched_bind()' bumps up 'td_pinned' which in turn runs afoul of the assertion '(td_pinned == 0)' in userret(). Using the cpuset affinity to implement pinning of the vcpu threads works with both 4BSD and ULE schedulers and has the happy side-effect of getting rid of a bunch of code in vmm.ko. Discussed with: grehan --- lib/libvmmapi/vmmapi.c | 28 ---------------------------- lib/libvmmapi/vmmapi.h | 2 -- 2 files changed, 30 deletions(-) (limited to 'lib/libvmmapi') diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c index cfb42d0..6a368b3 100644 --- a/lib/libvmmapi/vmmapi.c +++ b/lib/libvmmapi/vmmapi.c @@ -250,34 +250,6 @@ vm_get_register(struct vmctx *ctx, int vcpu, int reg, uint64_t *ret_val) } int -vm_get_pinning(struct vmctx *ctx, int vcpu, int *host_cpuid) -{ - int error; - struct vm_pin vmpin; - - bzero(&vmpin, sizeof(vmpin)); - vmpin.vm_cpuid = vcpu; - - error = ioctl(ctx->fd, VM_GET_PINNING, &vmpin); - *host_cpuid = vmpin.host_cpuid; - return (error); -} - -int -vm_set_pinning(struct vmctx *ctx, int vcpu, int host_cpuid) -{ - int error; - struct vm_pin vmpin; - - bzero(&vmpin, sizeof(vmpin)); - vmpin.vm_cpuid = vcpu; - vmpin.host_cpuid = host_cpuid; - - error = ioctl(ctx->fd, VM_SET_PINNING, &vmpin); - return (error); -} - -int vm_run(struct vmctx *ctx, int vcpu, uint64_t rip, struct vm_exit *vmexit) { int error; diff --git a/lib/libvmmapi/vmmapi.h b/lib/libvmmapi/vmmapi.h index de04252..e8cc8ba 100644 --- a/lib/libvmmapi/vmmapi.h +++ b/lib/libvmmapi/vmmapi.h @@ -56,8 +56,6 @@ int vm_get_desc(struct vmctx *ctx, int vcpu, int reg, uint64_t *base, uint32_t *limit, uint32_t *access); int vm_set_register(struct vmctx *ctx, int vcpu, int reg, uint64_t val); int vm_get_register(struct vmctx *ctx, int vcpu, int reg, uint64_t *retval); -int vm_get_pinning(struct vmctx *ctx, int vcpu, int *host_cpuid); -int vm_set_pinning(struct vmctx *ctx, int vcpu, int host_cpuid); int vm_run(struct vmctx *ctx, int vcpu, uint64_t rip, struct vm_exit *ret_vmexit); int vm_apicid2vcpu(struct vmctx *ctx, int apicid); -- cgit v1.1