From patchwork Wed Oct 22 10:05:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frediano Ziglio X-Patchwork-Id: 39261 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9A5C7202DB for ; Wed, 22 Oct 2014 10:09:50 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id d1sf448619wiv.10 for ; Wed, 22 Oct 2014 03:09:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:date:message-id:from :to:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive :content-type:content-transfer-encoding; bh=ssqcTTYCh9WFwJzUjFGN2+QmOMDp+jlVGtDPeVN/pyI=; b=mgMZ5n3vpJrkLP0FUSKwiQFWd2GWT4YXCAHBgmFA0YAvvN0pZbKDXZDWbD5tPi9Gd/ 6GHRr6tmgL4pB/mjMSAXktSMq7c15z7Rf5tzoaZUV4f1AFuzYuHJDFRJkfok4lYBfOl4 hQFciO9mV00F23JO9LDFesclzkWgT4N+bJW82XpbANpdkk79oCaVCFKvpt1gS3oXf2ws rkLq/5bY8Jk2KjzLVJ3qaBM6dcYuYrhCuPpR9x1sGPfP8+DIEcYN7XUFM7bBwCmcDWdi kjcDWEKIDzj9HBhxC6A4+UgkzXjQ4Nv1RaPsUEnsQcSYeO3u3XGRGyJmS0798wfMw3n5 Un5g== X-Gm-Message-State: ALoCoQlkElkl2NNEeiMbS7Vm3nq/2rwzR6qVZM2va2smasy0QbCAv52sTVxzvDIs/Lc/9pGNJ998 X-Received: by 10.180.19.198 with SMTP id h6mr4684321wie.5.1413972589846; Wed, 22 Oct 2014 03:09:49 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.9 with SMTP id o9ls147235lao.97.gmail; Wed, 22 Oct 2014 03:09:49 -0700 (PDT) X-Received: by 10.112.247.43 with SMTP id yb11mr40759862lbc.51.1413972589680; Wed, 22 Oct 2014 03:09:49 -0700 (PDT) Received: from mail-la0-x22f.google.com (mail-la0-x22f.google.com. [2a00:1450:4010:c03::22f]) by mx.google.com with ESMTPS id r3si16592892lar.133.2014.10.22.03.09.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Oct 2014 03:09:49 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22f as permitted sender) client-ip=2a00:1450:4010:c03::22f; Received: by mail-la0-f47.google.com with SMTP id pv20so2589778lab.6 for ; Wed, 22 Oct 2014 03:09:49 -0700 (PDT) X-Received: by 10.112.189.10 with SMTP id ge10mr40282902lbc.23.1413972589576; Wed, 22 Oct 2014 03:09:49 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp42558lbz; Wed, 22 Oct 2014 03:09:48 -0700 (PDT) X-Received: by 10.50.164.194 with SMTP id ys2mr4192223igb.43.1413972588061; Wed, 22 Oct 2014 03:09:48 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id u1si20605360icw.52.2014.10.22.03.09.47 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 22 Oct 2014 03:09:48 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Xgsnp-0000fX-8D; Wed, 22 Oct 2014 10:06:01 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Xgsno-0000fS-4L for xen-devel@lists.xen.org; Wed, 22 Oct 2014 10:06:00 +0000 Received: from [193.109.254.147:9735] by server-6.bemta-14.messagelabs.com id 4D/3C-01867-78187445; Wed, 22 Oct 2014 10:05:59 +0000 X-Env-Sender: freddy77@gmail.com X-Msg-Ref: server-10.tower-27.messagelabs.com!1413972357!11783512!1 X-Originating-IP: [209.85.220.171] X-SpamReason: No, hits=0.3 required=7.0 tests=RCVD_BY_IP X-StarScan-Received: X-StarScan-Version: 6.12.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 27485 invoked from network); 22 Oct 2014 10:05:58 -0000 Received: from mail-vc0-f171.google.com (HELO mail-vc0-f171.google.com) (209.85.220.171) by server-10.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 22 Oct 2014 10:05:58 -0000 Received: by mail-vc0-f171.google.com with SMTP id hy10so1719009vcb.16 for ; Wed, 22 Oct 2014 03:05:57 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.220.14.194 with SMTP id h2mr34997889vca.9.1413972357435; Wed, 22 Oct 2014 03:05:57 -0700 (PDT) Received: by 10.52.160.129 with HTTP; Wed, 22 Oct 2014 03:05:57 -0700 (PDT) Date: Wed, 22 Oct 2014 11:05:57 +0100 Message-ID: From: Frediano Ziglio To: Julien Grall Cc: Tim Deegan , Stefano Stabellini , Ian Campbell , xen-devel@lists.xen.org Subject: [Xen-devel] [PATCH v2] xen/arm: dump guest stack even if not the current VCPU X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Original-Sender: freddy77@gmail.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22f as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: From: Frediano Ziglio 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 --- 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) printk("Failed to convert stack to physical address\n"); 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); @@ -1196,6 +1201,13 @@ 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); + local_irq_restore(irq_flags); + } + 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 ) {