All of lore.kernel.org
 help / color / mirror / Atom feed
From: stefano.stabellini@eu.citrix.com (Stefano Stabellini)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 0/2] xen/arm: fix "xen_add_mach_to_phys_entry: cannot add" problem
Date: Mon, 7 Jul 2014 21:24:33 +0100	[thread overview]
Message-ID: <alpine.DEB.2.02.1407072007470.27641@kaball.uk.xensource.com> (raw)

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
-------------- next part --------------

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__ */
 /*

WARNING: multiple messages have this Message-ID (diff)
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: Ian Campbell <Ian.Campbell@citrix.com>,
	Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>,
	Julien Grall <julien.grall@citrix.com>,
	David Vrabel <david.vrabel@citrix.com>,
	v1ne2go@gmail.com, linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 0/2] xen/arm: fix "xen_add_mach_to_phys_entry: cannot add" problem
Date: Mon, 7 Jul 2014 21:24:33 +0100	[thread overview]
Message-ID: <alpine.DEB.2.02.1407072007470.27641@kaball.uk.xensource.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1402 bytes --]

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

[-- Attachment #2: Type: text/plain, Size: 532 bytes --]


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__ */
 /*

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

             reply	other threads:[~2014-07-07 20:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-07 20:24 Stefano Stabellini [this message]
2014-07-07 20:24 ` [RFC PATCH 0/2] xen/arm: fix "xen_add_mach_to_phys_entry: cannot add" problem Stefano Stabellini
2014-07-07 20:26 ` [RFC PATCH 1/2] xen/arm: reimplement xen_dma_unmap_page & friends Stefano Stabellini
2014-07-07 20:26   ` Stefano Stabellini
2014-07-07 20:26 ` [RFC PATCH 2/2] xen/arm: remove mach_to_phys rbtree Stefano Stabellini
2014-07-07 20:26   ` Stefano Stabellini
2014-07-08  8:32 ` [RFC PATCH 0/2] xen/arm: fix "xen_add_mach_to_phys_entry: cannot add" problem Julien Grall
2014-07-08  9:37 ` [Xen-devel] " Julien Grall
2014-07-08  9:37   ` Julien Grall
2014-07-08 10:50 ` David Vrabel
2014-07-08 10:50   ` David Vrabel
2014-07-08 11:00   ` Stefano Stabellini
2014-07-08 11:00     ` Stefano Stabellini
2014-07-08 11:06   ` Ian Campbell
2014-07-08 11:06     ` Ian Campbell

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=alpine.DEB.2.02.1407072007470.27641@kaball.uk.xensource.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=linux-arm-kernel@lists.infradead.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.