This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] xenoprof passive profiling and "mode" setting

To: Yang@xxxxxxxxxxxxxxxxx, "Xiaowei" <xiaowei.yang@xxxxxxxxx>
Subject: [Xen-devel] xenoprof passive profiling and "mode" setting
From: "Ray Bryant" <raybry@xxxxxxxxxxxxxxxxx>
Date: Wed, 5 Jul 2006 13:27:58 -0500
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 05 Jul 2006 13:53:06 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.8

I'm puzzled by the following bit of code in p4_check_ctrs():

       if (guest_kernel_mode(current, regs))
                mode = 1;
        else if (ring_0(regs))
                mode = 2;

If I look at the definition for guest_kernel_mode() it is:


#define guest_kernel_mode(v, r)   \
    (ring_3(r) && ((v)->arch.flags & TF_kernel_mode))

(Note well:  I 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 
running ring_3()?)

Also, wouldn't ring_0(regs) be true if we are running in kernel mode in an HVM 
guest?    This code appears to assign such a sample to being part of xen, 

So I'm unsure as to whether the above snippet of code sets the mode correctly.

Ray Bryant
AMD Performance Labs                   Austin, Tx
512-602-0038 (o)                 512-507-7807 (c)

Xen-devel mailing list