From: Julien Grall <julien.grall@linaro.org>
To: Frediano Ziglio <freddy77@gmail.com>
Cc: Tim Deegan <tim@xen.org>,
Stefano Stabellini <stefano.stabellini@citrix.com>,
Ian Campbell <Ian.Campbell@citrix.com>,
xen-devel@lists.xen.org
Subject: Re: [PATCH v2] xen/arm: dump guest stack even if not the current VCPU
Date: Wed, 22 Oct 2014 13:56:41 +0100 [thread overview]
Message-ID: <5447A989.3000503@linaro.org> (raw)
In-Reply-To: <CAHt6W4dmH0Xee_dQuEyOSTCzR9JT3SAuSPk3L2L=LXXjLmTV6A@mail.gmail.com>
Hi Frediano,
On 10/22/2014 11:05 AM, Frediano Ziglio wrote:
> 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 | 14 +++++++++++++-
> xen/arch/arm/traps.c | 2 +-
> 2 files changed, 14 insertions(+), 2 deletions(-)
>
> Changes from v1:
> - disable IRQ if different domain (as suggested by Julien Grall)
If you want this patch applied for Xen 4.5, you need to explain why it
will be useful and what are the drawbacks.
Though, I'd like to see this patch for Xen 4.5 so... The function
get_page_from_gva is used in hotpath (see arch/arm/guestcopy.c) but
always with the current domain. The function will be used with another
domain than current only when the stack of the guest will be dumped. The
code added is self-containted.
(Can you keep this explanation or write your own in case you want this
for Xen 4.5).
>
> diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
> index 1585d35..6956eab 100644
> --- a/xen/arch/arm/p2m.c
> +++ b/xen/arch/arm/p2m.c
> @@ -1177,8 +1177,13 @@ struct page_info *get_page_from_gva(struct
> domain *d, vaddr_t va,
> struct p2m_domain *p2m = &d->arch.p2m;
> struct page_info *page = NULL;
> paddr_t maddr;
> + unsigned long irq_flags = 0;
>
> - ASSERT(d == current->domain);
> + if ( unlikely(d != current->domain) )
> + {
> + local_irq_save(irq_flags);
> + p2m_load_VTTBR(d);
> + }
>
> spin_lock(&p2m->lock);
I though a bit more about the code path. I would first take the lock,
then switch to the VTTBR and disable IRQ if necessary.
This would avoid to disable the IRQ for a long time if the lock is
already taken.
Regards,
--
Julien Grall
next prev parent reply other threads:[~2014-10-22 12:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-22 10:05 [PATCH v2] xen/arm: dump guest stack even if not the current VCPU Frediano Ziglio
2014-10-22 12:56 ` Julien Grall [this message]
2014-10-22 20:28 ` Konrad Rzeszutek Wilk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5447A989.3000503@linaro.org \
--to=julien.grall@linaro.org \
--cc=Ian.Campbell@citrix.com \
--cc=freddy77@gmail.com \
--cc=stefano.stabellini@citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.