All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vivien Bernet-Rollande <vbr-GKN1HSsW2S7R7s880joybQ@public.gmane.org>
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: jackm-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org,
	rdreir-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org,
	sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Subject: [PATCH] infiniband/mthca : Fix userland mapping of mthca infiniband cards in Xen dom0
Date: Wed, 22 Dec 2010 17:11:00 +0100	[thread overview]
Message-ID: <1293034260.30522.426.camel@trax> (raw)


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

             reply	other threads:[~2010-12-22 16:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-22 16:11 Vivien Bernet-Rollande [this message]
2011-01-05 19:35 ` [PATCH] infiniband/mthca : Fix userland mapping of mthca infiniband cards in Xen dom0 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

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=1293034260.30522.426.camel@trax \
    --to=vbr-gkn1hssw2s7r7s880joybq@public.gmane.org \
    --cc=jackm-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=rdreir-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org \
    --cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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.