From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Ray Bryant" Subject: xenoprof passive profiling and "mode" setting Date: Wed, 5 Jul 2006 13:27:58 -0500 Message-ID: <200607051327.58586.raybry@mpdtxmail.amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Yang@mpdtxmail.amd.com, Xiaowei Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Xiaowei, I'm puzzled by the following bit of code in p4_check_ctrs(): =A0 =A0 =A0 =A0if (guest_kernel_mode(current, regs)) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 mode =3D 1; =A0 =A0 =A0 =A0 else if (ring_0(regs)) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 mode =3D 2; If I look at the definition for guest_kernel_mode() it is: include/asm-x86/x86_64/regs.h: #define guest_kernel_mode(v, r) =A0 \ =A0 =A0 (ring_3(r) && ((v)->arch.flags & TF_kernel_mode)) (Note well: =A0I am running a 64 bit guest and a 64 bit host.) So, how is that possibly true for the kernel in an HVM guest? (Wouldn't guest_kernel_mode(regs) be false in that case since it is not=20 running ring_3()?) Also, wouldn't ring_0(regs) be true if we are running in kernel mode in an = HVM=20 guest? =A0 =A0This code appears to assign such a sample to being part of xe= n,=20 right? So I'm unsure as to whether the above snippet of code sets the mode correct= ly. =2D-=20 Ray Bryant AMD Performance Labs Austin, Tx 512-602-0038 (o) 512-507-7807 (c)