From patchwork Wed Nov 15 19:34:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 118994 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp3885468edl; Wed, 15 Nov 2017 11:36:35 -0800 (PST) X-Google-Smtp-Source: AGs4zMYhJ4KmfNEMQDrBx0pwPi/2xMRdT3nbs0g86inY6wnw+fUuuY8hLxgNrfXlf1GItoEqvCTF X-Received: by 10.107.204.1 with SMTP id c1mr2469235iog.76.1510774594950; Wed, 15 Nov 2017 11:36:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510774594; cv=none; d=google.com; s=arc-20160816; b=bNC5BRn9cusimx0ErdO4YFeEMik+d3SQ2AeXMJtL+3ShN/LDrTXKAj/v3Ah1zLpcIO 8y5OnC1UNFTZgWBlGiA3h6B06I9Qfh+tr1bhXlb19sADDIYXtxc1eV3b68clxYj7Iu2t Xy0jv9J9fds/1dy9lSj8Zknz+Xcfya6JNZjxZEYO9Ac36f686R+QvKmq8hxOe0xgReHN GgM/mMZi5x4p7IVcAb6VSy/rr8elgETAUHq8pwZqNleUfLvpclantufcCLct6V1UGGP5 Nwzm1V6liugV954jGjCM1+R0bF7aqgcOKaGTNhADCHYP8luGvq/nRZTIMK7yjIV8xArt ZYTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=qKL+hto7G5XSFRp4DV0ePM//Dp+shZjcfDH+LXoR+4E=; b=IcIw+bohJFLAtTAbxU4vpOkytphgx0aqsy4DdGKE2rbn8wzWMiSzTWIulE58+1gKN9 52jCky8ND7NiEWfAnwfoQkRnhQrzoiyFu+pNL+BfjZStMCkBtGmWDr/i0gKm2nBkkLaF equ2ChTslHtMJhDF5xSKtK5y/U3yQtkcPIoTrD+TuEzsig8y8Cq4P102icPdtNvP99gq vwya2Zw7TcptscFSDuP6nD3MsNkm+wkYZzgRPfQjWLFPwEA6rXbAqI81ESU6UUWmuFil FPsgUBI4UCUQBYdZ+lK7c5zy8bRzBrBTsc9nOqZx4ybHbJO34uKTV3/H5FK7809dsByj pEGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=kEjJPJWO; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id c3si15638599iob.93.2017.11.15.11.36.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Nov 2017 11:36:34 -0800 (PST) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=kEjJPJWO; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eF3S1-0006Tf-UN; Wed, 15 Nov 2017 19:34:21 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eF3S1-0006TM-6R for xen-devel@lists.xen.org; Wed, 15 Nov 2017 19:34:21 +0000 Received: from [85.158.137.68] by server-8.bemta-3.messagelabs.com id 72/B3-00983-CB69C0A5; Wed, 15 Nov 2017 19:34:20 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRWlGSWpSXmKPExsXiVRvkpLt7Gk+ UwYceE4slHxezODB6HN39mymAMYo1My8pvyKBNePbl1WsBRPkKnZse83SwHhSrIuRi0NIYCKj RPOLmewgDovAPGaJK8tvsoA4EgL9rBKTzl4BynACOXkSh6ddZoWw0yTmnV7HBmFXSay/PB2og QNolJrEmjdREFP7mCQWdq5hAomzCehIrJtRC1IuIiAtce3zZUYQm1nAWeLdpC8sILawQIjE2b UdYHEWAVWJA0s/ga3iFbCWuP14FTPEKnmJXW0XWUFGcgrYSJw5HAwSFgIqmbRlNdMERsEFjAy rGDWKU4vKUot0jUz0kooy0zNKchMzc3QNDYz1clOLixPTU3MSk4r1kvNzNzECw62egYFxB+Or 436HGCU5mJREeZ1/c0cJ8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuA9OJUnSkiwKDU9tSItMwcY+ DBpCQ4eJRHeUJA0b3FBYm5xZjpE6hSjJce+Pbf+MHE8m/m6gZlj2tXWJmYhlrz8vFQpcd4OkA YBkIaM0jy4cbDovMQoKyXMy8jAwCDEU5BalJtZgir/ilGcg1FJmHcayBSezLwSuK2vgA5iAjr I5gY3yEEliQgpqQZGK4O+ZEeF3Rxx86oXHXVpWCLUeja9bn90sUatwq6WP02TLD76WQebcuTr C195cOWw/hv++ILm11Uffk9Yd8ymTs7D7V7vyQOnl83+rlLrmTRj3p69s1+rHOd47ah6cUuaZ 6peEZeQGqPgfcdfi9frei4/5mD32+DsNJ65sqkzfjFfX/VFp+OKEktxRqKhFnNRcSIA4Wc9S8 kCAAA= X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-7.tower-31.messagelabs.com!1510774459!107581650!1 X-Originating-IP: [74.125.82.66] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 40637 invoked from network); 15 Nov 2017 19:34:19 -0000 Received: from mail-wm0-f66.google.com (HELO mail-wm0-f66.google.com) (74.125.82.66) by server-7.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 15 Nov 2017 19:34:19 -0000 Received: by mail-wm0-f66.google.com with SMTP id b189so5191330wmd.0 for ; Wed, 15 Nov 2017 11:34:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3GonYT1RUyJUB5kRjdyEukSpzHjgTSgOBgh6QL/VeaU=; b=kEjJPJWOko3BXboDkMvlj2s5Tf9VYXmxC2IxRsX9C0naGyrx2PIRNGy3L8Jm50INWK QhRtTSjcRxJJ1PZr/AyGQcFGIMp7mQ0XjJvJHu3R4ZdcBU52BwCdGqeNt1t5lPm9biWk EZ3bEJzQqSaSHJAf8YPcSC8qgridqhOQ5d8Og= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3GonYT1RUyJUB5kRjdyEukSpzHjgTSgOBgh6QL/VeaU=; b=IRvlAM46StlHNYUbTvBbSk0t4Vz90ROMvFCEHvpLjSl+XYsmHMDd9H4Cv4b0KauUXH 7DpFH+XD5jB4Sa8PTzwFhd7WvKCFNzneJ5Cd584/ziAjfNTmcvGmbdPig+yUgcU/ytHo Dtk6tsoBVE0gClQoMbUk9RXe5PgMkxXvFXwO+Of3PIbOEj5yCJtls/Deezg4vHAr2VZp m+Lzo6jSyWeEz4qT7RiB5iCB9naakSaPC11ueaN6+IZoxNbzl4EzyZuVe3vXGJZn491i 0iETCzFkwwE+tsZErVtzS5XO6fz3uNuYONSpzt6YGE3yeZ89iYpQdd0HECeM6QsThyuL 5g6Q== X-Gm-Message-State: AJaThX6UkYRxnZ/66C/1inUc0bN+tzXaNBjcWgpitOM2rccD7Mk2mLIB 8ShVz9YTm8Vnyx1/d1LQ2MPPnT8PG/0= X-Received: by 10.28.66.215 with SMTP id k84mr13338764wmi.143.1510774459215; Wed, 15 Nov 2017 11:34:19 -0800 (PST) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id x63sm18534330wma.39.2017.11.15.11.34.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Nov 2017 11:34:18 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 15 Nov 2017 19:34:13 +0000 Message-Id: <20171115193414.7678-2-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171115193414.7678-1-julien.grall@linaro.org> References: <20171115193414.7678-1-julien.grall@linaro.org> Cc: sstabellini@kernel.org, Julien Grall Subject: [Xen-devel] [PATCH for-4.10 1/2] xen/arm: mm: Change the return value of gvirt_to_maddr X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" Currently, gvirt_to_maddr return -EFAULT when the translation failed. It might be useful to return the PAR_EL1 (Physical Address Register) in such a case to get a better idea of the reason. So modify the return value to use 0 on sucess or return the PAR on failure. The callers are modified to reflect the change of the return value. Note that with the change in gvirt_to_maddr, ma needs to be initialized to avoid GCC been confused (i.e value may be unitialized) with the new construction. Signed-off-by: Julien Grall Acked-by: Stefano Stabellini --- xen/arch/arm/domain_build.c | 8 ++++---- xen/arch/arm/kernel.c | 8 ++++---- xen/arch/arm/p2m.c | 6 +++--- xen/include/asm-arm/mm.h | 9 +++++++-- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index bf29299707..c74f4dd69d 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -2002,15 +2002,15 @@ static void initrd_load(struct kernel_info *kinfo) for ( offs = 0; offs < len; ) { - int rc; - paddr_t s, l, ma; + uint64_t par; + paddr_t s, l, ma = 0; void *dst; s = offs & ~PAGE_MASK; l = min(PAGE_SIZE - s, len); - rc = gvirt_to_maddr(load_addr + offs, &ma, GV2M_WRITE); - if ( rc ) + par = gvirt_to_maddr(load_addr + offs, &ma, GV2M_WRITE); + if ( par ) { panic("Unable to translate guest address"); return; diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c index c2755a9ab9..a6c6413712 100644 --- a/xen/arch/arm/kernel.c +++ b/xen/arch/arm/kernel.c @@ -167,15 +167,15 @@ static void kernel_zimage_load(struct kernel_info *info) paddr, load_addr, load_addr + len); for ( offs = 0; offs < len; ) { - int rc; - paddr_t s, l, ma; + uint64_t par; + paddr_t s, l, ma = 0; void *dst; s = offs & ~PAGE_MASK; l = min(PAGE_SIZE - s, len); - rc = gvirt_to_maddr(load_addr + offs, &ma, GV2M_WRITE); - if ( rc ) + par = gvirt_to_maddr(load_addr + offs, &ma, GV2M_WRITE); + if ( par ) { panic("Unable to map translate guest address"); return; diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 68b488997d..f6b3d8e421 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1414,7 +1414,7 @@ struct page_info *get_page_from_gva(struct vcpu *v, vaddr_t va, struct p2m_domain *p2m = p2m_get_hostp2m(d); struct page_info *page = NULL; paddr_t maddr = 0; - int rc; + uint64_t par; /* * XXX: To support a different vCPU, we would need to load the @@ -1425,9 +1425,9 @@ struct page_info *get_page_from_gva(struct vcpu *v, vaddr_t va, p2m_read_lock(p2m); - rc = gvirt_to_maddr(va, &maddr, flags); + par = gvirt_to_maddr(va, &maddr, flags); - if ( rc ) + if ( par ) goto err; if ( !mfn_valid(maddr_to_mfn(maddr)) ) diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h index cd6dfb54b9..ad2f2a43dc 100644 --- a/xen/include/asm-arm/mm.h +++ b/xen/include/asm-arm/mm.h @@ -266,11 +266,16 @@ static inline void *maddr_to_virt(paddr_t ma) } #endif -static inline int gvirt_to_maddr(vaddr_t va, paddr_t *pa, unsigned int flags) +/* + * Translate a guest virtual address to a machine address. + * Return the fault information if the translation has failed else 0. + */ +static inline uint64_t gvirt_to_maddr(vaddr_t va, paddr_t *pa, + unsigned int flags) { uint64_t par = gva_to_ma_par(va, flags); if ( par & PAR_F ) - return -EFAULT; + return par; *pa = (par & PADDR_MASK & PAGE_MASK) | ((unsigned long) va & ~PAGE_MASK); return 0; } From patchwork Wed Nov 15 19:34:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 118992 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp3885370edl; Wed, 15 Nov 2017 11:36:28 -0800 (PST) X-Google-Smtp-Source: AGs4zMY4h0olJ3zGYwjCIQ4b321Su5bP98rRJQikg0NVB4hy19KqS/gsQ+XJx1Rrqojah5HtojTF X-Received: by 10.36.36.19 with SMTP id f19mr21382551ita.96.1510774588067; Wed, 15 Nov 2017 11:36:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510774588; cv=none; d=google.com; s=arc-20160816; b=H/FUfP7u6F2/ph9xWRA18v4v7W3E8Yp6hXAK9by/mGNQMFxWzNTdRbna0CIqjlEoR4 /t9dV1aboPb0XZNPGNrXNyX757VCiIrGht3TgQa4jmTYuy+RrzVq/NF5y6Djh7zFaTrz LdQO6sJqjWaX6gL5bPqyQqa6kX5Q1fjuHehTY7Usl2t4pkPiY/en2T2TTEZ9RCoD6FBE tEx5O0eYyM2RVfTIz+P5MgMOTLSfeKBUNiWLCvUcSwLrZgTHR7lJUM9G6iPYmwZJudpx pIGrxpMvXyeB7woNw+s79v//2ynRo2G77aVfWuem6idd/4+jWPmiauKNlvsCZh+UJJXU KJhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=RWywhWRW5zqKkNdE2uIK9Cx2RUtfyc8WaJJGV+u44IQ=; b=AsJlGhFwtv5r9cGQkwLLcmMb6l8AjzYGrt+yPrmLapQ/QGT0OhdoXS/6yRfgEWkxSM oFpts3HpTUwc4XpbvEiNH5HBtUYX9th/o8Dye+ZOXL8L5/ZQ0QApDv8Tb2Dw1fRUEC2p p/XIsU+W9IHRd9uP7ZO+IlZwqrUGw3TjEYQajdTEz3NjAjrmi6hdZQqDRdwVXObMbNez 7PuT/MDWjShkhNva1KZXHQbcZt0jLg2ryYM8xh6cqrwnVPvzxrMiqr80vB42zgtzqOki Mzvx9OtZ6deZgpsawpVBldEPnLG1Q1JkfHB3RWkGTcmHLv+KAE/h4cNsU4IWcnT3TRpt gAlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=H3vdpMR7; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id i62si17433077ioe.220.2017.11.15.11.36.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Nov 2017 11:36:28 -0800 (PST) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=H3vdpMR7; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eF3S3-0006Tt-59; Wed, 15 Nov 2017 19:34:23 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eF3S1-0006Tc-Os for xen-devel@lists.xen.org; Wed, 15 Nov 2017 19:34:21 +0000 Received: from [193.109.254.147] by server-6.bemta-6.messagelabs.com id C4/A4-32329-DB69C0A5; Wed, 15 Nov 2017 19:34:21 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRWlGSWpSXmKPExsXiVRvkortnGk+ UwaL5GhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8bOdVeZC37zVGyYc4y5gbGNq4uRi0NIYCKj xKqNz1hBHBaBecwSD1ZcZwdxJAT6WSUOXPnF2MXICeTkSaz6cYIZwk6TuHutCcqukHj8ayVQN wfQKDWJNW+iIKb2MUm8u3aDESTOJqAjsW5GLUi5iIC0xLXPl8FGMgs4S7yb9IUFxBYW8Je4+W 0RmM0ioCpx/vNLMJtXwFqidfsiqFXyErvaLoKt4hSwkThzOBgkLARUMmnLaqYJjIILGBlWMWo UpxaVpRbpGhvqJRVlpmeU5CZm5ugaGpjp5aYWFyemp+YkJhXrJefnbmIEhhsDEOxgbFoUeIhR koNJSZTX+Td3lBBfUn5KZUZicUZ8UWlOavEhRhkODiUJ3oNTeaKEBItS01Mr0jJzgIEPk5bg4 FES4Q0FSfMWFyTmFmemQ6ROMdpzHNt0+Q8Tx749t4Dks5mvG5g5pl1tbWIWYsnLz0uVEudlBG kTAGnLKM2DGwqL1EuMslLCvIxAZwrxFKQW5WaWoMq/YhTnYFQS5p0GMoUnM68EbvcroLOYgM6 yucENclZJIkJKqoHRMYa3ednFmREznz6bnum9ZcZhXWWxSdfKGRf8dMrp2XXame/n/NeuMY6L bW+dydl5oi/J1zKL/fRl6XvmJU9eh394q3Tu3s2bMRPXMzEtk9B+9z1PzzJ0Z1Hzk4QDq/+dm tkaMaF8MavguqUc/qwtG7RT+KIE3So39DVerIu53Dbp/bcDQgePK7EUZyQaajEXFScCAPqaiN LPAgAA X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-16.tower-27.messagelabs.com!1510774460!116321043!1 X-Originating-IP: [74.125.82.68] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 21777 invoked from network); 15 Nov 2017 19:34:20 -0000 Received: from mail-wm0-f68.google.com (HELO mail-wm0-f68.google.com) (74.125.82.68) by server-16.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 15 Nov 2017 19:34:20 -0000 Received: by mail-wm0-f68.google.com with SMTP id v186so5130063wma.2 for ; Wed, 15 Nov 2017 11:34:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SnPtz2e1/xRWWms7J5nBwJhS67dNz3uSIPk37b6PmE4=; b=H3vdpMR7K3EyPmtrQLjr5gx0OvH7WSPKcrGQe6Rc9Nu4llmHcL6gwmaUt3PQg7PCkl Vmoseqj8IdzDna5EGDEH5FYGdWg16msBtgFDOYgdKNR726czkCwZC8imtjCzDViwvU7K u7Veq6NQyo4MTyTC5db/2/POy24BN4h+NhS3Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SnPtz2e1/xRWWms7J5nBwJhS67dNz3uSIPk37b6PmE4=; b=n4GBkLmP4oXgndZfWB8/VTv5Edt6VUrOXfVHvqLEEkJPvg/wuV1bzUmPjKqW1CNb6t OMPOOI1UMxUUmP5Ijb3cNftC9znz3aZ6FnL8t4KLVom5x7KHReVkQkXjAKJ8j4L0S8NG slFPzl0uqPVwiTCR//luCekznZ/wStaiH7NdWzqcc9PVpY4l+TbVoprgZf/ww/sAB9iV d0YogkoZbpBIIFzjLbHxDyJ9z/919dilKBgV5Mr5dsyhwuGb+0ShM/vv8CfFwLZaFMH8 Y4d9qqu2B7mvs/7x1PEWOfH2CpgJAFsbkVqeWG9gMxK63m0XZXV3Xzgzbuptwk5m3s8u d6xQ== X-Gm-Message-State: AJaThX49gOrsE/d+CrPHVSKk9KOMYFJXbqzQm6NrSqMLzHKMZjr0Gpf8 BRGr08qqarAuE0DC90EuxiqvNqTEG1Y= X-Received: by 10.28.140.15 with SMTP id o15mr11996638wmd.8.1510774460089; Wed, 15 Nov 2017 11:34:20 -0800 (PST) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id x63sm18534330wma.39.2017.11.15.11.34.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Nov 2017 11:34:19 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 15 Nov 2017 19:34:14 +0000 Message-Id: <20171115193414.7678-3-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171115193414.7678-1-julien.grall@linaro.org> References: <20171115193414.7678-1-julien.grall@linaro.org> Cc: sstabellini@kernel.org, Julien Grall Subject: [Xen-devel] [PATCH for-4.10 2/2] xen/arm: p2m: Add more debug in get_page_from_gva X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" The function get_page_from_gva is used by copy_*_guest helpers to translate a guest virtual address to a machine physical address and take reference on the page. There are a couple of errors path that will return the same value making difficult to know the exact error. Add more debug in each error patch only for debug-build. This should help narrowing down the intermittent failure with the hypercall GNTTABOP_copy (see [1]). [1] https://lists.xen.org/archives/html/xen-devel/2017-11/msg00942.html Signed-off-by: Julien Grall Acked-by: Stefano Stabellini --- xen/arch/arm/p2m.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index f6b3d8e421..417609ede2 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1428,16 +1428,29 @@ struct page_info *get_page_from_gva(struct vcpu *v, vaddr_t va, par = gvirt_to_maddr(va, &maddr, flags); if ( par ) + { + dprintk(XENLOG_G_DEBUG, + "%pv: gvirt_to_maddr failed va=%#"PRIvaddr" flags=0x%lx par=%#"PRIx64"\n", + v, va, flags, par); goto err; + } if ( !mfn_valid(maddr_to_mfn(maddr)) ) + { + dprintk(XENLOG_G_DEBUG, "%pv: Invalid MFN %#"PRI_mfn"\n", + v, mfn_x(maddr_to_mfn(maddr))); goto err; + } page = mfn_to_page(maddr_to_mfn(maddr)); ASSERT(page); if ( unlikely(!get_page(page, d)) ) + { + dprintk(XENLOG_G_DEBUG, "%pv: Failing to acquire the MFN %#"PRI_mfn"\n", + v, mfn_x(maddr_to_mfn(maddr))); page = NULL; + } err: if ( !page && p2m->mem_access_enabled )