qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Wolf <mjw@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, mtosatti@redhat.com,
	stefanha@linux.vnet.ibm.com, avi@redhat.com
Subject: [Qemu-devel] [PATCH RFC 2/2] Add an ioctl to pass the entitlement information from qemu to the hypervisor.
Date: Thu, 23 Aug 2012 18:15:25 -0500	[thread overview]
Message-ID: <20120823231525.11904.25704.stgit@lambeau> (raw)
In-Reply-To: <20120823231454.11904.35222.stgit@lambeau>

Add KVM_SET_ENTITLEMENT ioctl to pass the entitlement to the hypervisor.

Signed-off-by: Michael Wolf <mjw@linux.vnet.ibm.com>
---
 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)

      parent reply	other threads:[~2012-08-23 23:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-23 23:15 [Qemu-devel] [PATCH RFC 0/2] Add guest cpu entitlement reporting Michael Wolf
2012-08-23 23:15 ` [Qemu-devel] [PATCH RFC 1/2] Parse the cpu entitlement from the qemu commandline Michael Wolf
2012-08-25  7:54   ` Blue Swirl
2012-08-23 23:15 ` Michael Wolf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120823231525.11904.25704.stgit@lambeau \
    --to=mjw@linux.vnet.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).