From patchwork Mon Jul 7 20:24:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 33171 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2218620969 for ; Mon, 7 Jul 2014 20:27:14 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id wn1sf305599obc.3 for ; Mon, 07 Jul 2014 13:27:13 -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:date:from:to:message-id:user-agent :mime-version: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-id; bh=ZpiEOQaMYy+yxPt7weLUvJAJ28uvxJuKV17XZopdfno=; b=lUnQPEyMej8x1C85qc7PPvLNHxRqEtvHhlfiT4VZsBERKZoQsipDQjpIgU/YDu4woF n3tqP8ceknzms1VQ4DlIba4VghbEQRdrjaaug3/jrp/1sw8k7ee4PcainAwLVVCEjlpF sIZNmnumqdb5ZqWJbMVsni1CUv/KZkOU7aw0syr31oKKC+5QqMypJ5QNLvYecTpkTO/q lKKiJ0knieYDm//wjNfmt5p8fXC6MZ+TPJZ2h0Tj5LepkI/SG7v12j9sUh4NKHG4iLU2 CdO8t9DYp+m2wl7Apc0iVzWhb+c3UPcEPRLQ/6y6CpqFVojGOewmHmZfgEZ7DH2ZpRfs 2o7g== X-Gm-Message-State: ALoCoQlSuV0wIdrHziyQDc47di09lyj2Gb0hBu2Oaz+UX3GebmtjhdDO7LhY8VTRKnOIMaCpWfAS X-Received: by 10.182.91.79 with SMTP id cc15mr15715094obb.13.1404764833759; Mon, 07 Jul 2014 13:27:13 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.106.33 with SMTP id d30ls1625743qgf.47.gmail; Mon, 07 Jul 2014 13:27:13 -0700 (PDT) X-Received: by 10.58.228.74 with SMTP id sg10mr28770106vec.6.1404764833658; Mon, 07 Jul 2014 13:27:13 -0700 (PDT) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id qr19si17896255vdb.86.2014.07.07.13.27.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 07 Jul 2014 13:27:13 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.177 as permitted sender) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id i13so4613229veh.22 for ; Mon, 07 Jul 2014 13:27:13 -0700 (PDT) X-Received: by 10.58.150.1 with SMTP id ue1mr29133198veb.11.1404764833575; Mon, 07 Jul 2014 13:27:13 -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.221.37.5 with SMTP id tc5csp701652vcb; Mon, 7 Jul 2014 13:27:13 -0700 (PDT) X-Received: by 10.58.182.105 with SMTP id ed9mr29692110vec.16.1404764833238; Mon, 07 Jul 2014 13:27:13 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id dx8si19191466vdb.24.2014.07.07.13.27.12 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 07 Jul 2014 13:27:13 -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 1X4FTW-00034A-I6; Mon, 07 Jul 2014 20:25:22 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X4FTV-000344-Hp for xen-devel@lists.xensource.com; Mon, 07 Jul 2014 20:25:21 +0000 Received: from [85.158.137.68:50657] by server-1.bemta-3.messagelabs.com id E1/F3-13056-0320BB35; Mon, 07 Jul 2014 20:25:20 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-5.tower-31.messagelabs.com!1404764718!14575345!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 27358 invoked from network); 7 Jul 2014 20:25:19 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-5.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 7 Jul 2014 20:25:19 -0000 X-IronPort-AV: E=Sophos;i="5.01,620,1400025600"; d="scan'208";a="150603329" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 07 Jul 2014 20:25:18 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.3.181.6; Mon, 7 Jul 2014 16:25:17 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1X4FTQ-0000WL-VV; Mon, 07 Jul 2014 21:25:16 +0100 Date: Mon, 7 Jul 2014 21:24:33 +0100 From: Stefano Stabellini X-X-Sender: sstabellini@kaball.uk.xensource.com To: Message-ID: User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 X-DLP: MIA2 Cc: Ian Campbell , Stefano Stabellini , Julien Grall , David Vrabel , v1ne2go@gmail.com, linux-arm-kernel@lists.infradead.org Subject: [Xen-devel] [RFC PATCH 0/2] xen/arm: fix "xen_add_mach_to_phys_entry: cannot add" problem 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: stefano.stabellini@eu.citrix.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: Content-ID: Hi all, Xen support in Linux for ARM and ARM64 suffers from lack of support for multiple mfn to pfn mappings: whenever a frontend grants the same page multiple times to the backend, the mfn to pfn accounting in arch/arm/xen/p2m.c fails. The issue has become critical since v3.15, when xen-netfront/xen-netback switched from grant copies to grant mappings, therefore causing the issue to happen much more often. Fixing the mfn to pfn accounting in p2m.c is difficult and expensive, therefore we are looking for alternative solutions. One idea is avoiding mfn to pfn conversions altogether. The only code path that needs them is swiotlb-xen:unmap_page (and single_for_cpu and single_for_device). To avoid mfn to pfn conversions we rely on a second p2m mapping done by Xen, see the attached patch. In Linux we use it to perform the cache maintenance operations without mfns conversions. Stefano Stabellini (2): xen/arm: reimplement xen_dma_unmap_page & friends xen/arm: remove mach_to_phys rbtree arch/arm/include/asm/xen/page-coherent.h | 25 ++-- arch/arm/include/asm/xen/page.h | 9 -- arch/arm/xen/Makefile | 2 +- arch/arm/xen/mm32.c | 202 ++++++++++++++++++++++++++++++ arch/arm/xen/p2m.c | 64 +--------- 5 files changed, 211 insertions(+), 91 deletions(-) create mode 100644 arch/arm/xen/mm32.c diff --git a/xen/include/asm-arm/grant_table.h b/xen/include/asm-arm/grant_table.h index eac8a70..95519c5 100644 --- a/xen/include/asm-arm/grant_table.h +++ b/xen/include/asm-arm/grant_table.h @@ -34,7 +34,7 @@ static inline int replace_grant_supported(void) (i < max_nr_grant_frames)) ? 0 : (d->arch.grant_table_gpfn[i])) #define gnttab_need_iommu_mapping(d) \ - (is_domain_direct_mapped(d) && need_iommu(d)) + (is_domain_direct_mapped(d)) #endif /* __ASM_GRANT_TABLE_H__ */ /*