summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Mustacchi <rm@joyent.com>2011-08-04 00:35:14 +0000
committerRobert Mustacchi <rm@joyent.com>2011-08-04 22:56:48 +0000
commit6b4805585ee5fd1eca7ab4285895d41d996aedd7 (patch)
tree652ed46b9217792157e890d95f46e2a3beb200be
parent1d7fe23bfbd982f912c1c679f844b32e4ca692f6 (diff)
downloadillumos-kvm-6b4805585ee5fd1eca7ab4285895d41d996aedd7.tar.gz
HVM-554 vm and vcpu kstats should contain a zonename field
-rw-r--r--kvm.c4
-rw-r--r--kvm_impl.h2
-rw-r--r--kvm_x86.c4
3 files changed, 10 insertions, 0 deletions
diff --git a/kvm.c b/kvm.c
index 7459218..e4d5c24 100644
--- a/kvm.c
+++ b/kvm.c
@@ -703,6 +703,8 @@ kvm_create_vm(void)
}
kvmp->kvm_kstat->ks_data = &kvmp->kvm_stats;
+ kvmp->kvm_kstat->ks_data_size +=
+ strlen(curproc->p_zone->zone_name) + 1;
KVM_KSTAT_INIT(kvmp, kvmks_pid, "pid");
kvmp->kvm_stats.kvmks_pid.value.ui64 = kvmp->kvm_pid = curproc->p_pid;
@@ -716,6 +718,8 @@ kvm_create_vm(void)
KVM_KSTAT_INIT(kvmp, kvmks_remote_tlb_flush, "remote-tlb-flush");
KVM_KSTAT_INIT(kvmp, kvmks_lpages, "lpages");
KVM_KSTAT_INIT(kvmp, kvmks_mmu_unsync_page, "mmu-unsync-page");
+ kstat_named_init(&(kvmp->kvm_stats.kvmks_zonename), "zonename", KSTAT_DATA_STRING);
+ kstat_named_setstr(&(kvmp->kvm_stats.kvmks_zonename), curproc->p_zone->zone_name);
kstat_install(kvmp->kvm_kstat);
diff --git a/kvm_impl.h b/kvm_impl.h
index f54f8f8..931c876 100644
--- a/kvm_impl.h
+++ b/kvm_impl.h
@@ -59,6 +59,7 @@ typedef struct kvm_vcpu_stats {
kstat_named_t kvmvs_pf_guest; /* injected guest pagefaults */
kstat_named_t kvmvs_pf_fixed; /* fixed pagefaults */
kstat_named_t kvmvs_hypercalls; /* hypercalls (VMCALL instrn) */
+ kstat_named_t kvmvs_zonename; /* vcpu zone name */
} kvm_vcpu_stats_t;
#define KVM_VCPU_KSTAT_INIT(vcpu, field, name) \
@@ -78,6 +79,7 @@ typedef struct kvm_stats {
kstat_named_t kvmks_remote_tlb_flush; /* remote TLB flushes */
kstat_named_t kvmks_lpages; /* large pages in use */
kstat_named_t kvmks_mmu_unsync_page; /* number of unsynced pages */
+ kstat_named_t kvmks_zonename; /* zone this is running in */
} kvm_stats_t;
#define KVM_KSTAT_INIT(kvmp, field, name) \
diff --git a/kvm_x86.c b/kvm_x86.c
index abf376b..c656b96 100644
--- a/kvm_x86.c
+++ b/kvm_x86.c
@@ -4685,6 +4685,8 @@ kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
vcpu->kvcpu_kstat = kstat;
vcpu->kvcpu_kstat->ks_data = &vcpu->kvcpu_stats;
+ vcpu->kvcpu_kstat->ks_data_size +=
+ strlen(curproc->p_zone->zone_name) + 1;
KVM_VCPU_KSTAT_INIT(vcpu, kvmvs_id, "id");
vcpu->kvcpu_stats.kvmvs_id.value.ui64 = kvm->kvmid;
@@ -4713,6 +4715,8 @@ kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
KVM_VCPU_KSTAT_INIT(vcpu, kvmvs_pf_guest, "pf-guest");
KVM_VCPU_KSTAT_INIT(vcpu, kvmvs_pf_fixed, "pf-fixed");
KVM_VCPU_KSTAT_INIT(vcpu, kvmvs_hypercalls, "hypercalls");
+ kstat_named_init(&(vcpu->kvcpu_stats.kvmvs_zonename), "zonename", KSTAT_DATA_STRING);
+ kstat_named_setstr(&(vcpu->kvcpu_stats.kvmvs_zonename), curproc->p_zone->zone_name);
kstat_install(vcpu->kvcpu_kstat);