From: Muli Ben-Yehuda <muli@il.ibm.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: Ben-Ami Yassour1 <BENAMI@il.ibm.com>,
amit.shah@qumranet.com, weidong.han@intel.com,
raharper@us.ibm.com, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: PCIPT: VT-d: fix guest unmap
Date: Thu, 19 Jun 2008 00:23:46 +0300 [thread overview]
Message-ID: <20080618212346.GL7186@il.ibm.com> (raw)
In-Reply-To: <485974A1.60007@codemonkey.ws>
On Wed, Jun 18, 2008 at 03:48:33PM -0500, Anthony Liguori wrote:
> Right. But this is not ideal. Instead of pinning up-front, it
> would make more sense IMHO to build the VT-d table as the shadow
> page table gets faulted in. In certain circumstances, this will
> result in extraneous updates (because a GPA=>HPA mapping is already
> present) and that's where we should eliminate iotlb flushes.
As Ben wrote, we can't do this and must fault everything in up-front
(assuming no PVDMA API). Assume we don't do this: it is valid for the
guest to program the device with a GPA that does not yet have a
corresponding HPA (because the guest did not write or read to/from it
and thus we haven't yet faulted in a frame for it). Then, once the
device DMA's to it, the DMA will be stopped incorrectly.
>> Obviously, pinning the entire guest is not desirable since we waste
>> a lot of memory resources, but this is the approach that we
>> currently have. Do you find it good enough for a merge with the
>> main KVM tree, and optimize later?
>
> No, it's not safe. What happens mmap(MAP_FIXED) into phys_ram_base?
> We need to use MMU notifiers to handle such events and appropriately
> flush the iotlb.
Could you elaborate on what you mean here and what is not safe? Our
current approach is to just fault in all of guest memory---are you
concerned about a case where some of the guest frames get replaced by
other frames because of the mmap()?
I'd like to stress that we are shooting at the moment for the simplest
possible solution that is good enough, so that we'll be able to
finally merge this into the tree...
>> I'm not sure how we can do that... the guest can send a guest
>> physical address to the device for DMA, even without generating a
>> page-fault on the host for that address... which implies that the
>> host must pin the entire guest memory in advance. agree?
>
> See above. Ideally we would wait until the first PCI config space
> access for a device before special casing the guest. Otherwise,
> there's no way to allow a DMA-aware guest to avoid pinning up front.
Err, if the user gave the guest pass-through access to a PCI device,
presumably it is because the guest will use it... What do we win by
delaying the inevitable?
Cheers,
Muli
next prev parent reply other threads:[~2008-06-18 21:23 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-17 19:05 Patches for vtd pci passthrough benami
2008-06-17 19:05 ` [PATCH] KVM: PCIPT: fix compilation errors benami
2008-06-17 19:05 ` [PATCH] KVM: PCIPT: VT-d: fix guest unmap benami
2008-06-17 19:05 ` [PATCH] KVM: PCIPT: free device structure on vm destroy benami
2008-06-17 19:05 ` [PATCH] KVM: PCIPT: VT-d: fix context mapping benami
2008-06-17 19:25 ` KVM: PCIPT: temporary fix for pio (userspace part) benami
2008-06-17 19:25 ` [PATCH] " benami
2008-06-18 20:30 ` [PATCH] KVM: PCIPT: VT-d: fix context mapping Muli Ben-Yehuda
2008-06-19 8:59 ` Han, Weidong
2008-06-19 12:28 ` Ben-Ami Yassour
2008-06-19 14:18 ` Han, Weidong
2008-06-19 17:44 ` Ben-Ami Yassour1
2008-06-20 6:23 ` Han, Weidong
2008-06-30 15:32 ` Ben-Ami Yassour
2008-07-01 2:22 ` Han, Weidong
2008-06-17 21:29 ` [PATCH] KVM: PCIPT: VT-d: fix guest unmap Anthony Liguori
2008-06-18 12:06 ` Ben-Ami Yassour
2008-06-18 20:48 ` Anthony Liguori
2008-06-18 21:23 ` Muli Ben-Yehuda [this message]
2008-06-18 21:41 ` Anthony Liguori
2008-06-20 18:59 ` Avi Kivity
2008-06-20 19:28 ` Anthony Liguori
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=20080618212346.GL7186@il.ibm.com \
--to=muli@il.ibm.com \
--cc=BENAMI@il.ibm.com \
--cc=amit.shah@qumranet.com \
--cc=anthony@codemonkey.ws \
--cc=kvm@vger.kernel.org \
--cc=raharper@us.ibm.com \
--cc=weidong.han@intel.com \
/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