public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] infiniband/mthca : Fix userland mapping of mthca infiniband cards in Xen dom0
@ 2010-12-22 16:11 Vivien Bernet-Rollande
  2011-01-05 19:35 ` Roland Dreier
  0 siblings, 1 reply; 8+ messages in thread
From: Vivien Bernet-Rollande @ 2010-12-22 16:11 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: jackm-VPRAkNaXOzVS1MOuV/RT9w, rdreir-FYB4Gu1CFyUAvxtiuMwx3w,
	sean.hefty-ral2JQCrhuEAvxtiuMwx3w


Infiniband allows the mapping of PCI memory regions to userland to
achieve faster speeds. Using this feature with mthca cards in a Xen dom0
kernel leads to a pretty bad crash, and the process being killed (see
http://xen.1045712.n5.nabble.com/Infiniband-from-userland-in-dom0-process-killed-bad-pagetable-td3259124.html )

This patch fixes the issue by setting the VM_IO flag on the vma, and
refreshing the vm_page_prot field. The vm_page_prot will then have the
_PAGE_IOMAP bit set, and Xen will therefore map the actual PCI space
rather than a piece of non-existent RAM.

Signed-off-by: Vivien Bernet-Rollande <vbr-GKN1HSsW2S7R7s880joybQ@public.gmane.org>
---
This has been heavily tested on a Fedora Core modified 2.6.32 kernel
(with pvops patches : http://fedorapeople.org/~myoung/dom0/src/ ).I have
also checked that it does not break anything on a stock kernel
(2.6.37-rc7 from kernel.org), although only outside of Xen.

There has also been some discussion about this issue on the Xen mailing
list :
http://lists.xensource.com/archives/html/xen-devel/2010-11/msg01739.html


diff -uNrp kernel-2.6.32.fc12.orig/drivers/infiniband/hw/mthca/mthca_provider.c kernel-2.6.32.fc12.new/drivers/infiniband/hw/mthca/mthca_provider.c
--- kernel-2.6.32.fc12.orig/drivers/infiniband/hw/mthca/mthca_provider.c	2010-12-16 16:39:06.901130993 +0100
+++ kernel-2.6.32.fc12.new/drivers/infiniband/hw/mthca/mthca_provider.c	2010-12-16 17:02:07.944127489 +0100
@@ -391,6 +391,8 @@ static int mthca_mmap_uar(struct ib_ucon
 	if (vma->vm_end - vma->vm_start != PAGE_SIZE)
 		return -EINVAL;
 
+	vma->vm_flags |= VM_IO;
+	vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
 	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 
 	if (io_remap_pfn_range(vma, vma->vm_start,



--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-01-09  8:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-22 16:11 [PATCH] infiniband/mthca : Fix userland mapping of mthca infiniband cards in Xen dom0 Vivien Bernet-Rollande
2011-01-05 19:35 ` Roland Dreier
     [not found]   ` <adamxnfdty8.fsf-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
2011-01-06 11:08     ` Vivien Bernet-Rollande
2011-01-06 16:55       ` Konrad Rzeszutek Wilk
2011-01-06 18:51         ` Roland Dreier
     [not found]           ` <adalj2xdfw2.fsf-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
2011-01-07 19:15             ` [Xen-devel] " Konrad Rzeszutek Wilk
     [not found]               ` <20110107191559.GA27871-Z2dCqgVfyhJWk0Htik3J/w@public.gmane.org>
2011-01-09  8:24                 ` Jack Morgenstein
     [not found]       ` <AANLkTi=zMiVJfTRDeYvbxT46b0iASKG9jPgXqG81bqAK-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-01-06 19:15         ` Roland Dreier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox