From patchwork Mon Oct 20 15:39:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frediano Ziglio X-Patchwork-Id: 39051 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 82788203C5 for ; Mon, 20 Oct 2014 15:41:08 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id b57sf2760150eek.8 for ; Mon, 20 Oct 2014 08:41:07 -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=FKD2cytzLg+gaqkOJluskR2o3YIvFCxvrSO5bMi32Po=; b=W53EIEUq7SMhpBXn/czcfVZ6RRHlNFmiYDCKLLsbtQcCKF52hzXW52FeSvT5SQZ+rx J3upgdnAPDA474X+2vtvFhXVJ8QfkodM1W3p+rPHqYJgnO8oYJ06iZXDCWFT/0hljPpj imOdLm6L12wF4yOTX4kRsbStXUrG3SrpJkstlZgLgyFFEsoITjSp6EreNn8LCatrhS7K 85ANAGsgVU614N4100TJ7KlA1xqD0SVmInQu6IbVd2WncYvD1b62NldqjMPH68G7txFX yQLpkQqvpTLwlQkbIcVIN3zY+KAJf2ppgs4/cpFFvluMzCKqB1aXM3lpzlbjy89XVOi0 3V3Q== X-Gm-Message-State: ALoCoQm/eIQ8oGiFLXc7FXVTi/KjvEWPLAijmBYD95s24hB18EWZuP+ZRTt0161h0u7q2e1MaJE/ X-Received: by 10.194.178.163 with SMTP id cz3mr4148152wjc.1.1413819667524; Mon, 20 Oct 2014 08:41:07 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.199 with SMTP id u7ls452095lau.10.gmail; Mon, 20 Oct 2014 08:41:07 -0700 (PDT) X-Received: by 10.152.121.68 with SMTP id li4mr27743215lab.77.1413819667262; Mon, 20 Oct 2014 08:41:07 -0700 (PDT) Received: from mail-lb0-x235.google.com (mail-lb0-x235.google.com. [2a00:1450:4010:c04::235]) by mx.google.com with ESMTPS id jo7si7015770lbc.39.2014.10.20.08.41.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 20 Oct 2014 08:41:06 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::235 as permitted sender) client-ip=2a00:1450:4010:c04::235; Received: by mail-lb0-f181.google.com with SMTP id l4so4062895lbv.26 for ; Mon, 20 Oct 2014 08:41:06 -0700 (PDT) X-Received: by 10.112.167.38 with SMTP id zl6mr28260519lbb.34.1413819666313; Mon, 20 Oct 2014 08:41:06 -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 c5csp329903lbz; Mon, 20 Oct 2014 08:41:05 -0700 (PDT) X-Received: by 10.53.12.232 with SMTP id et8mr1422548vdd.91.1413819664859; Mon, 20 Oct 2014 08:41:04 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id zr2si5419457vdb.21.2014.10.20.08.41.04 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 20 Oct 2014 08:41:04 -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 1XgF33-00061B-4U; Mon, 20 Oct 2014 15:39:05 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XgF31-000616-9X for xen-devel@lists.xen.org; Mon, 20 Oct 2014 15:39:03 +0000 Received: from [85.158.143.35] by server-2.bemta-4.messagelabs.com id B3/61-10419-69C25445; Mon, 20 Oct 2014 15:39:02 +0000 X-Env-Sender: freddy77@gmail.com X-Msg-Ref: server-9.tower-21.messagelabs.com!1413819541!12001850!1 X-Originating-IP: [209.85.220.177] 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 17182 invoked from network); 20 Oct 2014 15:39:02 -0000 Received: from mail-vc0-f177.google.com (HELO mail-vc0-f177.google.com) (209.85.220.177) by server-9.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 20 Oct 2014 15:39:02 -0000 Received: by mail-vc0-f177.google.com with SMTP id hq11so3735567vcb.36 for ; Mon, 20 Oct 2014 08:39:00 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.221.36.73 with SMTP id sz9mr12916142vcb.17.1413819540783; Mon, 20 Oct 2014 08:39:00 -0700 (PDT) Received: by 10.52.160.129 with HTTP; Mon, 20 Oct 2014 08:39:00 -0700 (PDT) Date: Mon, 20 Oct 2014 16:39:00 +0100 Message-ID: From: Frediano Ziglio To: Ian Campbell Cc: Stefano Stabellini , Julien Grall , Tim Deegan , xen-devel@lists.xen.org Subject: [Xen-devel] [PATCH] 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:c04::235 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 | 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. 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..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 ) {