WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: "Ray Bryant" <raybry@xxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] xenoprof passive profiling and "mode" setting
From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Date: Wed, 5 Jul 2006 22:56:18 +0100
Cc: Xiaowei <xiaowei.yang@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx, Yang@xxxxxxxxxxxxxxxxx
Delivery-date: Wed, 05 Jul 2006 15:03:21 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <200607051327.58586.raybry@xxxxxxxxxxxxxxxxx>
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>
References: <200607051327.58586.raybry@xxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx

On 5 Jul 2006, at 19:27, Ray Bryant wrote:

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()?)

guest_kernel_mode() does not work for HVM guests. It may need to be fixed -- it had previously only been used in paravirtual-only contexts.

It might make sense to invert[*] the predicate and rename to user_mode(). Then definition is simply ring_3(regs) for x86/32 and (ring_3(regs) && !((v)->arch.flags & TF_kernel_mode)) for x86/64.

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,
right?

ring_0(regs) should be replaced by !guest_mode(regs).

So maybe:
  int mode = 2;
  if (guest_mode(regs))
      mode = user_mode(current, regs) ? 0 : 1;

 -- Keir

[*] Not really inversion, as neither guest_kernel_mode() nor user_mode() are true for hypervisor mode.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel