Skip to contentSkip to conversation

cpu steal time accounting

PATCH Tian, Kevin 2 participants 2 messages Feb 21, 2006

lore
Share & tools
lore
#0 lore raw

Why do you need to add a new VCPUOP while doing same thing as DOM0_GETVCPUINFO?

Thanks,
Kevin

Quoted 62 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Rik van Riel
Sent: 2006年2月21日 8:51
To: [email protected]
Subject: [Xen-devel] [PATCH 1/2] cpu steal time accounting

Allow guest domains to get information from the hypervisor on how much cpu time their virtual cpus have used. This is needed to estimate the cpu steal time.

include/public/vcpu.h renamed from include/public/vcpu.h.steal +8 -0
@@ -51,6 +51,14 @@
 /* Returns 1 if the given VCPU is up. */
 #define VCPUOP_is_up                3
 
+/*
+ * Get information on how much CPU time this VCPU has used, etc...
+ *
+ * @extra_arg == pointer to an empty dom0_getvcpuinfo_t, the "OUT" variables
+ *               of which filled in with scheduler info.
+ */
+#define VCPUOP_cpu_info             4
+
 #endif /* __XEN_PUBLIC_VCPU_H__ */
 
 /*
common/domain.c renamed from common/domain.c.steal +16 -0
@@ -451,8 +451,24 @@
    case VCPUOP_is_up:
        rc = !test_bit(_VCPUF_down, &v->vcpu_flags);
        break;
+
+    case VCPUOP_cpu_info:
+	{
+	    struct dom0_getvcpuinfo vi = { 0, };
+	    vi.online = !test_bit(_VCPUF_down, &v->vcpu_flags);
+	    vi.blocked = test_bit(_VCPUF_blocked, &v->vcpu_flags);
+	    vi.running  = test_bit(_VCPUF_running, &v->vcpu_flags);
+	    vi.cpu_time = v->cpu_time;
+	    vi.cpu = v->processor;
+	    rc = 0;
+
+	    if ( copy_to_user(arg, &vi, sizeof(dom0_getvcpuinfo_t)) )
+		rc = -EFAULT;
+	    break;
+	}
    }
 
+
    return rc;
 }
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 2 lines · Kevin

Why do you need to add a new VCPUOP while doing same thing as DOM0_GETVCPUINFO?

Because the dom0_ops only work for dom0 and reworking that function to allow non-privileged domains to get info just on themselves would end up being a way uglier patch.

Signature · 1 line
All Rights Reversed