From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4gcq-0004tA-J6 for qemu-devel@nongnu.org; Thu, 23 Aug 2012 19:15:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T4gck-0005F8-W5 for qemu-devel@nongnu.org; Thu, 23 Aug 2012 19:15:44 -0400 Received: from e35.co.us.ibm.com ([32.97.110.153]:52849) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4gck-0005F2-PZ for qemu-devel@nongnu.org; Thu, 23 Aug 2012 19:15:38 -0400 Received: from /spool/local by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 23 Aug 2012 17:15:38 -0600 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 8D5073E4003E for ; Thu, 23 Aug 2012 17:15:30 -0600 (MDT) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q7NNFRQZ164020 for ; Thu, 23 Aug 2012 17:15:29 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q7NNFRhX028618 for ; Thu, 23 Aug 2012 17:15:27 -0600 From: Michael Wolf Date: Thu, 23 Aug 2012 18:15:25 -0500 Message-ID: <20120823231525.11904.25704.stgit@lambeau> In-Reply-To: <20120823231454.11904.35222.stgit@lambeau> References: <20120823231454.11904.35222.stgit@lambeau> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH RFC 2/2] Add an ioctl to pass the entitlement information from qemu to the hypervisor. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, mtosatti@redhat.com, stefanha@linux.vnet.ibm.com, avi@redhat.com Add KVM_SET_ENTITLEMENT ioctl to pass the entitlement to the hypervisor. Signed-off-by: Michael Wolf --- cpu-defs.h | 1 + cpus.c | 1 + cpus.h | 1 + kvm-all.c | 1 + linux-headers/linux/kvm.h | 2 ++ 5 files changed, 6 insertions(+) diff --git a/cpu-defs.h b/cpu-defs.h index 4018b88..ae24e8e 100644 --- a/cpu-defs.h +++ b/cpu-defs.h @@ -200,6 +200,7 @@ typedef struct CPUWatchpoint { int numa_node; /* NUMA node this cpu is belonging to */ \ int nr_cores; /* number of cores within this CPU package */ \ int nr_threads;/* number of threads within this CPU */ \ + int cpu_entitlement; /* the % of the pcpu that the vcpu receives */ \ int running; /* Nonzero if cpu is currently running(usermode). */ \ int thread_id; \ /* user data */ \ diff --git a/cpus.c b/cpus.c index e476a3c..ef8b762 100644 --- a/cpus.c +++ b/cpus.c @@ -1042,6 +1042,7 @@ void qemu_init_vcpu(void *_env) env->nr_cores = smp_cores; env->nr_threads = smp_threads; + env->cpu_entitlement = cpu_entitlement; env->stopped = 1; if (kvm_enabled()) { qemu_kvm_start_vcpu(env); diff --git a/cpus.h b/cpus.h index 81bd817..704d6df 100644 --- a/cpus.h +++ b/cpus.h @@ -16,6 +16,7 @@ void qtest_clock_warp(int64_t dest); /* vl.c */ extern int smp_cores; extern int smp_threads; +extern int cpu_entitlement; void set_numa_modes(void); void set_cpu_log(const char *optarg); void set_cpu_log_filename(const char *optarg); diff --git a/kvm-all.c b/kvm-all.c index 34b02c1..dee1b9b 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -246,6 +246,7 @@ int kvm_init_vcpu(CPUArchState *env) s->coalesced_mmio_ring = (void *)env->kvm_run + s->coalesced_mmio * PAGE_SIZE; } + kvm_vm_ioctl(s, KVM_SET_ENTITLEMENT, env->cpu_entitlement); ret = kvm_arch_init_vcpu(env); if (ret == 0) { diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h index 5a9d4e3..46dbde5 100644 --- a/linux-headers/linux/kvm.h +++ b/linux-headers/linux/kvm.h @@ -901,6 +901,8 @@ struct kvm_s390_ucas_mapping { #define KVM_SET_ONE_REG _IOW(KVMIO, 0xac, struct kvm_one_reg) /* VM is being stopped by host */ #define KVM_KVMCLOCK_CTRL _IO(KVMIO, 0xad) +/* Set the cpu entitlement this will be used to adjust stealtime reporting */ +#define KVM_SET_ENTITLEMENT _IOW(KVMIO, 0xae, unsigned long) #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) #define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1)