All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen/arm: dump guest stack even if not the current VCPU
@ 2014-10-20 15:39 Frediano Ziglio
  2014-10-20 17:42 ` Julien Grall
  0 siblings, 1 reply; 2+ messages in thread
From: Frediano Ziglio @ 2014-10-20 15:39 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Stefano Stabellini, Julien Grall, Tim Deegan, xen-devel

From: Frediano Ziglio <frediano.ziglio@huawei.com>

If show_guest_stack was called from Xen context (for instance hitting
'0' key on Xen console) get_page_from_gva was not able to get the
page returning NULL.
Detecting different domain and changing VTTBR register make
get_page_from_gva works for different domains.

Signed-off-by: Frediano Ziglio <frediano.ziglio@huawei.com>
---
 xen/arch/arm/p2m.c   | 7 ++++++-
 xen/arch/arm/traps.c | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

Tested manually on a D01 board. I actually have only dom0 so EL1 is
already pointing to the right domain. I have some doubt about the
is_idle_domain test inside p2m_load_VTTBR.
I used the "unlikely" to avoid decreasing performances on the normal
cases, I'm fine if you remove them.

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 1585d35..cf872fc 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1178,7 +1178,8 @@ struct page_info *get_page_from_gva(struct
domain *d, vaddr_t va,
     struct page_info *page = NULL;
     paddr_t maddr;

-    ASSERT(d == current->domain);
+    if ( unlikely(d != current->domain) )
+        p2m_load_VTTBR(d);

     spin_lock(&p2m->lock);

@@ -1196,6 +1197,10 @@ struct page_info *get_page_from_gva(struct
domain *d, vaddr_t va,

 err:
     spin_unlock(&p2m->lock);
+
+    if ( unlikely(d != current->domain) )
+        p2m_load_VTTBR(current->domain);
+
     return page;
 }

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index f6fc8f8..4c93250 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -892,7 +892,7 @@ static void show_guest_stack(struct vcpu *v,
struct cpu_user_regs *regs)
         return;
     }

-    page = get_page_from_gva(current->domain, sp, GV2M_READ);
+    page = get_page_from_gva(v->domain, sp, GV2M_READ);
     if ( page == NULL )
     {
         printk("Failed to convert stack to physical address\n");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-20 17:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-20 15:39 [PATCH] xen/arm: dump guest stack even if not the current VCPU Frediano Ziglio
2014-10-20 17:42 ` Julien Grall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.