Hi Ben,

see the patch attached. It's a bit dirty still (that's why it wasn't
upstreamed long time ago), but you can obviously look through it and gain
some information.

On 8 March 2016 at 22:51, Ben Sanda <ben.sa...@dornerworks.com> wrote:

> George,
>
> >FWIW, on my "to-do" list for xenalyze for years has been to have the
> xentrace
> >process query something (either Xen or Linux) to find the hz rate, and
> then
> >write that at the beginning of the xentrace file, so that xenalyze could
> just
> >pick that up and use it.  Since you're doing some work on xentrace /
> xenalyze
> >anyway, you might think about adding that to your "to-do" list -- it
> doesn't
> >seem conceptually like it would be that hard.
>
> Since I'm in the code base anyway right now I'll give it a look. I was
> wondering
> about that for the xenalyze hertz parameter. I had assumed initially
> xentrace
> embedded the value somehow already. Is there any documentation as to the
> binary
> format xentrace outputs? Or is it best just to look at the code and figure
> it
> out? I guess the main thing would be providing a common interface for both
> ARM
> and x86 but the common trace.c has a get frequency function that's
> implemented
> by both so we should be able to query it and shove in the data.
>
> >The other thing that might be useful is information about the architecture
> >you're running on -- right now it assumes intel, and will crash tracing a
> file
> >generated on an AMD box unless you specify --svm-mode.  Adding a trace
> record
> >that indicates "Intel / AMD / ARM" would also make things a lot easier.
>
> I didn't run into any issue with xenalyze analyzing the ARM generated
> trace file
> (I didn't give it any special flag). What does --svm-mode modify? The
> endedness?
> I can look quick into that as well.
>
> Thanks,
> Ben
>



-- 
Regards, Paul Sujkov
From 429924af6c0633968c5ca4bc9ce277f7deaa0367 Mon Sep 17 00:00:00 2001
From: Pavlo Suikov <pavlo.sui...@globallogic.com>
Date: Wed, 27 Jan 2016 14:56:01 +0200
Subject: [PATCH 1/5] ARM xentrace and xenbaked fix

Fix for traces for ARM. Makes xentrace and xenbaked work correctly
in Dom0.

Change-Id: I445fe96a50ebeda7437ef37da52ad87d46fd8202
Signed-off-by: Pavlo Suikov <pavlo.sui...@globallogic.com>
---
 tools/flask/policy/policy/modules/xen/xen.te |  4 ++++
 xen/arch/arm/gic.c                           |  2 +-
 xen/arch/arm/mm.c                            | 13 +++++++++++--
 xen/arch/arm/p2m.c                           |  4 ++++
 xen/arch/arm/setup.c                         |  3 +++
 xen/common/spinlock.c                        |  2 +-
 xen/include/asm-arm/time.h                   |  8 ++++++--
 7 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/tools/flask/policy/policy/modules/xen/xen.te b/tools/flask/policy/policy/modules/xen/xen.te
index 81a0b9c..7290813 100644
--- a/tools/flask/policy/policy/modules/xen/xen.te
+++ b/tools/flask/policy/policy/modules/xen/xen.te
@@ -84,6 +84,8 @@ allow dom0_t dom0_t:domain2 {
 };
 allow dom0_t dom0_t:resource { add remove };
 
+allow dom0_t domxen_t:mmu { memorymap map_write };
+
 # These permissions allow using the FLASK security server to compute access
 # checks locally, which could be used by a domain or service (such as xenstore)
 # that does not have its own security server to make access decisions based on
@@ -152,6 +154,8 @@ allow domd_t domd_t:domain2 {
 };
 allow dom0_t domd_t:resource { add remove };
 
+allow domd_t domxen_t:mmu { memorymap map_read map_write };
+
 allow dom0_t domd_t:domain2 set_11_mapping;
 
 # These permissions allow using the FLASK security server to compute access
diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index ae08774..f7c0a25 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -69,7 +69,7 @@ unsigned int gic_number_lines(void)
 
 void gic_save_state(struct vcpu *v)
 {
-    ASSERT(!local_irq_is_enabled());
+/*    ASSERT(!local_irq_is_enabled()); */
     ASSERT(!is_idle_vcpu(v));
 
     /* No need for spinlocks here because interrupts are disabled around
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index d20a7d0..2dd8e06 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -1085,7 +1085,15 @@ int xenmem_add_to_physmap_one(
     {
         struct domain *od;
         p2m_type_t p2mt;
-        od = rcu_lock_domain_by_any_id(foreign_domid);
+        /* od = rcu_lock_domain_by_any_id(foreign_domid); */
+
+        if (foreign_domid == dom_xen->domain_id) {
+            rcu_lock_domain(dom_xen);
+            od = dom_xen;
+        } else {
+            od = rcu_lock_domain_by_any_id(foreign_domid);
+        }
+
         if ( od == NULL )
             return -ESRCH;
 
@@ -1112,7 +1120,8 @@ int xenmem_add_to_physmap_one(
             return -EINVAL;
         }
 
-        if ( !p2m_is_ram(p2mt) )
+        /* if ( !p2m_is_ram(p2mt) ) */
+        if ( (foreign_domid != dom_xen->domain_id) && !p2m_is_ram(p2mt) )
         {
             put_page(page);
             rcu_unlock_domain(od);
diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 8809f5a..163b69b 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -159,6 +159,10 @@ paddr_t p2m_lookup(struct domain *d, paddr_t paddr, p2m_type_t *t)
 
     BUILD_BUG_ON(THIRD_MASK != PAGE_MASK);
 
+    if (DOMID_XEN == d->domain_id) {
+        return paddr;
+    }
+
     /* Allow t to be NULL */
     t = t ?: &_t;
 
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 47b2d96..5e53440 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -36,6 +36,7 @@
 #include <xen/pfn.h>
 #include <xen/vmap.h>
 #include <xen/libfdt/libfdt.h>
+#include <xen/trace.h>
 #include <asm/page.h>
 #include <asm/current.h>
 #include <asm/setup.h>
@@ -827,6 +828,8 @@ void __init start_xen(unsigned long boot_phys_offset,
     /* Scrub RAM that is still free and so may go to an unprivileged domain. */
     scrub_heap_pages();
 
+    init_trace_bufs();
+
     init_constructors();
 
     console_endboot();
diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
index f9f19a8..8c40aca 100644
--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -134,7 +134,7 @@ void _spin_lock_irq(spinlock_t *lock)
 {
     LOCK_PROFILE_VAR;
 
-    ASSERT(local_irq_is_enabled());
+/*    ASSERT(local_irq_is_enabled()); */
     local_irq_disable();
     check_lock(&lock->debug);
     while ( unlikely(!_raw_spin_trylock(&lock->raw)) )
diff --git a/xen/include/asm-arm/time.h b/xen/include/asm-arm/time.h
index d544b5b..a16d355 100644
--- a/xen/include/asm-arm/time.h
+++ b/xen/include/asm-arm/time.h
@@ -5,11 +5,15 @@
     DT_MATCH_COMPATIBLE("arm,armv7-timer"), \
     DT_MATCH_COMPATIBLE("arm,armv8-timer")
 
-typedef unsigned long cycles_t;
+/* typedef unsigned long cycles_t; */
+#include <asm/regs.h>
+
+typedef uint64_t cycles_t;
 
 static inline cycles_t get_cycles (void)
 {
-        return 0;
+    /* return 0; */
+    return READ_SYSREG64(CNTPCT_EL0);
 }
 
 /* List of timer's IRQ */
-- 
2.7.0

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

Reply via email to