Skip to contentSkip to conversation

Fix VGA logdirty related display freezes with altp2m

PATCH Superseded Razvan Cojocaru 3 participants 25 messages Oct 18, 2018 – Oct 25, 2018

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

Hello,

This series aims to prevent the display from freezing when enabling altp2m and switching to a new view (and assorted problems when resizing the display).

The first patch propagates ept.ad changes to all active altp2ms, and the second one allocates a new logdirty rangeset for each new altp2m, and propagates (under lock) changes to all p2ms.

The first patch is the same as:
[PATCH V4] x86/altp2m: propagate ept.ad changes to all active altp2ms but as it is now required for the second one to apply cleanly, it has been resent as part of this series.

[PATCH 1/2] x86/altp2m: propagate ept.ad changes to all active altp2ms [PATCH 2/2] x86/altp2m: fix display frozen when switching to a new

Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#1 lore raw

PATCH 1/2 x86/altp2m: propagate ept.ad changes to all active altp2ms

This patch is a pre-requisite for fixing the logdirty VGA issue (display freezes when switching to a new altp2m view early in a domain's lifetime), but sent separately for easier review. The new ept_set_ad_sync() function has been added to update all active altp2ms' ept.ad. New altp2ms will inherit the hostp2m's ept.ad value.

---
 xen/arch/x86/mm/p2m-ept.c | 57 +++++++++++++++++++++++++++++++++++++++++++----
 xen/arch/x86/mm/p2m.c     |  8 -------
 2 files changed, 53 insertions(+), 12 deletions(-)
xen/arch/x86/mm/p2m-ept.c +53 -4
index 407e299..fabcd06 100644
@@ -17,6 +17,7 @@
 
 #include <xen/domain_page.h>
 #include <xen/sched.h>
+#include <asm/altp2m.h>
 #include <asm/current.h>
 #include <asm/paging.h>
 #include <asm/types.h>
@@ -1222,6 +1223,34 @@ static void ept_tlb_flush(struct p2m_domain *p2m)
     ept_sync_domain_mask(p2m, p2m->domain->dirty_cpumask);
 }
 
+static void ept_set_ad_sync(struct domain *d, bool value)
+{
+    struct p2m_domain *hostp2m = p2m_get_hostp2m(d);
+
+    ASSERT(p2m_locked_by_me(hostp2m));
+
+    hostp2m->ept.ad = value;
+
+    if ( unlikely(altp2m_active(d)) )
+    {
+        unsigned int i;
+
+        for ( i = 0; i < MAX_ALTP2M; i++ )
+        {
+            struct p2m_domain *p2m;
+
+            if ( d->arch.altp2m_eptp[i] == mfn_x(INVALID_MFN) )
+                continue;
+
+            p2m = d->arch.altp2m_p2m[i];
+
+            p2m_lock(p2m);
+            p2m->ept.ad = value;
+            p2m_unlock(p2m);
+        }
+    }
+}
+
 static void ept_enable_pml(struct p2m_domain *p2m)
 {
     /* Domain must have been paused */
@@ -1236,7 +1265,7 @@ static void ept_enable_pml(struct p2m_domain *p2m)
         return;
 
     /* Enable EPT A/D bit for PML */
-    p2m->ept.ad = 1;
+    ept_set_ad_sync(p2m->domain, true);
     vmx_domain_update_eptp(p2m->domain);
 }
 
@@ -1248,10 +1277,28 @@ static void ept_disable_pml(struct p2m_domain *p2m)
     vmx_domain_disable_pml(p2m->domain);
 
     /* Disable EPT A/D bit */
-    p2m->ept.ad = 0;
+    ept_set_ad_sync(p2m->domain, false);
     vmx_domain_update_eptp(p2m->domain);
 }
 
+static void ept_enable_hardware_log_dirty(struct p2m_domain *p2m)
+{
+    struct p2m_domain *hostp2m = p2m_get_hostp2m(p2m->domain);
+
+    p2m_lock(hostp2m);
+    ept_enable_pml(hostp2m);
+    p2m_unlock(hostp2m);
+}
+
+static void ept_disable_hardware_log_dirty(struct p2m_domain *p2m)
+{
+    struct p2m_domain *hostp2m = p2m_get_hostp2m(p2m->domain);
+
+    p2m_lock(hostp2m);
+    ept_disable_pml(hostp2m);
+    p2m_unlock(hostp2m);
+}
+
 static void ept_flush_pml_buffers(struct p2m_domain *p2m)
 {
     /* Domain must have been paused */
@@ -1281,8 +1328,8 @@ int ept_p2m_init(struct p2m_domain *p2m)
 
     if ( cpu_has_vmx_pml )
     {
-        p2m->enable_hardware_log_dirty = ept_enable_pml;
-        p2m->disable_hardware_log_dirty = ept_disable_pml;
+        p2m->enable_hardware_log_dirty = ept_enable_hardware_log_dirty;
+        p2m->disable_hardware_log_dirty = ept_disable_hardware_log_dirty;
         p2m->flush_hardware_cached_dirty = ept_flush_pml_buffers;
     }
 
@@ -1390,8 +1437,10 @@ void setup_ept_dump(void)
 void p2m_init_altp2m_ept(struct domain *d, unsigned int i)
 {
     struct p2m_domain *p2m = d->arch.altp2m_p2m[i];
+    struct p2m_domain *hostp2m = p2m_get_hostp2m(d);
     struct ept_data *ept;
 
+    p2m->ept.ad = hostp2m->ept.ad;
     p2m->min_remapped_gfn = gfn_x(INVALID_GFN);
     p2m->max_remapped_gfn = 0;
     ept = &p2m->ept;
xen/arch/x86/mm/p2m.c +0 -8
index a00a3c1..42b9ef4 100644
@@ -360,11 +360,7 @@ void p2m_enable_hardware_log_dirty(struct domain *d)
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
 
     if ( p2m->enable_hardware_log_dirty )
-    {
-        p2m_lock(p2m);
         p2m->enable_hardware_log_dirty(p2m);
-        p2m_unlock(p2m);
-    }
 }
 
 void p2m_disable_hardware_log_dirty(struct domain *d)
@@ -372,11 +368,7 @@ void p2m_disable_hardware_log_dirty(struct domain *d)
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
 
     if ( p2m->disable_hardware_log_dirty )
-    {
-        p2m_lock(p2m);
         p2m->disable_hardware_log_dirty(p2m);
-        p2m_unlock(p2m);
-    }
 }
 
 void p2m_flush_hardware_cached_dirty(struct domain *d)
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#2 lore raw

PATCH 2/2 x86/altp2m: fix display frozen when switching to a new view early

In reply to Razvan Cojocaru

When an new altp2m view is created very early on guest boot, the display will freeze (although the guest will run normally). This may also happen on resizing the display. The reason is the way Xen currently (mis)handles logdirty VGA: it intentionally misconfigures VGA pages so that they will fault.

The problem is that it only does this in the host p2m. Once we switch to a new altp2m, the misconfigured entries will no longer fault, so the display will not be updated.

This patch:
* updates ept_handle_misconfig() to use the active altp2m instead of the hostp2m;
* allocates new logdirty ranges for each altp2m;
* has p2m_init_altp2m_ept() copy over max_mapped_pfn, and global_logdirty, and merges the logdirty ranges of the hostp2m into the logdirty range of the altp2m;
* modifies p2m_change_entry_type_global(), p2m_memory_type_changed and p2m_change_type_range() to propagate their changes to all valid altp2ms.

---
 xen/arch/x86/mm/p2m-ept.c         |  31 ++++++++++-
 xen/arch/x86/mm/p2m.c             | 112 ++++++++++++++++++++++++++++----------
 xen/drivers/passthrough/pci.c     |   2 +-
 xen/include/asm-x86/hvm/vmx/vmx.h |   3 +-
 xen/include/asm-x86/p2m.h         |  10 ++--
 5 files changed, 123 insertions(+), 35 deletions(-)
xen/arch/x86/mm/p2m-ept.c +30 -1
index fabcd06..28790bf 100644
@@ -657,6 +657,9 @@ bool_t ept_handle_misconfig(uint64_t gpa)
     bool_t spurious;
     int rc;
 
+    if ( altp2m_active(curr->domain) )
+        p2m = p2m_get_altp2m(curr);
+
     p2m_lock(p2m);
 
     spurious = curr->arch.hvm.vmx.ept_spurious_misconfig;
@@ -1434,18 +1437,44 @@ void setup_ept_dump(void)
     register_keyhandler('D', ept_dump_p2m_table, "dump VT-x EPT tables", 0);
 }
 
-void p2m_init_altp2m_ept(struct domain *d, unsigned int i)
+int p2m_init_altp2m_ept(struct domain *d, unsigned int i)
 {
     struct p2m_domain *p2m = d->arch.altp2m_p2m[i];
     struct p2m_domain *hostp2m = p2m_get_hostp2m(d);
     struct ept_data *ept;
+    int rc;
+
+    ASSERT(!p2m->sync.logdirty_ranges);
+    p2m->sync.logdirty_ranges = rangeset_new(d, "log-dirty",
+                                             RANGESETF_prettyprint_hex);
+    if ( !p2m->sync.logdirty_ranges )
+        return -ENOMEM;
+
+    rc = rangeset_merge(p2m->sync.logdirty_ranges,
+                        hostp2m->sync.logdirty_ranges);
+    if ( !rc )
+        return rc;
 
     p2m->ept.ad = hostp2m->ept.ad;
+    p2m->max_mapped_pfn = hostp2m->max_mapped_pfn;
+    p2m->default_access = hostp2m->default_access;
+    p2m->domain = hostp2m->domain;
+
+    p2m->sync.global_logdirty = hostp2m->sync.global_logdirty;
     p2m->min_remapped_gfn = gfn_x(INVALID_GFN);
     p2m->max_remapped_gfn = 0;
     ept = &p2m->ept;
     ept->mfn = pagetable_get_pfn(p2m_get_pagetable(p2m));
     d->arch.altp2m_eptp[i] = ept->eptp;
+
+    return 0;
+}
+
+void p2m_uninit_altp2m_ept(struct p2m_domain *p2m)
+{
+    ASSERT(p2m->sync.logdirty_ranges);
+    rangeset_destroy(p2m->sync.logdirty_ranges);
+    p2m->sync.logdirty_ranges = NULL;
 }
 
 unsigned int p2m_find_altp2m_by_eptp(struct domain *d, uint64_t eptp)
xen/arch/x86/mm/p2m.c +84 -28

205 lines not on this page · raw message

xen/drivers/passthrough/pci.c +1 -1
index e5b9602..390c748 100644
@@ -1418,7 +1418,7 @@ static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn, u32 flag)
      * enabled for this domain */
     if ( unlikely(d->arch.hvm.mem_sharing_enabled ||
                   vm_event_check_ring(d->vm_event_paging) ||
-                  p2m_get_hostp2m(d)->global_logdirty) )
+                  p2m_get_hostp2m(d)->sync.global_logdirty) )
         return -EXDEV;
 
     if ( !pcidevs_trylock() )
xen/include/asm-x86/hvm/vmx/vmx.h +2 -1
index b110e16..b2a1094 100644
@@ -598,7 +598,8 @@ void ept_p2m_uninit(struct p2m_domain *p2m);
 void ept_walk_table(struct domain *d, unsigned long gfn);
 bool_t ept_handle_misconfig(uint64_t gpa);
 void setup_ept_dump(void);
-void p2m_init_altp2m_ept(struct domain *d, unsigned int i);
+int p2m_init_altp2m_ept(struct domain *d, unsigned int i);
+void p2m_uninit_altp2m_ept(struct p2m_domain *p2m);
 /* Locate an alternate p2m by its EPTP */
 unsigned int p2m_find_altp2m_by_eptp(struct domain *d, uint64_t eptp);
 
xen/include/asm-x86/p2m.h +6 -4
index d08c595..7346eeb 100644
@@ -219,11 +219,13 @@ struct p2m_domain {
     struct list_head   np2m_list;
 #endif
 
-    /* Host p2m: Log-dirty ranges registered for the domain. */
-    struct rangeset   *logdirty_ranges;
+    struct {
+        /* Host p2m: Log-dirty ranges registered for the domain. */
+        struct rangeset   *logdirty_ranges;
 
-    /* Host p2m: Global log-dirty mode enabled for the domain. */
-    bool_t             global_logdirty;
+        /* Host p2m: Global log-dirty mode enabled for the domain. */
+        bool               global_logdirty;
+    } sync;
 
     /* Host p2m: when this flag is set, don't flush all the nested-p2m 
      * tables on every host-p2m change.  The setter of this flag 
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#3 lore raw

Re: [PATCH 2/2] x86/altp2m: fix display frozen when switching to a new view early

Quoted 21 lines · Razvan Cojocaru

When an new altp2m view is created very early on guest boot, the display will freeze (although the guest will run normally). This may also happen on resizing the display. The reason is the way Xen currently (mis)handles logdirty VGA: it intentionally misconfigures VGA pages so that they will fault.

The problem is that it only does this in the host p2m. Once we switch to a new altp2m, the misconfigured entries will no longer fault, so the display will not be updated.

This patch:
* updates ept_handle_misconfig() to use the active altp2m instead of the hostp2m;
* allocates new logdirty ranges for each altp2m;
* has p2m_init_altp2m_ept() copy over max_mapped_pfn, and global_logdirty, and merges the logdirty ranges of the hostp2m into the logdirty range of the altp2m;
* modifies p2m_change_entry_type_global(), p2m_memory_type_changed and p2m_change_type_range() to propagate their changes to all valid altp2ms.

Quoted 2 lines

From the looks of this patch, it would be cleaner to split out the patch for allocating/freeing resources from the patch which implements the logdirty merging.

On the allocating/freeing side of things specifically, ...

Quoted 33 lines
xen/arch/x86/mm/p2m-ept.c +18 -1
index fabcd06..28790bf 100644
@@ -1434,18 +1437,44 @@ void setup_ept_dump(void)
     register_keyhandler('D', ept_dump_p2m_table, "dump VT-x EPT tables", 0);
 }
 
-void p2m_init_altp2m_ept(struct domain *d, unsigned int i)
+int p2m_init_altp2m_ept(struct domain *d, unsigned int i)
 {
     struct p2m_domain *p2m = d->arch.altp2m_p2m[i];
     struct p2m_domain *hostp2m = p2m_get_hostp2m(d);
     struct ept_data *ept;
+    int rc;
+
+    ASSERT(!p2m->sync.logdirty_ranges);
+    p2m->sync.logdirty_ranges = rangeset_new(d, "log-dirty",
+                                             RANGESETF_prettyprint_hex);
+    if ( !p2m->sync.logdirty_ranges )
+        return -ENOMEM;
+
+    rc = rangeset_merge(p2m->sync.logdirty_ranges,
+                        hostp2m->sync.logdirty_ranges);
+    if ( !rc )
+        return rc;
 
     p2m->ept.ad = hostp2m->ept.ad;
+    p2m->max_mapped_pfn = hostp2m->max_mapped_pfn;
+    p2m->default_access = hostp2m->default_access;
+    p2m->domain = hostp2m->domain;
+
+    p2m->sync.global_logdirty = hostp2m->sync.global_logdirty;

xen/arch/x86/mm/p2m-ept.c void setup_ept_dump(void) · line 1473

Quoted 10 lines
xen/arch/x86/mm/p2m-ept.c +5 -0
     p2m->min_remapped_gfn = gfn_x(INVALID_GFN);
     p2m->max_remapped_gfn = 0;
     ept = &p2m->ept;
     ept->mfn = pagetable_get_pfn(p2m_get_pagetable(p2m));
     d->arch.altp2m_eptp[i] = ept->eptp;
+
+    return 0;
+}
+
+void p2m_uninit_altp2m_ept(struct p2m_domain *p2m)

For naming consistency, this should be p2m_destroy_altp2m_ept()

[EDIT] It looks like the rest of the code has poor consistency.  /sigh

xen/arch/x86/mm/p2m-ept.c void setup_ept_dump(void) · line 1477

Quoted 4 lines
xen/arch/x86/mm/p2m-ept.c +4 -0
+{
+    ASSERT(p2m->sync.logdirty_ranges);
+    rangeset_destroy(p2m->sync.logdirty_ranges);
+    p2m->sync.logdirty_ranges = NULL;

Please make all destroy functions idempotent.  i.e.

if ( p2m->sync.logdirty_ranges )
{
    rangeset_destroy(p2m->sync.logdirty_ranges);
    p2m->sync.logdirty_ranges = NULL;
}

and use this destroy function in the cleanup path of init().

I'm currently in the process of doing this to our entire create/destroy infrastructure, which is a necessary prerequisite to fix the "vcpu allocation during domain creation" problem we've got.

The longterm plan is to have errors in the init() path return immediately with no cleanup, and have the top level make one call into the destroy() path.  For this to work, the destroy path needs to be able to correctly clean up from any point of initialisation (including none).

Quoted 8 lines
xen/arch/x86/mm/p2m-ept.c +0 -0
 }
 
 unsigned int p2m_find_altp2m_by_eptp(struct domain *d, uint64_t eptp)
xen/arch/x86/mm/p2m.c +0 -0
index 42b9ef4..e9f8385 100644

xen/arch/x86/mm/p2m.c static int p2m_init_hostp2m(struct domain *d) · line 124

Quoted 8 lines
xen/arch/x86/mm/p2m.c +2 -3
@@ -119,9 +120,9 @@ static int p2m_init_hostp2m(struct domain *d)
 
     if ( p2m )
     {
-        p2m->logdirty_ranges = rangeset_new(d, "log-dirty",
-                                            RANGESETF_prettyprint_hex);
-        if ( p2m->logdirty_ranges )
+        p2m->sync.logdirty_ranges = rangeset_new(d, "log-dirty",
+                                                 RANGESETF_prettyprint_hex);

This looks to be common with bits of p2m_init_altp2m_ept().  Why doesn't that get reused?

xen/arch/x86/mm/p2m.c int p2m_destroy_altp2m_by_id(struct domain *d, unsigned int idx) · line 2399

Quoted 9 lines
xen/arch/x86/mm/p2m.c +2 -0
+        if ( p2m->sync.logdirty_ranges )
         {
             d->arch.p2m = p2m;
             return 0;
@@ -2341,6 +2396,7 @@ int p2m_destroy_altp2m_by_id(struct domain *d, unsigned int idx)
         {
             p2m_flush_table(d->arch.altp2m_p2m[idx]);
             /* Uninit and reinit ept to force TLB shootdown */
+            p2m_uninit_altp2m_ept(d->arch.altp2m_p2m[idx]);

Shouldn't this ideally be called from
ept_p2m_uninit(d->arch.altp2m_p2m[idx]) instead?

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw

Re: [PATCH 2/2] x86/altp2m: fix display frozen when switching to a new view early

Quoted 22 lines · Andrew Cooper
Quoted 21 lines · Razvan Cojocaru

When an new altp2m view is created very early on guest boot, the display will freeze (although the guest will run normally). This may also happen on resizing the display. The reason is the way Xen currently (mis)handles logdirty VGA: it intentionally misconfigures VGA pages so that they will fault.

The problem is that it only does this in the host p2m. Once we switch to a new altp2m, the misconfigured entries will no longer fault, so the display will not be updated.

This patch:
* updates ept_handle_misconfig() to use the active altp2m instead of the hostp2m;
* allocates new logdirty ranges for each altp2m;
* has p2m_init_altp2m_ept() copy over max_mapped_pfn, and global_logdirty, and merges the logdirty ranges of the hostp2m into the logdirty range of the altp2m;
* modifies p2m_change_entry_type_global(), p2m_memory_type_changed and p2m_change_type_range() to propagate their changes to all valid altp2ms.

Quoted 8 lines
Quoted 4 lines

From the looks of this patch, it would be cleaner to split out the patch

for allocating/freeing resources from the patch which implements the logdirty merging.

On the allocating/freeing side of things specifically, ...

Thanks for the review! I was poking the patch around to see how I might split it as indicated, and there's a small problem: I've moved p2m->logdirty_ranges and p2m->global_logdirty under p2m->sync.logdirty_ranges and p2m->sync.global_logdirty respectively.

This was recommended by George, but as it has turned out while coding it doesn't make a huge difference (beyond being useful to really identify all places where those two were used because after the move code that wasn't updated stopped compiling).

But the point is that if I move them under "sync" and update all the code that uses them, the allocate / free part of the patch grows to quite a lot of the original patch.

Should I drop the move under "sync"?

Quoted 46 lines
Quoted 33 lines
xen/arch/x86/mm/p2m-ept.c +18 -1
index fabcd06..28790bf 100644
@@ -1434,18 +1437,44 @@ void setup_ept_dump(void)
     register_keyhandler('D', ept_dump_p2m_table, "dump VT-x EPT tables", 0);
 }
 
-void p2m_init_altp2m_ept(struct domain *d, unsigned int i)
+int p2m_init_altp2m_ept(struct domain *d, unsigned int i)
 {
     struct p2m_domain *p2m = d->arch.altp2m_p2m[i];
     struct p2m_domain *hostp2m = p2m_get_hostp2m(d);
     struct ept_data *ept;
+    int rc;
+
+    ASSERT(!p2m->sync.logdirty_ranges);
+    p2m->sync.logdirty_ranges = rangeset_new(d, "log-dirty",
+                                             RANGESETF_prettyprint_hex);
+    if ( !p2m->sync.logdirty_ranges )
+        return -ENOMEM;
+
+    rc = rangeset_merge(p2m->sync.logdirty_ranges,
+                        hostp2m->sync.logdirty_ranges);
+    if ( !rc )
+        return rc;
 
     p2m->ept.ad = hostp2m->ept.ad;
+    p2m->max_mapped_pfn = hostp2m->max_mapped_pfn;
+    p2m->default_access = hostp2m->default_access;
+    p2m->domain = hostp2m->domain;
+
+    p2m->sync.global_logdirty = hostp2m->sync.global_logdirty;

xen/arch/x86/mm/p2m-ept.c void setup_ept_dump(void) · line 1473

Quoted 10 lines
xen/arch/x86/mm/p2m-ept.c +5 -0
     p2m->min_remapped_gfn = gfn_x(INVALID_GFN);
     p2m->max_remapped_gfn = 0;
     ept = &p2m->ept;
     ept->mfn = pagetable_get_pfn(p2m_get_pagetable(p2m));
     d->arch.altp2m_eptp[i] = ept->eptp;
+
+    return 0;
+}
+
+void p2m_uninit_altp2m_ept(struct p2m_domain *p2m)

For naming consistency, this should be p2m_destroy_altp2m_ept()

Quoted 1 line

[EDIT] It looks like the rest of the code has poor consistency.  /sigh

I'll do my best to rename touched functions for consistency in the alloc / free patch as well then.

Quoted 7 lines

xen/arch/x86/mm/p2m-ept.c void setup_ept_dump(void) · line 1477

Quoted 4 lines
xen/arch/x86/mm/p2m-ept.c +4 -0
+{
+    ASSERT(p2m->sync.logdirty_ranges);
+    rangeset_destroy(p2m->sync.logdirty_ranges);
+    p2m->sync.logdirty_ranges = NULL;

Please make all destroy functions idempotent.  i.e.

Quoted 7 lines

if ( p2m->sync.logdirty_ranges )
{
    rangeset_destroy(p2m->sync.logdirty_ranges);
    p2m->sync.logdirty_ranges = NULL;
}

and use this destroy function in the cleanup path of init().

I'll do that.

Quoted 7 lines
Quoted 7 lines
xen/arch/x86/mm/p2m-ept.c +0 -0
 unsigned int p2m_find_altp2m_by_eptp(struct domain *d, uint64_t eptp)
xen/arch/x86/mm/p2m.c +0 -0
index 42b9ef4..e9f8385 100644
@@ -119,9 +120,9 @@ static int p2m_init_hostp2m(struct domain *d)
 
Quoted 10 lines

xen/arch/x86/mm/p2m.c static int p2m_init_hostp2m(struct domain *d) · line 124

Quoted 7 lines
xen/arch/x86/mm/p2m.c +2 -3
     if ( p2m )
     {
-        p2m->logdirty_ranges = rangeset_new(d, "log-dirty",
-                                            RANGESETF_prettyprint_hex);
-        if ( p2m->logdirty_ranges )
+        p2m->sync.logdirty_ranges = rangeset_new(d, "log-dirty",
+                                                 RANGESETF_prettyprint_hex);

This looks to be common with bits of p2m_init_altp2m_ept().  Why doesn't that get reused?

I'll see about that as well.

Quoted 4 lines
Quoted 4 lines
xen/arch/x86/mm/p2m.c +1 -0
+        if ( p2m->sync.logdirty_ranges )
         {
             d->arch.p2m = p2m;
             return 0;
Quoted 8 lines

xen/arch/x86/mm/p2m.c int p2m_destroy_altp2m_by_id(struct domain *d, unsigned int idx) · line 2399

Quoted 5 lines
xen/arch/x86/mm/p2m.c +1 -0
@@ -2341,6 +2396,7 @@ int p2m_destroy_altp2m_by_id(struct domain *d, unsigned int idx)
         {
             p2m_flush_table(d->arch.altp2m_p2m[idx]);
             /* Uninit and reinit ept to force TLB shootdown */
+            p2m_uninit_altp2m_ept(d->arch.altp2m_p2m[idx]);

Shouldn't this ideally be called from
ept_p2m_uninit(d->arch.altp2m_p2m[idx]) instead?

I'll check and update accordingly.

Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#5 lore raw
In reply to Razvan Cojocaru
Quoted 11 lines · Razvan Cojocaru

Hello,

This series aims to prevent the display from freezing when enabling altp2m and switching to a new view (and assorted problems when resizing the display).

The first patch propagates ept.ad changes to all active altp2ms, and the second one allocates a new logdirty rangeset for each new altp2m, and propagates (under lock) changes to all p2ms.

Quoted 7 lines

The first patch is the same as:
[PATCH V4] x86/altp2m: propagate ept.ad changes to all active altp2ms but as it is now required for the second one to apply cleanly, it has been resent as part of this series.

[PATCH 1/2] x86/altp2m: propagate ept.ad changes to all active altp2ms [PATCH 2/2] x86/altp2m: fix display frozen when switching to a new

Hi Razvan,
I would be happy to give this a spin, can you push it as a git branch somewhere?

Thanks,
Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#6 lore raw
Quoted 18 lines · Tamas K Lengyel
Quoted 16 lines · Razvan Cojocaru

Hello,

This series aims to prevent the display from freezing when enabling altp2m and switching to a new view (and assorted problems when resizing the display).

The first patch propagates ept.ad changes to all active altp2ms, and the second one allocates a new logdirty rangeset for each new altp2m, and propagates (under lock) changes to all p2ms.

The first patch is the same as:
[PATCH V4] x86/altp2m: propagate ept.ad changes to all active altp2ms but as it is now required for the second one to apply cleanly, it has been resent as part of this series.

Quoted 5 lines
Quoted 2 lines

[PATCH 1/2] x86/altp2m: propagate ept.ad changes to all active altp2ms [PATCH 2/2] x86/altp2m: fix display frozen when switching to a new

Hi Razvan,
I would be happy to give this a spin, can you push it as a git branch somewhere?

Sure, here you go:

https://github.com/razvan-cojocaru/xen/tree/altp2m-logdirty-take1

Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#7 lore raw
Quoted 23 lines · Razvan Cojocaru
Quoted 21 lines · Tamas K Lengyel
Quoted 18 lines · Razvan Cojocaru

Hello,

This series aims to prevent the display from freezing when enabling altp2m and switching to a new view (and assorted problems when resizing the display).

The first patch propagates ept.ad changes to all active altp2ms, and the second one allocates a new logdirty rangeset for each new altp2m, and propagates (under lock) changes to all p2ms.

The first patch is the same as:
[PATCH V4] x86/altp2m: propagate ept.ad changes to all active altp2ms but as it is now required for the second one to apply cleanly, it has been resent as part of this series.

[PATCH 1/2] x86/altp2m: propagate ept.ad changes to all active altp2ms [PATCH 2/2] x86/altp2m: fix display frozen when switching to a new

Quoted 6 lines
Quoted 2 lines

Hi Razvan,
I would be happy to give this a spin, can you push it as a git branch somewhere?

Sure, here you go:

https://github.com/razvan-cojocaru/xen/tree/altp2m-logdirty-take1

I ran into this crash when my config incorrectly pointed to a non-valid disk location:

(XEN) Assertion 'p2m->sync.logdirty_ranges' failed at p2m-ept.c:1475
(XEN) ----[ Xen-4.12-unstable x86_64 debug=y Not tainted ]----
(XEN) CPU: 4
(XEN) RIP: e008:[<ffff82d08033f40c>] p2m_uninit_altp2m_ept+0x29/0x2b
(XEN) RFLAGS: 0000000000010246 CONTEXT: hypervisor

(XEN) rax: ffff83046d27802c   rbx: ffff8304558dd880   rcx: 0000000000000000
(XEN) rdx: ffff83046d277fff   rsi: 00000000004680c0   rdi: 0000000000000000
(XEN) rbp: ffff83046d277d60   rsp: ffff83046d277d50   r8:  ffff82d0809304a0
(XEN) r9:  0000000000455940   r10: ffff82e008d01000   r11: 0000000000000017
(XEN) r12: ffff8304558dd880   r13: ffff8304558df830   r14: ffff8304558df000
(XEN) r15: fffffffffffffff8   cr0: 000000008005003b   cr4: 00000000003526e0
(XEN) cr3: 000000005da16000   cr2: ffff880456cd6e80
(XEN) fsb: 0000000000000000   gsb: ffff880467f40000   gss: 0000000000000000

(XEN) ds: 002b es: 002b fs: 0000 gs: 0000 ss: e010 cs: e008
(XEN) Xen code around <ffff82d08033f40c> (p2m_uninit_altp2m_ept+0x29/0x2b):
(XEN) 00 48 83 c4 08 5b 5d c3 <0f> 0b 55 48 89 e5 41 56 41 55 41 54 53 48 8d 05 (XEN) Xen call trace:

(XEN)    [<ffff82d08033f40c>] p2m_uninit_altp2m_ept+0x29/0x2b
(XEN)    [<ffff82d0803305ab>] p2m.c#p2m_teardown_altp2m+0x36/0x52
(XEN)    [<ffff82d0803331b5>] p2m_final_teardown+0x11/0x28
(XEN)    [<ffff82d08034509c>] paging_final_teardown+0x2e/0x3c
(XEN)    [<ffff82d080276439>] arch_domain_destroy+0x50/0xa1
(XEN)    [<ffff82d08020595c>] domain.c#complete_domain_destroy+0x86/0x159
(XEN)    [<ffff82d080228f4f>] rcupdate.c#rcu_process_callbacks+0xa5/0x1cf
(XEN)    [<ffff82d08023ae6b>] softirq.c#__do_softirq+0x71/0x9a
(XEN)    [<ffff82d08023aede>] do_softirq+0x13/0x15
(XEN)    [<ffff82d080275068>] domain.c#idle_loop+0x63/0xb9

(XEN)
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 4:
(XEN) Assertion 'p2m->sync.logdirty_ranges' failed at p2m-ept.c:1475 (XEN) ****************************************

With the config fixed it boots but when I run DRAKVUF on the domain I get the following crash:

(XEN) ----[ Xen-4.12-unstable x86_64 debug=y Not tainted ]----
(XEN) CPU: 0
(XEN) RIP: e008:[<000000007bdb630c>] 000000007bdb630c
(XEN) RFLAGS: 0000000000010282 CONTEXT: hypervisor (d0v5)

(XEN) rax: 00000000ee138470   rbx: 0000000000000000   rcx: 000000008000b098
(XEN) rdx: 0000000000000cf8   rsi: 0000000000000000   rdi: 000000046d2ef000
(XEN) rbp: 0000000000000000   rsp: ffff83005da27a10   r8:  0000000000000cf8
(XEN) r9:  0000000000000cf8   r10: ffff83005da27ab8   r11: ffff83005da27a08
(XEN) r12: 0000000000000000   r13: 0000000000000000   r14: 0000000000000065
(XEN) r15: 00000000000005a7   cr0: 0000000080050033   cr4: 0000000000372660
(XEN) cr3: 000000046d2ef000   cr2: 00000000ee138470
(XEN) fsb: 00007fe46d97bbc0   gsb: ffff880467f40000   gss: 0000000000000000

(XEN) ds: 0000 es: 0000 fs: 0000 gs: 0000 ss: e010 cs: e008
(XEN) Xen code around <000000007bdb630c> (000000007bdb630c):
(XEN) 80 74 0b 05 70 84 00 00 <c7> 00 00 00 00 e0 80 3d 7a 34 00 00 00 75 64 48 (XEN) Xen stack trace from rsp=ffff83005da27a10:(XEN) Xen stack trace from rsp=ffff83005da27a10:

(XEN)    0000000000000000 0000000000000065 ffff83005da27a50 ffff82d08037aafc
(XEN)    00000000fffffffe ffff82d08037ae14 0000000000000000 ffff83005da27a90
(XEN)    0000000000372660 000000046d2ef000 0000000393e91000 ffff82d0809602b0
(XEN)    000000fe00000000 ffff82d0802a3b98 ffffffffffffffff ffff83005da27ab8
(XEN)    ffff83005da27b08 ffff82d0802a3511 ffff82d08046b028 ffff83005da27b08
(XEN)    ffff82d0802a3511 ffff83005da27fff 0000138800000292 000082d0808176a0
(XEN)    0000000000000000 ffff82d08023b889 0000000000000292 ffff82d08046b028
(XEN)    ffff82d080451ac8 ffff82d080454af2 00000000000005a7 ffff83005da27b78
(XEN)    ffff82d080251d6f ffff82d080250fcd 0000000000000028 ffff83005da27b88
(XEN)    ffff83005da27b38 000000000000e010 ffff82d080454c73 ffff82d080451ac8
(XEN)    ffff82d080454af2 00000000000005a7 0000000000000030 ffff83005da27bf8
(XEN)    ffff82d080454c73 ffff83005da27be8 ffff82d0802aaebc ffff82d08033f3dc
(XEN)    ffff82d080451ac8 ffff82d08037d969 ffff82d08037d95d ffff82d08037d969
(XEN)    0b0f82d08037d95d ffff82d08037d969 ffff83005fe5b000 0000000000000000
(XEN)    0000000000000000 ffff83005da27fff 0000000000000000 00007cffa25d83e7
(XEN)    ffff82d08037da2d deadbeefdeadf00d ffff83018caf2530 ffff83005da27d38
(XEN)    ffff83040a492830 ffff83005da27cc8 ffff83040bab2880 0000000000000000
(XEN)    0000000000000000 deadbeefdeadf00d deadbeefdeadf00d 0000000000000000
(XEN)    0000000000000000 ffff830451835000 0000000000000000 ffff83040a492000
(XEN)    0000000600000000 ffff82d08033f3da 000000000000e008 0000000000010282

(XEN) Xen call trace:
(XEN) [<000000007bdb630c>] 000000007bdb630c
(XEN)
(XEN) Pagetable walk from 00000000ee138470:

(XEN)  L4[0x000] = 000000046d2ee063 ffffffffffffffff
(XEN)  L3[0x003] = 000000005da11063 ffffffffffffffff
(XEN)  L2[0x170] = 0000000000000000 ffffffffffffffff

(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) FATAL PAGE FAULT
(XEN) [error_code=0002]
(XEN) Faulting linear address: 00000000ee138470
(XEN) ****************************************
(XEN)
(XEN) Reboot in five seconds...

Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#8 lore raw
Quoted 62 lines · Tamas K Lengyel
Quoted 23 lines · Razvan Cojocaru
Quoted 21 lines · Tamas K Lengyel
Quoted 18 lines · Razvan Cojocaru

Hello,

This series aims to prevent the display from freezing when enabling altp2m and switching to a new view (and assorted problems when resizing the display).

The first patch propagates ept.ad changes to all active altp2ms, and the second one allocates a new logdirty rangeset for each new altp2m, and propagates (under lock) changes to all p2ms.

The first patch is the same as:
[PATCH V4] x86/altp2m: propagate ept.ad changes to all active altp2ms but as it is now required for the second one to apply cleanly, it has been resent as part of this series.

[PATCH 1/2] x86/altp2m: propagate ept.ad changes to all active altp2ms [PATCH 2/2] x86/altp2m: fix display frozen when switching to a new

Quoted 6 lines
Quoted 2 lines

Hi Razvan,
I would be happy to give this a spin, can you push it as a git branch somewhere?

Sure, here you go:

https://github.com/razvan-cojocaru/xen/tree/altp2m-logdirty-take1

I ran into this crash when my config incorrectly pointed to a non-valid disk location:

(XEN) Assertion 'p2m->sync.logdirty_ranges' failed at p2m-ept.c:1475
(XEN) ----[ Xen-4.12-unstable x86_64 debug=y Not tainted ]----
(XEN) CPU: 4
(XEN) RIP: e008:[<ffff82d08033f40c>] p2m_uninit_altp2m_ept+0x29/0x2b
(XEN) RFLAGS: 0000000000010246 CONTEXT: hypervisor

(XEN) rax: ffff83046d27802c   rbx: ffff8304558dd880   rcx: 0000000000000000
(XEN) rdx: ffff83046d277fff   rsi: 00000000004680c0   rdi: 0000000000000000
(XEN) rbp: ffff83046d277d60   rsp: ffff83046d277d50   r8:  ffff82d0809304a0
(XEN) r9:  0000000000455940   r10: ffff82e008d01000   r11: 0000000000000017
(XEN) r12: ffff8304558dd880   r13: ffff8304558df830   r14: ffff8304558df000
(XEN) r15: fffffffffffffff8   cr0: 000000008005003b   cr4: 00000000003526e0
(XEN) cr3: 000000005da16000   cr2: ffff880456cd6e80
(XEN) fsb: 0000000000000000   gsb: ffff880467f40000   gss: 0000000000000000

(XEN) ds: 002b es: 002b fs: 0000 gs: 0000 ss: e010 cs: e008
(XEN) Xen code around <ffff82d08033f40c> (p2m_uninit_altp2m_ept+0x29/0x2b):
(XEN) 00 48 83 c4 08 5b 5d c3 <0f> 0b 55 48 89 e5 41 56 41 55 41 54 53 48 8d 05 (XEN) Xen call trace:

(XEN)    [<ffff82d08033f40c>] p2m_uninit_altp2m_ept+0x29/0x2b
(XEN)    [<ffff82d0803305ab>] p2m.c#p2m_teardown_altp2m+0x36/0x52
(XEN)    [<ffff82d0803331b5>] p2m_final_teardown+0x11/0x28
(XEN)    [<ffff82d08034509c>] paging_final_teardown+0x2e/0x3c
(XEN)    [<ffff82d080276439>] arch_domain_destroy+0x50/0xa1
(XEN)    [<ffff82d08020595c>] domain.c#complete_domain_destroy+0x86/0x159
(XEN)    [<ffff82d080228f4f>] rcupdate.c#rcu_process_callbacks+0xa5/0x1cf
(XEN)    [<ffff82d08023ae6b>] softirq.c#__do_softirq+0x71/0x9a
(XEN)    [<ffff82d08023aede>] do_softirq+0x13/0x15
(XEN)    [<ffff82d080275068>] domain.c#idle_loop+0x63/0xb9
Quoted 6 lines

(XEN)
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 4:
(XEN) Assertion 'p2m->sync.logdirty_ranges' failed at p2m-ept.c:1475 (XEN) ****************************************

Right, that one I've also come across now, that will be fixed in the next series as a result of doing what Andrew has suggested, which is to say:

"Please make all destroy functions idempotent. i.e.

if ( p2m->sync.logdirty_ranges )

{
    rangeset_destroy(p2m->sync.logdirty_ranges);
    p2m->sync.logdirty_ranges = NULL;
}

and use this destroy function in the cleanup path of init()."

Quoted 47 lines

With the config fixed it boots but when I run DRAKVUF on the domain I get the following crash:

(XEN) ----[ Xen-4.12-unstable x86_64 debug=y Not tainted ]----
(XEN) CPU: 0
(XEN) RIP: e008:[<000000007bdb630c>] 000000007bdb630c
(XEN) RFLAGS: 0000000000010282 CONTEXT: hypervisor (d0v5)

(XEN) rax: 00000000ee138470   rbx: 0000000000000000   rcx: 000000008000b098
(XEN) rdx: 0000000000000cf8   rsi: 0000000000000000   rdi: 000000046d2ef000
(XEN) rbp: 0000000000000000   rsp: ffff83005da27a10   r8:  0000000000000cf8
(XEN) r9:  0000000000000cf8   r10: ffff83005da27ab8   r11: ffff83005da27a08
(XEN) r12: 0000000000000000   r13: 0000000000000000   r14: 0000000000000065
(XEN) r15: 00000000000005a7   cr0: 0000000080050033   cr4: 0000000000372660
(XEN) cr3: 000000046d2ef000   cr2: 00000000ee138470
(XEN) fsb: 00007fe46d97bbc0   gsb: ffff880467f40000   gss: 0000000000000000

(XEN) ds: 0000 es: 0000 fs: 0000 gs: 0000 ss: e010 cs: e008
(XEN) Xen code around <000000007bdb630c> (000000007bdb630c):
(XEN) 80 74 0b 05 70 84 00 00 <c7> 00 00 00 00 e0 80 3d 7a 34 00 00 00 75 64 48 (XEN) Xen stack trace from rsp=ffff83005da27a10:(XEN) Xen stack trace from rsp=ffff83005da27a10:

(XEN)    0000000000000000 0000000000000065 ffff83005da27a50 ffff82d08037aafc
(XEN)    00000000fffffffe ffff82d08037ae14 0000000000000000 ffff83005da27a90
(XEN)    0000000000372660 000000046d2ef000 0000000393e91000 ffff82d0809602b0
(XEN)    000000fe00000000 ffff82d0802a3b98 ffffffffffffffff ffff83005da27ab8
(XEN)    ffff83005da27b08 ffff82d0802a3511 ffff82d08046b028 ffff83005da27b08
(XEN)    ffff82d0802a3511 ffff83005da27fff 0000138800000292 000082d0808176a0
(XEN)    0000000000000000 ffff82d08023b889 0000000000000292 ffff82d08046b028
(XEN)    ffff82d080451ac8 ffff82d080454af2 00000000000005a7 ffff83005da27b78
(XEN)    ffff82d080251d6f ffff82d080250fcd 0000000000000028 ffff83005da27b88
(XEN)    ffff83005da27b38 000000000000e010 ffff82d080454c73 ffff82d080451ac8
(XEN)    ffff82d080454af2 00000000000005a7 0000000000000030 ffff83005da27bf8
(XEN)    ffff82d080454c73 ffff83005da27be8 ffff82d0802aaebc ffff82d08033f3dc
(XEN)    ffff82d080451ac8 ffff82d08037d969 ffff82d08037d95d ffff82d08037d969
(XEN)    0b0f82d08037d95d ffff82d08037d969 ffff83005fe5b000 0000000000000000
(XEN)    0000000000000000 ffff83005da27fff 0000000000000000 00007cffa25d83e7
(XEN)    ffff82d08037da2d deadbeefdeadf00d ffff83018caf2530 ffff83005da27d38
(XEN)    ffff83040a492830 ffff83005da27cc8 ffff83040bab2880 0000000000000000
(XEN)    0000000000000000 deadbeefdeadf00d deadbeefdeadf00d 0000000000000000
(XEN)    0000000000000000 ffff830451835000 0000000000000000 ffff83040a492000
(XEN)    0000000600000000 ffff82d08033f3da 000000000000e008 0000000000010282

(XEN) Xen call trace:
(XEN) [<000000007bdb630c>] 000000007bdb630c
(XEN)
(XEN) Pagetable walk from 00000000ee138470:

(XEN)  L4[0x000] = 000000046d2ee063 ffffffffffffffff
(XEN)  L3[0x003] = 000000005da11063 ffffffffffffffff
(XEN)  L2[0x170] = 0000000000000000 ffffffffffffffff
Quoted 9 lines

(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) FATAL PAGE FAULT
(XEN) [error_code=0002]
(XEN) Faulting linear address: 00000000ee138470
(XEN) ****************************************
(XEN)
(XEN) Reboot in five seconds...

This one I'm not sure about. What does your introspection agent do at that point?

Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#9 lore raw
Quoted 69 lines · Razvan Cojocaru
Quoted 57 lines · Tamas K Lengyel
Quoted 18 lines · Razvan Cojocaru
Quoted 17 lines · Tamas K Lengyel
Quoted 15 lines · Razvan Cojocaru

Hello,

This series aims to prevent the display from freezing when enabling altp2m and switching to a new view (and assorted problems when resizing the display).

The first patch propagates ept.ad changes to all active altp2ms, and the second one allocates a new logdirty rangeset for each new altp2m, and propagates (under lock) changes to all p2ms.

The first patch is the same as:
[PATCH V4] x86/altp2m: propagate ept.ad changes to all active altp2ms but as it is now required for the second one to apply cleanly, it has been resent as part of this series.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

[PATCH 1/2] x86/altp2m: propagate ept.ad changes to all active altp2ms [PATCH 2/2] x86/altp2m: fix display frozen when switching to a new

Hi Razvan,
I would be happy to give this a spin, can you push it as a git branch somewhere?

Sure, here you go:

https://github.com/razvan-cojocaru/xen/tree/altp2m-logdirty-take1

I ran into this crash when my config incorrectly pointed to a non-valid disk location:

(XEN) Assertion 'p2m->sync.logdirty_ranges' failed at p2m-ept.c:1475
(XEN) ----[ Xen-4.12-unstable x86_64 debug=y Not tainted ]----
(XEN) CPU: 4
(XEN) RIP: e008:[<ffff82d08033f40c>] p2m_uninit_altp2m_ept+0x29/0x2b
(XEN) RFLAGS: 0000000000010246 CONTEXT: hypervisor

(XEN) rax: ffff83046d27802c   rbx: ffff8304558dd880   rcx: 0000000000000000
(XEN) rdx: ffff83046d277fff   rsi: 00000000004680c0   rdi: 0000000000000000
(XEN) rbp: ffff83046d277d60   rsp: ffff83046d277d50   r8:  ffff82d0809304a0
(XEN) r9:  0000000000455940   r10: ffff82e008d01000   r11: 0000000000000017
(XEN) r12: ffff8304558dd880   r13: ffff8304558df830   r14: ffff8304558df000
(XEN) r15: fffffffffffffff8   cr0: 000000008005003b   cr4: 00000000003526e0
(XEN) cr3: 000000005da16000   cr2: ffff880456cd6e80
(XEN) fsb: 0000000000000000   gsb: ffff880467f40000   gss: 0000000000000000

(XEN) ds: 002b es: 002b fs: 0000 gs: 0000 ss: e010 cs: e008
(XEN) Xen code around <ffff82d08033f40c> (p2m_uninit_altp2m_ept+0x29/0x2b):
(XEN) 00 48 83 c4 08 5b 5d c3 <0f> 0b 55 48 89 e5 41 56 41 55 41 54 53 48 8d 05 (XEN) Xen call trace:

(XEN)    [<ffff82d08033f40c>] p2m_uninit_altp2m_ept+0x29/0x2b
(XEN)    [<ffff82d0803305ab>] p2m.c#p2m_teardown_altp2m+0x36/0x52
(XEN)    [<ffff82d0803331b5>] p2m_final_teardown+0x11/0x28
(XEN)    [<ffff82d08034509c>] paging_final_teardown+0x2e/0x3c
(XEN)    [<ffff82d080276439>] arch_domain_destroy+0x50/0xa1
(XEN)    [<ffff82d08020595c>] domain.c#complete_domain_destroy+0x86/0x159
(XEN)    [<ffff82d080228f4f>] rcupdate.c#rcu_process_callbacks+0xa5/0x1cf
(XEN)    [<ffff82d08023ae6b>] softirq.c#__do_softirq+0x71/0x9a
(XEN)    [<ffff82d08023aede>] do_softirq+0x13/0x15
(XEN)    [<ffff82d080275068>] domain.c#idle_loop+0x63/0xb9
Quoted 6 lines

(XEN)
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 4:
(XEN) Assertion 'p2m->sync.logdirty_ranges' failed at p2m-ept.c:1475 (XEN) ****************************************

Right, that one I've also come across now, that will be fixed in the next series as a result of doing what Andrew has suggested, which is to say:

"Please make all destroy functions idempotent. i.e.

Quoted 7 lines

if ( p2m->sync.logdirty_ranges )

{
    rangeset_destroy(p2m->sync.logdirty_ranges);
    p2m->sync.logdirty_ranges = NULL;
}

and use this destroy function in the cleanup path of init()."

Indeed.

Quoted 57 lines
Quoted 48 lines

With the config fixed it boots but when I run DRAKVUF on the domain I get the following crash:

(XEN) ----[ Xen-4.12-unstable x86_64 debug=y Not tainted ]----
(XEN) CPU: 0
(XEN) RIP: e008:[<000000007bdb630c>] 000000007bdb630c
(XEN) RFLAGS: 0000000000010282 CONTEXT: hypervisor (d0v5)

(XEN) rax: 00000000ee138470   rbx: 0000000000000000   rcx: 000000008000b098
(XEN) rdx: 0000000000000cf8   rsi: 0000000000000000   rdi: 000000046d2ef000
(XEN) rbp: 0000000000000000   rsp: ffff83005da27a10   r8:  0000000000000cf8
(XEN) r9:  0000000000000cf8   r10: ffff83005da27ab8   r11: ffff83005da27a08
(XEN) r12: 0000000000000000   r13: 0000000000000000   r14: 0000000000000065
(XEN) r15: 00000000000005a7   cr0: 0000000080050033   cr4: 0000000000372660
(XEN) cr3: 000000046d2ef000   cr2: 00000000ee138470
(XEN) fsb: 00007fe46d97bbc0   gsb: ffff880467f40000   gss: 0000000000000000

(XEN) ds: 0000 es: 0000 fs: 0000 gs: 0000 ss: e010 cs: e008
(XEN) Xen code around <000000007bdb630c> (000000007bdb630c):
(XEN) 80 74 0b 05 70 84 00 00 <c7> 00 00 00 00 e0 80 3d 7a 34 00 00 00 75 64 48 (XEN) Xen stack trace from rsp=ffff83005da27a10:(XEN) Xen stack trace from rsp=ffff83005da27a10:

(XEN)    0000000000000000 0000000000000065 ffff83005da27a50 ffff82d08037aafc
(XEN)    00000000fffffffe ffff82d08037ae14 0000000000000000 ffff83005da27a90
(XEN)    0000000000372660 000000046d2ef000 0000000393e91000 ffff82d0809602b0
(XEN)    000000fe00000000 ffff82d0802a3b98 ffffffffffffffff ffff83005da27ab8
(XEN)    ffff83005da27b08 ffff82d0802a3511 ffff82d08046b028 ffff83005da27b08
(XEN)    ffff82d0802a3511 ffff83005da27fff 0000138800000292 000082d0808176a0
(XEN)    0000000000000000 ffff82d08023b889 0000000000000292 ffff82d08046b028
(XEN)    ffff82d080451ac8 ffff82d080454af2 00000000000005a7 ffff83005da27b78
(XEN)    ffff82d080251d6f ffff82d080250fcd 0000000000000028 ffff83005da27b88
(XEN)    ffff83005da27b38 000000000000e010 ffff82d080454c73 ffff82d080451ac8
(XEN)    ffff82d080454af2 00000000000005a7 0000000000000030 ffff83005da27bf8
(XEN)    ffff82d080454c73 ffff83005da27be8 ffff82d0802aaebc ffff82d08033f3dc
(XEN)    ffff82d080451ac8 ffff82d08037d969 ffff82d08037d95d ffff82d08037d969
(XEN)    0b0f82d08037d95d ffff82d08037d969 ffff83005fe5b000 0000000000000000
(XEN)    0000000000000000 ffff83005da27fff 0000000000000000 00007cffa25d83e7
(XEN)    ffff82d08037da2d deadbeefdeadf00d ffff83018caf2530 ffff83005da27d38
(XEN)    ffff83040a492830 ffff83005da27cc8 ffff83040bab2880 0000000000000000
(XEN)    0000000000000000 deadbeefdeadf00d deadbeefdeadf00d 0000000000000000
(XEN)    0000000000000000 ffff830451835000 0000000000000000 ffff83040a492000
(XEN)    0000000600000000 ffff82d08033f3da 000000000000e008 0000000000010282

(XEN) Xen call trace:
(XEN) [<000000007bdb630c>] 000000007bdb630c
(XEN)
(XEN) Pagetable walk from 00000000ee138470:

(XEN)  L4[0x000] = 000000046d2ee063 ffffffffffffffff
(XEN)  L3[0x003] = 000000005da11063 ffffffffffffffff
(XEN)  L2[0x170] = 0000000000000000 ffffffffffffffff
Quoted 9 lines

(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) FATAL PAGE FAULT
(XEN) [error_code=0002]
(XEN) Faulting linear address: 00000000ee138470
(XEN) ****************************************
(XEN)
(XEN) Reboot in five seconds...

Quoted 2 lines

This one I'm not sure about. What does your introspection agent do at that point?

This crash is bizarre.  Xen has most likely followed a corrupt function pointer, because none of Xen's .text section live just below the 2G boundary

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#10 lore raw
Quoted 138 lines · Andrew Cooper
Quoted 69 lines · Razvan Cojocaru
Quoted 57 lines · Tamas K Lengyel
Quoted 18 lines · Razvan Cojocaru
Quoted 17 lines · Tamas K Lengyel
Quoted 15 lines · Razvan Cojocaru

Hello,

This series aims to prevent the display from freezing when enabling altp2m and switching to a new view (and assorted problems when resizing the display).

The first patch propagates ept.ad changes to all active altp2ms, and the second one allocates a new logdirty rangeset for each new altp2m, and propagates (under lock) changes to all p2ms.

The first patch is the same as:
[PATCH V4] x86/altp2m: propagate ept.ad changes to all active altp2ms but as it is now required for the second one to apply cleanly, it has been resent as part of this series.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

[PATCH 1/2] x86/altp2m: propagate ept.ad changes to all active altp2ms [PATCH 2/2] x86/altp2m: fix display frozen when switching to a new

Hi Razvan,
I would be happy to give this a spin, can you push it as a git branch somewhere?

Sure, here you go:

https://github.com/razvan-cojocaru/xen/tree/altp2m-logdirty-take1

I ran into this crash when my config incorrectly pointed to a non-valid disk location:

(XEN) Assertion 'p2m->sync.logdirty_ranges' failed at p2m-ept.c:1475
(XEN) ----[ Xen-4.12-unstable x86_64 debug=y Not tainted ]----
(XEN) CPU: 4
(XEN) RIP: e008:[<ffff82d08033f40c>] p2m_uninit_altp2m_ept+0x29/0x2b
(XEN) RFLAGS: 0000000000010246 CONTEXT: hypervisor

(XEN) rax: ffff83046d27802c   rbx: ffff8304558dd880   rcx: 0000000000000000
(XEN) rdx: ffff83046d277fff   rsi: 00000000004680c0   rdi: 0000000000000000
(XEN) rbp: ffff83046d277d60   rsp: ffff83046d277d50   r8:  ffff82d0809304a0
(XEN) r9:  0000000000455940   r10: ffff82e008d01000   r11: 0000000000000017
(XEN) r12: ffff8304558dd880   r13: ffff8304558df830   r14: ffff8304558df000
(XEN) r15: fffffffffffffff8   cr0: 000000008005003b   cr4: 00000000003526e0
(XEN) cr3: 000000005da16000   cr2: ffff880456cd6e80
(XEN) fsb: 0000000000000000   gsb: ffff880467f40000   gss: 0000000000000000

(XEN) ds: 002b es: 002b fs: 0000 gs: 0000 ss: e010 cs: e008
(XEN) Xen code around <ffff82d08033f40c> (p2m_uninit_altp2m_ept+0x29/0x2b):
(XEN) 00 48 83 c4 08 5b 5d c3 <0f> 0b 55 48 89 e5 41 56 41 55 41 54 53 48 8d 05 (XEN) Xen call trace:

(XEN)    [<ffff82d08033f40c>] p2m_uninit_altp2m_ept+0x29/0x2b
(XEN)    [<ffff82d0803305ab>] p2m.c#p2m_teardown_altp2m+0x36/0x52
(XEN)    [<ffff82d0803331b5>] p2m_final_teardown+0x11/0x28
(XEN)    [<ffff82d08034509c>] paging_final_teardown+0x2e/0x3c
(XEN)    [<ffff82d080276439>] arch_domain_destroy+0x50/0xa1
(XEN)    [<ffff82d08020595c>] domain.c#complete_domain_destroy+0x86/0x159
(XEN)    [<ffff82d080228f4f>] rcupdate.c#rcu_process_callbacks+0xa5/0x1cf
(XEN)    [<ffff82d08023ae6b>] softirq.c#__do_softirq+0x71/0x9a
(XEN)    [<ffff82d08023aede>] do_softirq+0x13/0x15
(XEN)    [<ffff82d080275068>] domain.c#idle_loop+0x63/0xb9
Quoted 6 lines

(XEN)
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 4:
(XEN) Assertion 'p2m->sync.logdirty_ranges' failed at p2m-ept.c:1475 (XEN) ****************************************

Right, that one I've also come across now, that will be fixed in the next series as a result of doing what Andrew has suggested, which is to say:

"Please make all destroy functions idempotent. i.e.

Quoted 7 lines

if ( p2m->sync.logdirty_ranges )

{
    rangeset_destroy(p2m->sync.logdirty_ranges);
    p2m->sync.logdirty_ranges = NULL;
}

and use this destroy function in the cleanup path of init()."

Indeed.

Quoted 57 lines
Quoted 57 lines

With the config fixed it boots but when I run DRAKVUF on the domain I get the following crash:

(XEN) ----[ Xen-4.12-unstable x86_64 debug=y Not tainted ]----
(XEN) CPU: 0
(XEN) RIP: e008:[<000000007bdb630c>] 000000007bdb630c
(XEN) RFLAGS: 0000000000010282 CONTEXT: hypervisor (d0v5)

(XEN) rax: 00000000ee138470   rbx: 0000000000000000   rcx: 000000008000b098
(XEN) rdx: 0000000000000cf8   rsi: 0000000000000000   rdi: 000000046d2ef000
(XEN) rbp: 0000000000000000   rsp: ffff83005da27a10   r8:  0000000000000cf8
(XEN) r9:  0000000000000cf8   r10: ffff83005da27ab8   r11: ffff83005da27a08
(XEN) r12: 0000000000000000   r13: 0000000000000000   r14: 0000000000000065
(XEN) r15: 00000000000005a7   cr0: 0000000080050033   cr4: 0000000000372660
(XEN) cr3: 000000046d2ef000   cr2: 00000000ee138470
(XEN) fsb: 00007fe46d97bbc0   gsb: ffff880467f40000   gss: 0000000000000000

(XEN) ds: 0000 es: 0000 fs: 0000 gs: 0000 ss: e010 cs: e008
(XEN) Xen code around <000000007bdb630c> (000000007bdb630c):
(XEN) 80 74 0b 05 70 84 00 00 <c7> 00 00 00 00 e0 80 3d 7a 34 00 00 00 75 64 48 (XEN) Xen stack trace from rsp=ffff83005da27a10:(XEN) Xen stack trace from rsp=ffff83005da27a10:

(XEN)    0000000000000000 0000000000000065 ffff83005da27a50 ffff82d08037aafc
(XEN)    00000000fffffffe ffff82d08037ae14 0000000000000000 ffff83005da27a90
(XEN)    0000000000372660 000000046d2ef000 0000000393e91000 ffff82d0809602b0
(XEN)    000000fe00000000 ffff82d0802a3b98 ffffffffffffffff ffff83005da27ab8
(XEN)    ffff83005da27b08 ffff82d0802a3511 ffff82d08046b028 ffff83005da27b08
(XEN)    ffff82d0802a3511 ffff83005da27fff 0000138800000292 000082d0808176a0
(XEN)    0000000000000000 ffff82d08023b889 0000000000000292 ffff82d08046b028
(XEN)    ffff82d080451ac8 ffff82d080454af2 00000000000005a7 ffff83005da27b78
(XEN)    ffff82d080251d6f ffff82d080250fcd 0000000000000028 ffff83005da27b88
(XEN)    ffff83005da27b38 000000000000e010 ffff82d080454c73 ffff82d080451ac8
(XEN)    ffff82d080454af2 00000000000005a7 0000000000000030 ffff83005da27bf8
(XEN)    ffff82d080454c73 ffff83005da27be8 ffff82d0802aaebc ffff82d08033f3dc
(XEN)    ffff82d080451ac8 ffff82d08037d969 ffff82d08037d95d ffff82d08037d969
(XEN)    0b0f82d08037d95d ffff82d08037d969 ffff83005fe5b000 0000000000000000
(XEN)    0000000000000000 ffff83005da27fff 0000000000000000 00007cffa25d83e7
(XEN)    ffff82d08037da2d deadbeefdeadf00d ffff83018caf2530 ffff83005da27d38
(XEN)    ffff83040a492830 ffff83005da27cc8 ffff83040bab2880 0000000000000000
(XEN)    0000000000000000 deadbeefdeadf00d deadbeefdeadf00d 0000000000000000
(XEN)    0000000000000000 ffff830451835000 0000000000000000 ffff83040a492000
(XEN)    0000000600000000 ffff82d08033f3da 000000000000e008 0000000000010282

(XEN) Xen call trace:
(XEN) [<000000007bdb630c>] 000000007bdb630c
(XEN)
(XEN) Pagetable walk from 00000000ee138470:

(XEN)  L4[0x000] = 000000046d2ee063 ffffffffffffffff
(XEN)  L3[0x003] = 000000005da11063 ffffffffffffffff
(XEN)  L2[0x170] = 0000000000000000 ffffffffffffffff

(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) FATAL PAGE FAULT
(XEN) [error_code=0002]
(XEN) Faulting linear address: 00000000ee138470
(XEN) ****************************************
(XEN)
(XEN) Reboot in five seconds...

Quoted 6 lines
Quoted 2 lines

This one I'm not sure about. What does your introspection agent do at that point?

This crash is bizarre. Xen has most likely followed a corrupt function pointer, because none of Xen's .text section live just below the 2G boundary

It's reproducible and happens immediately after a successful call to xc_altp2m_set_domain_state to enable altp2m.

Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#11 lore raw
Quoted 59 lines
Quoted 59 lines
Quoted 58 lines
Quoted 47 lines

With the config fixed it boots but when I run DRAKVUF on the domain I get the following crash:

(XEN) ----[ Xen-4.12-unstable x86_64 debug=y Not tainted ]----
(XEN) CPU: 0
(XEN) RIP: e008:[<000000007bdb630c>] 000000007bdb630c
(XEN) RFLAGS: 0000000000010282 CONTEXT: hypervisor (d0v5)

(XEN) rax: 00000000ee138470   rbx: 0000000000000000   rcx: 000000008000b098
(XEN) rdx: 0000000000000cf8   rsi: 0000000000000000   rdi: 000000046d2ef000
(XEN) rbp: 0000000000000000   rsp: ffff83005da27a10   r8:  0000000000000cf8
(XEN) r9:  0000000000000cf8   r10: ffff83005da27ab8   r11: ffff83005da27a08
(XEN) r12: 0000000000000000   r13: 0000000000000000   r14: 0000000000000065
(XEN) r15: 00000000000005a7   cr0: 0000000080050033   cr4: 0000000000372660
(XEN) cr3: 000000046d2ef000   cr2: 00000000ee138470
(XEN) fsb: 00007fe46d97bbc0   gsb: ffff880467f40000   gss: 0000000000000000

(XEN) ds: 0000 es: 0000 fs: 0000 gs: 0000 ss: e010 cs: e008
(XEN) Xen code around <000000007bdb630c> (000000007bdb630c):
(XEN) 80 74 0b 05 70 84 00 00 <c7> 00 00 00 00 e0 80 3d 7a 34 00 00 00 75 64 48 (XEN) Xen stack trace from rsp=ffff83005da27a10:(XEN) Xen stack trace from rsp=ffff83005da27a10:

(XEN)    0000000000000000 0000000000000065 ffff83005da27a50 ffff82d08037aafc
(XEN)    00000000fffffffe ffff82d08037ae14 0000000000000000 ffff83005da27a90
(XEN)    0000000000372660 000000046d2ef000 0000000393e91000 ffff82d0809602b0
(XEN)    000000fe00000000 ffff82d0802a3b98 ffffffffffffffff ffff83005da27ab8
(XEN)    ffff83005da27b08 ffff82d0802a3511 ffff82d08046b028 ffff83005da27b08
(XEN)    ffff82d0802a3511 ffff83005da27fff 0000138800000292 000082d0808176a0
(XEN)    0000000000000000 ffff82d08023b889 0000000000000292 ffff82d08046b028
(XEN)    ffff82d080451ac8 ffff82d080454af2 00000000000005a7 ffff83005da27b78
(XEN)    ffff82d080251d6f ffff82d080250fcd 0000000000000028 ffff83005da27b88
(XEN)    ffff83005da27b38 000000000000e010 ffff82d080454c73 ffff82d080451ac8
(XEN)    ffff82d080454af2 00000000000005a7 0000000000000030 ffff83005da27bf8
(XEN)    ffff82d080454c73 ffff83005da27be8 ffff82d0802aaebc ffff82d08033f3dc
(XEN)    ffff82d080451ac8 ffff82d08037d969 ffff82d08037d95d ffff82d08037d969
(XEN)    0b0f82d08037d95d ffff82d08037d969 ffff83005fe5b000 0000000000000000
(XEN)    0000000000000000 ffff83005da27fff 0000000000000000 00007cffa25d83e7
(XEN)    ffff82d08037da2d deadbeefdeadf00d ffff83018caf2530 ffff83005da27d38
(XEN)    ffff83040a492830 ffff83005da27cc8 ffff83040bab2880 0000000000000000
(XEN)    0000000000000000 deadbeefdeadf00d deadbeefdeadf00d 0000000000000000
(XEN)    0000000000000000 ffff830451835000 0000000000000000 ffff83040a492000
(XEN)    0000000600000000 ffff82d08033f3da 000000000000e008 0000000000010282

(XEN) Xen call trace:
(XEN) [<000000007bdb630c>] 000000007bdb630c
(XEN)
(XEN) Pagetable walk from 00000000ee138470:

(XEN)  L4[0x000] = 000000046d2ee063 ffffffffffffffff
(XEN)  L3[0x003] = 000000005da11063 ffffffffffffffff
(XEN)  L2[0x170] = 0000000000000000 ffffffffffffffff
Quoted 9 lines

(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) FATAL PAGE FAULT
(XEN) [error_code=0002]
(XEN) Faulting linear address: 00000000ee138470
(XEN) ****************************************
(XEN)
(XEN) Reboot in five seconds...

This one I'm not sure about. What does your introspection agent do at that point?

Quoted 6 lines
Quoted 3 lines

This crash is bizarre. Xen has most likely followed a corrupt function pointer, because none of Xen's .text section live just below the 2G boundary

It's reproducible and happens immediately after a successful call to xc_altp2m_set_domain_state to enable altp2m.

That can't be all that's needed. I assure you I've tested this with much more that just calling xc_altp2m_set_domain_state() with no crashes at all. Something else must happen as well.

Could you write a simple C test application that does the minimum ammount of work needed to produce this crash?

Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#12 lore raw
Quoted 67 lines · Razvan Cojocaru
Quoted 60 lines
Quoted 60 lines
Quoted 59 lines
Quoted 48 lines

With the config fixed it boots but when I run DRAKVUF on the domain I get the following crash:

(XEN) ----[ Xen-4.12-unstable x86_64 debug=y Not tainted ]----
(XEN) CPU: 0
(XEN) RIP: e008:[<000000007bdb630c>] 000000007bdb630c
(XEN) RFLAGS: 0000000000010282 CONTEXT: hypervisor (d0v5)

(XEN) rax: 00000000ee138470   rbx: 0000000000000000   rcx: 000000008000b098
(XEN) rdx: 0000000000000cf8   rsi: 0000000000000000   rdi: 000000046d2ef000
(XEN) rbp: 0000000000000000   rsp: ffff83005da27a10   r8:  0000000000000cf8
(XEN) r9:  0000000000000cf8   r10: ffff83005da27ab8   r11: ffff83005da27a08
(XEN) r12: 0000000000000000   r13: 0000000000000000   r14: 0000000000000065
(XEN) r15: 00000000000005a7   cr0: 0000000080050033   cr4: 0000000000372660
(XEN) cr3: 000000046d2ef000   cr2: 00000000ee138470
(XEN) fsb: 00007fe46d97bbc0   gsb: ffff880467f40000   gss: 0000000000000000

(XEN) ds: 0000 es: 0000 fs: 0000 gs: 0000 ss: e010 cs: e008
(XEN) Xen code around <000000007bdb630c> (000000007bdb630c):
(XEN) 80 74 0b 05 70 84 00 00 <c7> 00 00 00 00 e0 80 3d 7a 34 00 00 00 75 64 48 (XEN) Xen stack trace from rsp=ffff83005da27a10:(XEN) Xen stack trace from rsp=ffff83005da27a10:

(XEN)    0000000000000000 0000000000000065 ffff83005da27a50 ffff82d08037aafc
(XEN)    00000000fffffffe ffff82d08037ae14 0000000000000000 ffff83005da27a90
(XEN)    0000000000372660 000000046d2ef000 0000000393e91000 ffff82d0809602b0
(XEN)    000000fe00000000 ffff82d0802a3b98 ffffffffffffffff ffff83005da27ab8
(XEN)    ffff83005da27b08 ffff82d0802a3511 ffff82d08046b028 ffff83005da27b08
(XEN)    ffff82d0802a3511 ffff83005da27fff 0000138800000292 000082d0808176a0
(XEN)    0000000000000000 ffff82d08023b889 0000000000000292 ffff82d08046b028
(XEN)    ffff82d080451ac8 ffff82d080454af2 00000000000005a7 ffff83005da27b78
(XEN)    ffff82d080251d6f ffff82d080250fcd 0000000000000028 ffff83005da27b88
(XEN)    ffff83005da27b38 000000000000e010 ffff82d080454c73 ffff82d080451ac8
(XEN)    ffff82d080454af2 00000000000005a7 0000000000000030 ffff83005da27bf8
(XEN)    ffff82d080454c73 ffff83005da27be8 ffff82d0802aaebc ffff82d08033f3dc
(XEN)    ffff82d080451ac8 ffff82d08037d969 ffff82d08037d95d ffff82d08037d969
(XEN)    0b0f82d08037d95d ffff82d08037d969 ffff83005fe5b000 0000000000000000
(XEN)    0000000000000000 ffff83005da27fff 0000000000000000 00007cffa25d83e7
(XEN)    ffff82d08037da2d deadbeefdeadf00d ffff83018caf2530 ffff83005da27d38
(XEN)    ffff83040a492830 ffff83005da27cc8 ffff83040bab2880 0000000000000000
(XEN)    0000000000000000 deadbeefdeadf00d deadbeefdeadf00d 0000000000000000
(XEN)    0000000000000000 ffff830451835000 0000000000000000 ffff83040a492000
(XEN)    0000000600000000 ffff82d08033f3da 000000000000e008 0000000000010282

(XEN) Xen call trace:
(XEN) [<000000007bdb630c>] 000000007bdb630c
(XEN)
(XEN) Pagetable walk from 00000000ee138470:

(XEN)  L4[0x000] = 000000046d2ee063 ffffffffffffffff
(XEN)  L3[0x003] = 000000005da11063 ffffffffffffffff
(XEN)  L2[0x170] = 0000000000000000 ffffffffffffffff
Quoted 9 lines

(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) FATAL PAGE FAULT
(XEN) [error_code=0002]
(XEN) Faulting linear address: 00000000ee138470
(XEN) ****************************************
(XEN)
(XEN) Reboot in five seconds...

This one I'm not sure about. What does your introspection agent do at that point?

Quoted 6 lines
Quoted 3 lines

This crash is bizarre. Xen has most likely followed a corrupt function pointer, because none of Xen's .text section live just below the 2G boundary

It's reproducible and happens immediately after a successful call to xc_altp2m_set_domain_state to enable altp2m.

Quoted 6 lines

That can't be all that's needed. I assure you I've tested this with much more that just calling xc_altp2m_set_domain_state() with no crashes at all. Something else must happen as well.

Could you write a simple C test application that does the minimum ammount of work needed to produce this crash?

Not the same error but another crash when just using xen-access with altp2m_exec:

(XEN) Assertion '!p2m->sync.logdirty_ranges' failed at p2m-ept.c:1447
(XEN) ----[ Xen-4.12-unstable x86_64 debug=y Not tainted ]----
(XEN) CPU: 7
(XEN) RIP: e008:[<ffff82d08033f3da>] p2m_init_altp2m_ept+0xf8/0x101
(XEN) RFLAGS: 0000000000010282 CONTEXT: hypervisor (d0v1)

(XEN) rax: 0000000000000000   rbx: ffff83044ff21880   rcx: 0000000000000000
(XEN) rdx: ffff830451aae000   rsi: 0000000000000000   rdi: ffff83044f500000
(XEN) rbp: ffff83046d237cc8   rsp: ffff83046d237ca8   r8:  deadbeefdeadf00d
(XEN) r9:  deadbeefdeadf00d   r10: 0000000000000000   r11: 0000000000000000
(XEN) r12: ffff83044f500830   r13: ffff83046d237d38   r14: ffff83018caf24a0
(XEN) r15: deadbeefdeadf00d   cr0: 0000000080050033   cr4: 0000000000372660
(XEN) cr3: 00000003b9719000   cr2: 00007ffcf624afb0
(XEN) fsb: 00007f31c4b1a140   gsb: ffff880467e40000   gss: 0000000000000000

(XEN) ds: 0000 es: 0000 fs: 0000 gs: 0000 ss: e010 cs: e008
(XEN) Xen code around <ffff82d08033f3da> (p2m_init_altp2m_ept+0xf8/0x101):
(XEN) 41 5c 41 5d 41 5e 5d c3 <0f> 0b b8 f4 ff ff ff eb ee 55 48 89 e5 53 48 83 (XEN) Xen stack trace from rsp=ffff83046d237ca8:

(XEN)    ffff83044f500000 ffff83044f500830 ffff83046d237d38 0000000000000000
(XEN)    ffff83046d237d08 ffff82d0803380be ffff83046d237ce8 ffff83044f500000
(XEN)    00007f31c4b36010 00000000ffffffff ffff82d0802fb4ab deadbeefdeadf00d
(XEN)    ffff83046d237d98 ffff82d0802f7efb ffff83046d237e48 ffff82d0802035ba
(XEN)    0000000400000001 0000000000000001 000000000003ffff 0000000000000000
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 0000000000000019 00007f31c4b36010
(XEN)    ffff83005fdfb000 ffff82d0802fb4ab ffff83046d237e48 ffff82d0802fc6f2
(XEN)    ffff83046d237fff ffff83005fdfb000 ffff83046d237dc8 ffff82d08036fe71
(XEN)    ffff83046d237e48 ffff82d08037512a 0000000600000001 0000000000000000
(XEN)    0000000000000202 00007f31c41ff5d7 ffff82d08037d444 ffff82d08037d438
(XEN)    ffff82d08037d444 ffff82d08037d438 ffff82d08037d444 ffff83046d237ef8
(XEN)    0000000000000022 ffff83005fdfb000 ffff82d0802fb4ab deadbeefdeadf00d
(XEN)    ffff83046d237ee8 ffff82d080374b07 02ff82d08037d444 0000000000000019
(XEN)    00007f31c4b36010 deadbeefdeadf00d deadbeefdeadf00d deadbeefdeadf00d
(XEN)    ffff82d08037d444 ffff82d08037d438 ffff82d08037d444 ffff82d08037d438
(XEN)    ffff82d08037d444 ffff82d08037d438 ffff82d08037d444 ffff83005fdfb000
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    00007cfb92dc80e7 ffff82d08037d4a2 00007ffcf624d6b0 0000000000305000
(XEN)    ffff880421adb400 00007ffcf624d6b0 ffffc90042c47e60 ffffffffffffffff
(XEN) Xen call trace:
(XEN)    [<ffff82d08033f3da>] p2m_init_altp2m_ept+0xf8/0x101
(XEN)    [<ffff82d0803380be>] p2m_init_next_altp2m+0x103/0x161
(XEN)    [<ffff82d0802f7efb>] hvm.c#do_altp2m_op+0x413/0x779
(XEN)    [<ffff82d0802fc6f2>] do_hvm_op+0x1247/0x1319
(XEN)    [<ffff82d080374b07>] pv_hypercall+0x1dc/0x4bb
(XEN)    [<ffff82d08037d4a2>] lstar_enter+0x112/0x120

(XEN)
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 7:
(XEN) Assertion '!p2m->sync.logdirty_ranges' failed at p2m-ept.c:1447 (XEN) ****************************************
(XEN)
(XEN) Reboot in five seconds...
(XEN) APIC error on CPU0: 40(00)

I had to rebase your branch on staging to get it to compile, other then that, I don't know why the crash is not happening on your side.

Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#14 lore raw
Quoted 6 lines · Razvan Cojocaru

Tamas, could you please give this a spin?

https://github.com/razvan-cojocaru/xen/tree/altp2m-logdirty-take2

It _should_ solve the crashes.

Indeed, I no longer see the crash. However, there might be some locking issue present because the whole system freezes up shortly after starting DRAKVUF on a domain - within a couple seconds. I mean Xen itself locks up: no response on the serial, dom0 screen frozen, etc.

Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#15 lore raw
Quoted 7 lines · Tamas K Lengyel
Quoted 5 lines · Razvan Cojocaru

Tamas, could you please give this a spin?

https://github.com/razvan-cojocaru/xen/tree/altp2m-logdirty-take2

Quoted 7 lines
Quoted 1 line

It _should_ solve the crashes.

Indeed, I no longer see the crash. However, there might be some locking issue present because the whole system freezes up shortly after starting DRAKVUF on a domain - within a couple seconds. I mean Xen itself locks up: no response on the serial, dom0 screen frozen, etc.

Do you have any type of log / backtrace / way I could reproduce it without Drakvuf? All the ways I've tested it were fine (including xen-access).

Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#16 lore raw
Quoted 17 lines · Razvan Cojocaru
Quoted 7 lines · Tamas K Lengyel
Quoted 5 lines · Razvan Cojocaru

Tamas, could you please give this a spin?

https://github.com/razvan-cojocaru/xen/tree/altp2m-logdirty-take2

Quoted 7 lines
Quoted 1 line

It _should_ solve the crashes.

Indeed, I no longer see the crash. However, there might be some locking issue present because the whole system freezes up shortly after starting DRAKVUF on a domain - within a couple seconds. I mean Xen itself locks up: no response on the serial, dom0 screen frozen, etc.

Quoted 3 lines

Do you have any type of log / backtrace / way I could reproduce it without Drakvuf? All the ways I've tested it were fine (including xen-access).

I don't have a standalone test that produces that error. With DRAKVUF it is easily reproducible though. If you have a Windows guest installed, setting up DRAKVUF should really not be much trouble. With xen-access it indeed doesn't lock up but since the guest is pretty much unresponsive during that test I can't verify whether the VGA issue is now resolved or not. Also the xen-access tests are fairly limited and don't use all aspects of altp2m.

Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#17 lore raw
Quoted 24 lines · Tamas K Lengyel
Quoted 17 lines · Razvan Cojocaru
Quoted 7 lines · Tamas K Lengyel
Quoted 5 lines · Razvan Cojocaru

Tamas, could you please give this a spin?

https://github.com/razvan-cojocaru/xen/tree/altp2m-logdirty-take2

Quoted 7 lines
Quoted 1 line

It _should_ solve the crashes.

Indeed, I no longer see the crash. However, there might be some locking issue present because the whole system freezes up shortly after starting DRAKVUF on a domain - within a couple seconds. I mean Xen itself locks up: no response on the serial, dom0 screen frozen, etc.

Quoted 3 lines

Do you have any type of log / backtrace / way I could reproduce it without Drakvuf? All the ways I've tested it were fine (including xen-access).

Quoted 8 lines

I don't have a standalone test that produces that error. With DRAKVUF it is easily reproducible though. If you have a Windows guest installed, setting up DRAKVUF should really not be much trouble. With xen-access it indeed doesn't lock up but since the guest is pretty much unresponsive during that test I can't verify whether the VGA issue is now resolved or not. Also the xen-access tests are fairly limited and don't use all aspects of altp2m.

What I see from the DRAKVUF log is that the last thing it prints is sending a vm_event response that both enables singlestepping and switches altp2m view. This looks to be consistent. It didn't matter if the guest had 1 or 2 vCPUs, the freeze occurs just the same. It's definitely racey because it doesn't happen right away, the system works as expected for a couple seconds.

Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#18 lore raw
Quoted 35 lines · Tamas K Lengyel
Quoted 24 lines · Tamas K Lengyel
Quoted 17 lines · Razvan Cojocaru
Quoted 7 lines · Tamas K Lengyel
Quoted 5 lines · Razvan Cojocaru

Tamas, could you please give this a spin?

https://github.com/razvan-cojocaru/xen/tree/altp2m-logdirty-take2

Quoted 7 lines
Quoted 1 line

It _should_ solve the crashes.

Indeed, I no longer see the crash. However, there might be some locking issue present because the whole system freezes up shortly after starting DRAKVUF on a domain - within a couple seconds. I mean Xen itself locks up: no response on the serial, dom0 screen frozen, etc.

Quoted 3 lines

Do you have any type of log / backtrace / way I could reproduce it without Drakvuf? All the ways I've tested it were fine (including xen-access).

Quoted 8 lines

I don't have a standalone test that produces that error. With DRAKVUF it is easily reproducible though. If you have a Windows guest installed, setting up DRAKVUF should really not be much trouble. With xen-access it indeed doesn't lock up but since the guest is pretty much unresponsive during that test I can't verify whether the VGA issue is now resolved or not. Also the xen-access tests are fairly limited and don't use all aspects of altp2m.

Quoted 6 lines

What I see from the DRAKVUF log is that the last thing it prints is sending a vm_event response that both enables singlestepping and switches altp2m view. This looks to be consistent. It didn't matter if the guest had 1 or 2 vCPUs, the freeze occurs just the same. It's definitely racey because it doesn't happen right away, the system works as expected for a couple seconds.

Right, I'll try to set up Drakvuf tomorrow. If it's a locking issue it should be in patch 3 - I don't see how the first two could cause a problem.

I did test the patches with both xen-access and our full introspection agent with no lockups, crashes, or display freezes but it would seem that you're using it somehow differently.

Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#19 lore raw
In reply to Tamas K Lengyel
Quoted 35 lines · Tamas K Lengyel
Quoted 24 lines · Tamas K Lengyel
Quoted 17 lines · Razvan Cojocaru
Quoted 7 lines · Tamas K Lengyel
Quoted 5 lines · Razvan Cojocaru

Tamas, could you please give this a spin?

https://github.com/razvan-cojocaru/xen/tree/altp2m-logdirty-take2

Quoted 7 lines
Quoted 1 line

It _should_ solve the crashes.

Indeed, I no longer see the crash. However, there might be some locking issue present because the whole system freezes up shortly after starting DRAKVUF on a domain - within a couple seconds. I mean Xen itself locks up: no response on the serial, dom0 screen frozen, etc.

Quoted 3 lines

Do you have any type of log / backtrace / way I could reproduce it without Drakvuf? All the ways I've tested it were fine (including xen-access).

Quoted 8 lines

I don't have a standalone test that produces that error. With DRAKVUF it is easily reproducible though. If you have a Windows guest installed, setting up DRAKVUF should really not be much trouble. With xen-access it indeed doesn't lock up but since the guest is pretty much unresponsive during that test I can't verify whether the VGA issue is now resolved or not. Also the xen-access tests are fairly limited and don't use all aspects of altp2m.

Quoted 6 lines

What I see from the DRAKVUF log is that the last thing it prints is sending a vm_event response that both enables singlestepping and switches altp2m view. This looks to be consistent. It didn't matter if the guest had 1 or 2 vCPUs, the freeze occurs just the same. It's definitely racey because it doesn't happen right away, the system works as expected for a couple seconds.

After having to install clang because my GCC couldn't build Drakvuf:

../../src/plugins/plugins.h:188:1: sorry, unimplemented: non-trivial designated initializers not supported

then rekall via pip, then having to mount my Windows disk to do "rekal peinfo", I finally gave up when "rekall fetch_pdb" couldn't find the debug files on the Microsoft server. :)

So if you could find a way to reproduce the issue with a simple libxc-based application alone (or at least with something libvmi-related, which I do have set up), I'd really appreciate it.

Or maybe try to hack around with patch no 3 of the series (for a start, just revert it and see if the problem persists - of course the display will freeze) and see if there's an easy fix?

Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#20 lore raw
Quoted 44 lines · Razvan Cojocaru
Quoted 35 lines · Tamas K Lengyel
Quoted 24 lines · Tamas K Lengyel
Quoted 17 lines · Razvan Cojocaru
Quoted 7 lines · Tamas K Lengyel
Quoted 5 lines · Razvan Cojocaru

Tamas, could you please give this a spin?

https://github.com/razvan-cojocaru/xen/tree/altp2m-logdirty-take2

Quoted 7 lines
Quoted 1 line

It _should_ solve the crashes.

Indeed, I no longer see the crash. However, there might be some locking issue present because the whole system freezes up shortly after starting DRAKVUF on a domain - within a couple seconds. I mean Xen itself locks up: no response on the serial, dom0 screen frozen, etc.

Quoted 3 lines

Do you have any type of log / backtrace / way I could reproduce it without Drakvuf? All the ways I've tested it were fine (including xen-access).

Quoted 8 lines

I don't have a standalone test that produces that error. With DRAKVUF it is easily reproducible though. If you have a Windows guest installed, setting up DRAKVUF should really not be much trouble. With xen-access it indeed doesn't lock up but since the guest is pretty much unresponsive during that test I can't verify whether the VGA issue is now resolved or not. Also the xen-access tests are fairly limited and don't use all aspects of altp2m.

Quoted 6 lines

What I see from the DRAKVUF log is that the last thing it prints is sending a vm_event response that both enables singlestepping and switches altp2m view. This looks to be consistent. It didn't matter if the guest had 1 or 2 vCPUs, the freeze occurs just the same. It's definitely racey because it doesn't happen right away, the system works as expected for a couple seconds.

Quoted 4 lines

After having to install clang because my GCC couldn't build Drakvuf:

../../src/plugins/plugins.h:188:1: sorry, unimplemented: non-trivial designated initializers not supported

Please follow the instruction for compiling it, clang is a requirement. I don't even know how you got pass the ./configure stage without clang being installed. You could also just copy-paste things from the travis script directly:
https://github.com/tklengyel/drakvuf/blob/master/.travis.yml#L51

Quoted 4 lines

then rekall via pip, then having to mount my Windows disk to do "rekal peinfo", I finally gave up when "rekall fetch_pdb" couldn't find the debug files on the Microsoft server. :)

If your version if Windows is that brand new then yes, Microsoft takes a couple days to publish their debug information and you will just have to wait or use an older version of Windows.

Quoted 8 lines

So if you could find a way to reproduce the issue with a simple libxc-based application alone (or at least with something libvmi-related, which I do have set up), I'd really appreciate it.

Or maybe try to hack around with patch no 3 of the series (for a start, just revert it and see if the problem persists - of course the display will freeze) and see if there's an easy fix?

Unfortunately I won't have time to do either of these any time soon. If you are having that much trouble setting it up I can perhaps send you a pre-compiled version with a version of Windows for which Microsoft already published the debug info for.

Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#21 lore raw
Quoted 71 lines · Tamas K Lengyel
Quoted 44 lines · Razvan Cojocaru
Quoted 35 lines · Tamas K Lengyel
Quoted 24 lines · Tamas K Lengyel
Quoted 17 lines · Razvan Cojocaru
Quoted 7 lines · Tamas K Lengyel
Quoted 5 lines · Razvan Cojocaru

Tamas, could you please give this a spin?

https://github.com/razvan-cojocaru/xen/tree/altp2m-logdirty-take2

Quoted 7 lines
Quoted 1 line

It _should_ solve the crashes.

Indeed, I no longer see the crash. However, there might be some locking issue present because the whole system freezes up shortly after starting DRAKVUF on a domain - within a couple seconds. I mean Xen itself locks up: no response on the serial, dom0 screen frozen, etc.

Quoted 3 lines

Do you have any type of log / backtrace / way I could reproduce it without Drakvuf? All the ways I've tested it were fine (including xen-access).

Quoted 8 lines

I don't have a standalone test that produces that error. With DRAKVUF it is easily reproducible though. If you have a Windows guest installed, setting up DRAKVUF should really not be much trouble. With xen-access it indeed doesn't lock up but since the guest is pretty much unresponsive during that test I can't verify whether the VGA issue is now resolved or not. Also the xen-access tests are fairly limited and don't use all aspects of altp2m.

Quoted 6 lines

What I see from the DRAKVUF log is that the last thing it prints is sending a vm_event response that both enables singlestepping and switches altp2m view. This looks to be consistent. It didn't matter if the guest had 1 or 2 vCPUs, the freeze occurs just the same. It's definitely racey because it doesn't happen right away, the system works as expected for a couple seconds.

Quoted 4 lines

After having to install clang because my GCC couldn't build Drakvuf:

../../src/plugins/plugins.h:188:1: sorry, unimplemented: non-trivial designated initializers not supported

Please follow the instruction for compiling it, clang is a requirement. I don't even know how you got pass the ./configure stage without clang being installed. You could also just copy-paste things from the travis script directly:
https://github.com/tklengyel/drakvuf/blob/master/.travis.yml#L51

Quoted 4 lines

then rekall via pip, then having to mount my Windows disk to do "rekal peinfo", I finally gave up when "rekall fetch_pdb" couldn't find the debug files on the Microsoft server. :)

If your version if Windows is that brand new then yes, Microsoft takes a couple days to publish their debug information and you will just have to wait or use an older version of Windows.

Quoted 5 lines

So if you could find a way to reproduce the issue with a simple libxc-based application alone (or at least with something libvmi-related, which I do have set up), I'd really appreciate it.

Quoted 8 lines
Quoted 3 lines

Or maybe try to hack around with patch no 3 of the series (for a start, just revert it and see if the problem persists - of course the display will freeze) and see if there's an easy fix?

Unfortunately I won't have time to do either of these any time soon. If you are having that much trouble setting it up I can perhaps send you a pre-compiled version with a version of Windows for which Microsoft already published the debug info for.

It's a Windows 7 x64 guest. But the problem was that the right command line is:

rekall fetch_pdb ntkrnlmp

instead of the suggested "rekall fetch_pdb ntkrpamp" on the drakvuf.com website.

I'll try to continue - in any case should I have more trouble I'll contact you privately so as not to spam the list. Just wanted to leave this here in case someone else has this problem in the hope that it's useful.

Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#22 lore raw
Quoted 82 lines · Razvan Cojocaru
Quoted 71 lines · Tamas K Lengyel
Quoted 44 lines · Razvan Cojocaru
Quoted 35 lines · Tamas K Lengyel
Quoted 24 lines · Tamas K Lengyel
Quoted 17 lines · Razvan Cojocaru
Quoted 7 lines · Tamas K Lengyel
Quoted 5 lines · Razvan Cojocaru

Tamas, could you please give this a spin?

https://github.com/razvan-cojocaru/xen/tree/altp2m-logdirty-take2

Quoted 7 lines
Quoted 1 line

It _should_ solve the crashes.

Indeed, I no longer see the crash. However, there might be some locking issue present because the whole system freezes up shortly after starting DRAKVUF on a domain - within a couple seconds. I mean Xen itself locks up: no response on the serial, dom0 screen frozen, etc.

Quoted 3 lines

Do you have any type of log / backtrace / way I could reproduce it without Drakvuf? All the ways I've tested it were fine (including xen-access).

Quoted 8 lines

I don't have a standalone test that produces that error. With DRAKVUF it is easily reproducible though. If you have a Windows guest installed, setting up DRAKVUF should really not be much trouble. With xen-access it indeed doesn't lock up but since the guest is pretty much unresponsive during that test I can't verify whether the VGA issue is now resolved or not. Also the xen-access tests are fairly limited and don't use all aspects of altp2m.

Quoted 6 lines

What I see from the DRAKVUF log is that the last thing it prints is sending a vm_event response that both enables singlestepping and switches altp2m view. This looks to be consistent. It didn't matter if the guest had 1 or 2 vCPUs, the freeze occurs just the same. It's definitely racey because it doesn't happen right away, the system works as expected for a couple seconds.

Quoted 4 lines

After having to install clang because my GCC couldn't build Drakvuf:

../../src/plugins/plugins.h:188:1: sorry, unimplemented: non-trivial designated initializers not supported

Please follow the instruction for compiling it, clang is a requirement. I don't even know how you got pass the ./configure stage without clang being installed. You could also just copy-paste things from the travis script directly:
https://github.com/tklengyel/drakvuf/blob/master/.travis.yml#L51

Quoted 4 lines

then rekall via pip, then having to mount my Windows disk to do "rekal peinfo", I finally gave up when "rekall fetch_pdb" couldn't find the debug files on the Microsoft server. :)

If your version if Windows is that brand new then yes, Microsoft takes a couple days to publish their debug information and you will just have to wait or use an older version of Windows.

Quoted 5 lines

So if you could find a way to reproduce the issue with a simple libxc-based application alone (or at least with something libvmi-related, which I do have set up), I'd really appreciate it.

Quoted 8 lines
Quoted 3 lines

Or maybe try to hack around with patch no 3 of the series (for a start, just revert it and see if the problem persists - of course the display will freeze) and see if there's an easy fix?

Unfortunately I won't have time to do either of these any time soon. If you are having that much trouble setting it up I can perhaps send you a pre-compiled version with a version of Windows for which Microsoft already published the debug info for.

Quoted 7 lines

It's a Windows 7 x64 guest. But the problem was that the right command line is:

rekall fetch_pdb ntkrnlmp

instead of the suggested "rekall fetch_pdb ntkrpamp" on the drakvuf.com website.

The kernel filename is specific to the version of Windows you have installed. The instructions specify _an example_ for the 32-bit version of Windows 7 and you will need to adjust it according to the kernel filename. For 64-bit it is ntkrnlmp. The instruction explicitly say that you need to use the PDB filename that was printed for your specific kernel version.

Quoted 5 lines

I'll try to continue - in any case should I have more trouble I'll contact you privately so as not to spam the list. Just wanted to leave this here in case someone else has this problem in the hope that it's useful.

Of course, also please feel free to open an issue on github if you run into something that's blocking you. Chances are if you run into it, others would too :)

Thanks,
Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#23 lore raw
Quoted 101 lines · Tamas K Lengyel
Quoted 82 lines · Razvan Cojocaru
Quoted 71 lines · Tamas K Lengyel
Quoted 44 lines · Razvan Cojocaru
Quoted 35 lines · Tamas K Lengyel
Quoted 24 lines · Tamas K Lengyel
Quoted 17 lines · Razvan Cojocaru
Quoted 7 lines · Tamas K Lengyel
Quoted 5 lines · Razvan Cojocaru

Tamas, could you please give this a spin?

https://github.com/razvan-cojocaru/xen/tree/altp2m-logdirty-take2

Quoted 7 lines
Quoted 1 line

It _should_ solve the crashes.

Indeed, I no longer see the crash. However, there might be some locking issue present because the whole system freezes up shortly after starting DRAKVUF on a domain - within a couple seconds. I mean Xen itself locks up: no response on the serial, dom0 screen frozen, etc.

Quoted 3 lines

Do you have any type of log / backtrace / way I could reproduce it without Drakvuf? All the ways I've tested it were fine (including xen-access).

Quoted 8 lines

I don't have a standalone test that produces that error. With DRAKVUF it is easily reproducible though. If you have a Windows guest installed, setting up DRAKVUF should really not be much trouble. With xen-access it indeed doesn't lock up but since the guest is pretty much unresponsive during that test I can't verify whether the VGA issue is now resolved or not. Also the xen-access tests are fairly limited and don't use all aspects of altp2m.

Quoted 6 lines

What I see from the DRAKVUF log is that the last thing it prints is sending a vm_event response that both enables singlestepping and switches altp2m view. This looks to be consistent. It didn't matter if the guest had 1 or 2 vCPUs, the freeze occurs just the same. It's definitely racey because it doesn't happen right away, the system works as expected for a couple seconds.

Quoted 4 lines

After having to install clang because my GCC couldn't build Drakvuf:

../../src/plugins/plugins.h:188:1: sorry, unimplemented: non-trivial designated initializers not supported

Please follow the instruction for compiling it, clang is a requirement. I don't even know how you got pass the ./configure stage without clang being installed. You could also just copy-paste things from the travis script directly:
https://github.com/tklengyel/drakvuf/blob/master/.travis.yml#L51

Quoted 4 lines

then rekall via pip, then having to mount my Windows disk to do "rekal peinfo", I finally gave up when "rekall fetch_pdb" couldn't find the debug files on the Microsoft server. :)

If your version if Windows is that brand new then yes, Microsoft takes a couple days to publish their debug information and you will just have to wait or use an older version of Windows.

Quoted 5 lines

So if you could find a way to reproduce the issue with a simple libxc-based application alone (or at least with something libvmi-related, which I do have set up), I'd really appreciate it.

Quoted 8 lines
Quoted 3 lines

Or maybe try to hack around with patch no 3 of the series (for a start, just revert it and see if the problem persists - of course the display will freeze) and see if there's an easy fix?

Unfortunately I won't have time to do either of these any time soon. If you are having that much trouble setting it up I can perhaps send you a pre-compiled version with a version of Windows for which Microsoft already published the debug info for.

Quoted 7 lines

It's a Windows 7 x64 guest. But the problem was that the right command line is:

rekall fetch_pdb ntkrnlmp

instead of the suggested "rekall fetch_pdb ntkrpamp" on the drakvuf.com website.

The kernel filename is specific to the version of Windows you have installed. The instructions specify _an example_ for the 32-bit version of Windows 7 and you will need to adjust it according to the kernel filename. For 64-bit it is ntkrnlmp. The instruction explicitly say that you need to use the PDB filename that was printed for your specific kernel version.

Quoted 1 line
Quoted 8 lines
Quoted 4 lines

I'll try to continue - in any case should I have more trouble I'll contact you privately so as not to spam the list. Just wanted to leave this here in case someone else has this problem in the hope that it's useful.

Of course, also please feel free to open an issue on github if you run into something that's blocking you. Chances are if you run into it, others would too :)

We can chalk the freeze issue up to buggy hardware on my side. We couldn't reproduce the issue on two other systems. The screen issue is definitely gone now which is awesome! :) Thanks Razvan!

Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#24 lore raw
Quoted 108 lines · Tamas K Lengyel
Quoted 106 lines · Tamas K Lengyel
Quoted 82 lines · Razvan Cojocaru
Quoted 71 lines · Tamas K Lengyel
Quoted 44 lines · Razvan Cojocaru
Quoted 35 lines · Tamas K Lengyel
Quoted 24 lines · Tamas K Lengyel
Quoted 17 lines · Razvan Cojocaru
Quoted 7 lines · Tamas K Lengyel
Quoted 5 lines · Razvan Cojocaru

Tamas, could you please give this a spin?

https://github.com/razvan-cojocaru/xen/tree/altp2m-logdirty-take2

Quoted 7 lines
Quoted 1 line

It _should_ solve the crashes.

Indeed, I no longer see the crash. However, there might be some locking issue present because the whole system freezes up shortly after starting DRAKVUF on a domain - within a couple seconds. I mean Xen itself locks up: no response on the serial, dom0 screen frozen, etc.

Quoted 3 lines

Do you have any type of log / backtrace / way I could reproduce it without Drakvuf? All the ways I've tested it were fine (including xen-access).

Quoted 8 lines

I don't have a standalone test that produces that error. With DRAKVUF it is easily reproducible though. If you have a Windows guest installed, setting up DRAKVUF should really not be much trouble. With xen-access it indeed doesn't lock up but since the guest is pretty much unresponsive during that test I can't verify whether the VGA issue is now resolved or not. Also the xen-access tests are fairly limited and don't use all aspects of altp2m.

Quoted 6 lines

What I see from the DRAKVUF log is that the last thing it prints is sending a vm_event response that both enables singlestepping and switches altp2m view. This looks to be consistent. It didn't matter if the guest had 1 or 2 vCPUs, the freeze occurs just the same. It's definitely racey because it doesn't happen right away, the system works as expected for a couple seconds.

Quoted 4 lines

After having to install clang because my GCC couldn't build Drakvuf:

../../src/plugins/plugins.h:188:1: sorry, unimplemented: non-trivial designated initializers not supported

Please follow the instruction for compiling it, clang is a requirement. I don't even know how you got pass the ./configure stage without clang being installed. You could also just copy-paste things from the travis script directly:
https://github.com/tklengyel/drakvuf/blob/master/.travis.yml#L51

Quoted 4 lines

then rekall via pip, then having to mount my Windows disk to do "rekal peinfo", I finally gave up when "rekall fetch_pdb" couldn't find the debug files on the Microsoft server. :)

If your version if Windows is that brand new then yes, Microsoft takes a couple days to publish their debug information and you will just have to wait or use an older version of Windows.

Quoted 5 lines

So if you could find a way to reproduce the issue with a simple libxc-based application alone (or at least with something libvmi-related, which I do have set up), I'd really appreciate it.

Quoted 8 lines
Quoted 3 lines

Or maybe try to hack around with patch no 3 of the series (for a start, just revert it and see if the problem persists - of course the display will freeze) and see if there's an easy fix?

Unfortunately I won't have time to do either of these any time soon. If you are having that much trouble setting it up I can perhaps send you a pre-compiled version with a version of Windows for which Microsoft already published the debug info for.

Quoted 7 lines

It's a Windows 7 x64 guest. But the problem was that the right command line is:

rekall fetch_pdb ntkrnlmp

instead of the suggested "rekall fetch_pdb ntkrpamp" on the drakvuf.com website.

The kernel filename is specific to the version of Windows you have installed. The instructions specify _an example_ for the 32-bit version of Windows 7 and you will need to adjust it according to the kernel filename. For 64-bit it is ntkrnlmp. The instruction explicitly say that you need to use the PDB filename that was printed for your specific kernel version.

Quoted 5 lines

I'll try to continue - in any case should I have more trouble I'll contact you privately so as not to spam the list. Just wanted to leave this here in case someone else has this problem in the hope that it's useful.

Quoted 7 lines
Quoted 3 lines

Of course, also please feel free to open an issue on github if you run into something that's blocking you. Chances are if you run into it, others would too :)

We can chalk the freeze issue up to buggy hardware on my side. We couldn't reproduce the issue on two other systems. The screen issue is definitely gone now which is awesome! :) Thanks Razvan!

No problem, thank you for testing! And I'm competent with Drakvuf now. :)

Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel