From: Muli Ben-Yehuda <muli@il.ibm.com>
To: "Kay, Allen M" <allen.m.kay@intel.com>
Cc: Chris Wright <chrisw@redhat.com>,
kvm-devel@lists.sourceforge.net, Avi Kivity <avik@qumranet.com>,
Ben-Ami Yassour1 <BENAMI@il.ibm.com>
Subject: Re: [RFC] [VTD][patch 1/3] vt-d support for pci passthrough: kvm-vtd--kernel.patch
Date: Sun, 11 May 2008 11:53:03 +0300 [thread overview]
Message-ID: <20080511085303.GR7484@il.ibm.com> (raw)
In-Reply-To: <1FE6DD409037234FAB833C420AA843EC01438CB3@orsmsx424.amr.corp.intel.com>
On Mon, May 05, 2008 at 02:36:23PM -0700, Kay, Allen M wrote:
> + for (j = 0; j < npages; j++) {
> + gpa += PAGE_SIZE;
> + page = gfn_to_page(kvm, gpa >> PAGE_SHIFT);
> + hpa = page_to_phys(page);
> + domain_page_mapping(kvm->arch.domain, gpa, hpa,
> PAGE_SIZE,
> + DMA_PTE_READ | DMA_PTE_WRITE);
> + vma = find_vma(current->mm, gpa);
> + if (!vma)
> + return 1;
> + write = (vma->vm_flags & VM_WRITE) != 0;
> + get_user_pages(current, current->mm, gpa,
> + PAGE_SIZE, write, 0, NULL, NULL);
> + }
> + return 0;
> +}
get_user_pages can fail. We should first try to fault in the pages and
only if succesfull map them in the IOMMU. Also, you need to protect
against the vma going away here.
Cheers,
Muli
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
prev parent reply other threads:[~2008-05-11 8:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-05 21:36 [RFC] [VTD][patch 1/3] vt-d support for pci passthrough: kvm-vtd--kernel.patch Kay, Allen M
2008-05-06 7:37 ` Amit Shah
2008-05-06 22:01 ` Kay, Allen M
2008-05-06 10:34 ` Avi Kivity
2008-05-07 0:31 ` Anthony Liguori
2008-05-07 0:47 ` Kay, Allen M
2008-05-07 1:56 ` Anthony Liguori
2008-05-07 5:51 ` Avi Kivity
2008-05-07 19:22 ` Anthony Liguori
2008-05-11 15:31 ` Avi Kivity
2008-05-11 8:53 ` Muli Ben-Yehuda [this message]
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=20080511085303.GR7484@il.ibm.com \
--to=muli@il.ibm.com \
--cc=BENAMI@il.ibm.com \
--cc=allen.m.kay@intel.com \
--cc=avik@qumranet.com \
--cc=chrisw@redhat.com \
--cc=kvm-devel@lists.sourceforge.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox