From: "Tian, Kevin" Subject: RE: [PATCH 1/2] cpu steal time accounting Date: Tue, 21 Feb 2006 17:05:43 +0800 Message-ID: <571ACEFD467F7749BC50E0A98C17CDD802C06D26@pdsmsx403> Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Return-path: Content-class: urn:content-classes:message List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Rik van Riel , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Why do you need to add a new VCPUOP while doing same thing as = DOM0_GETVCPUINFO? Thanks, Kevin >-----Original Message----- >From: xen-devel-bounces@lists.xensource.com >[mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Rik van = Riel >Sent: 2006=C4=EA2=D4=C221=C8=D5 8:51 >To: xen-devel@lists.xensource.com >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. > >Signed-off-by: Rik van Riel > >--- xen/include/public/vcpu.h.steal 2006-02-07 18:01:41.000000000 -0500 >+++ xen/include/public/vcpu.h 2006-02-17 13:51:45.000000000 -0500 >@@ -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 =3D=3D 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__ */ > > /* >--- xen/common/domain.c.steal 2006-02-07 18:01:40.000000000 -0500 >+++ xen/common/domain.c 2006-02-17 13:52:44.000000000 -0500 >@@ -451,8 +451,24 @@ > case VCPUOP_is_up: > rc =3D !test_bit(_VCPUF_down, &v->vcpu_flags); > break; >+ >+ case VCPUOP_cpu_info: >+ { >+ struct dom0_getvcpuinfo vi =3D { 0, }; >+ vi.online =3D !test_bit(_VCPUF_down, &v->vcpu_flags); >+ vi.blocked =3D test_bit(_VCPUF_blocked, &v->vcpu_flags); >+ vi.running =3D test_bit(_VCPUF_running, &v->vcpu_flags); >+ vi.cpu_time =3D v->cpu_time; >+ vi.cpu =3D v->processor; >+ rc =3D 0; >+ >+ if ( copy_to_user(arg, &vi, sizeof(dom0_getvcpuinfo_t)) ) >+ rc =3D -EFAULT; >+ break; >+ } > } > >+ > return rc; > } > > >_______________________________________________ >Xen-devel mailing list >Xen-devel@lists.xensource.com >http://lists.xensource.com/xen-devel