[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/3] trace: allow HVMOP_xentrace to set trace record subclass



On 25/07/13 14:23, David Vrabel wrote:
From: David Vrabel <david.vrabel@xxxxxxxxxx>

Allow guests adding trace records with HVMOP_xentrace to set the
sub-class.  This allows different guest generated traces to be
filtered by xentrace.

Signed-off-by: David Vrabel <david.vrabel@xxxxxxxxxx>
---
  xen/arch/x86/hvm/hvm.c     |    4 ++--
  xen/include/public/trace.h |    3 +++
  2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index e2701b6..b0d8094 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -4388,10 +4388,10 @@ long do_hvm_op(unsigned long op, 
XEN_GUEST_HANDLE_PARAM(void) arg)
              return -EFAULT;
if ( tr.extra_bytes > sizeof(tr.extra)
-             || (tr.event & ~((1u<<TRC_SUBCLS_SHIFT)-1)) )
+             || (tr.event & ~((1u<<TRC_CLS_SHIFT)-1)) )
              return -EINVAL;
- trace_var(tr.event | TRC_GUEST, 1 /*cycles*/,
+        trace_var(TRC_GUEST_EVENT(tr.event), 1 /*cycles*/,
                    tr.extra_bytes, tr.extra);
          break;
      }
diff --git a/xen/include/public/trace.h b/xen/include/public/trace.h
index e2f60a6..bbbd38b 100644
--- a/xen/include/public/trace.h
+++ b/xen/include/public/trace.h
@@ -244,6 +244,9 @@
  #define TRC_HW_IRQ_UNMAPPED_VECTOR    (TRC_HW_IRQ + 0x7)
  #define TRC_HW_IRQ_HANDLED            (TRC_HW_IRQ + 0x8)
+/* Guest event with guest-specified sub-class and number. */
+#define TRC_GUEST_EVENT(e) (0x08000000 | (e & 0xffff))

Minor nit -- should this be ((1u<<TRC_CLS_SHIFT)-1)?

Alternately, would it make sense to add the following, and use it both places in this patch?

#define TRC_CLS_MASK ((1u<<TRC_CLS_SHIFT)-1)

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.