From: Alex Williamson <alex.williamson@redhat.com>
To: "Tian, Kevin" <kevin.tian@intel.com>
Cc: Jason Wang <jasowang@redhat.com>,
"Zhao, Yan Y" <yan.y.zhao@intel.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] vhost, iova, and dirty page tracking
Date: Thu, 19 Sep 2019 11:20:48 -0600 [thread overview]
Message-ID: <20190919112048.09b3edaa@x1.home> (raw)
In-Reply-To: <AADFC41AFE54684AB9EE6CBC0274A5D19D57B785@SHSMSX104.ccr.corp.intel.com>
On Wed, 18 Sep 2019 07:21:05 +0000
"Tian, Kevin" <kevin.tian@intel.com> wrote:
> > From: Jason Wang [mailto:jasowang@redhat.com]
> > Sent: Wednesday, September 18, 2019 2:04 PM
> >
> > On 2019/9/18 上午9:31, Tian, Kevin wrote:
> > >> From: Alex Williamson [mailto:alex.williamson@redhat.com]
> > >> Sent: Tuesday, September 17, 2019 10:54 PM
> > >>
> > >> On Tue, 17 Sep 2019 08:48:36 +0000
> > >> "Tian, Kevin"<kevin.tian@intel.com> wrote:
> > >>
> > >>>> From: Jason Wang [mailto:jasowang@redhat.com]
> > >>>> Sent: Monday, September 16, 2019 4:33 PM
> > >>>>
> > >>>>
> > >>>> On 2019/9/16 上午9:51, Tian, Kevin wrote:
> > >>>>> Hi, Jason
> > >>>>>
> > >>>>> We had a discussion about dirty page tracking in VFIO, when
> > vIOMMU
> > >>>>> is enabled:
> > >>>>>
> > >>>>> https://lists.nongnu.org/archive/html/qemu-devel/2019-
> > >>>> 09/msg02690.html
> > >>>>> It's actually a similar model as vhost - Qemu cannot interpose the
> > fast-
> > >>>> path
> > >>>>> DMAs thus relies on the kernel part to track and report dirty page
> > >>>> information.
> > >>>>> Currently Qemu tracks dirty pages in GFN level, thus demanding a
> > >>>> translation
> > >>>>> from IOVA to GPA. Then the open in our discussion is where this
> > >>>> translation
> > >>>>> should happen. Doing the translation in kernel implies a device iotlb
> > >>>> flavor,
> > >>>>> which is what vhost implements today. It requires potentially large
> > >>>> tracking
> > >>>>> structures in the host kernel, but leveraging the existing log_sync
> > flow
> > >> in
> > >>>> Qemu.
> > >>>>> On the other hand, Qemu may perform log_sync for every removal
> > of
> > >>>> IOVA
> > >>>>> mapping and then do the translation itself, then avoiding the GPA
> > >>>> awareness
> > >>>>> in the kernel side. It needs some change to current Qemu log-sync
> > >> flow,
> > >>>> and
> > >>>>> may bring more overhead if IOVA is frequently unmapped.
> > >>>>>
> > >>>>> So we'd like to hear about your opinions, especially about how you
> > >> came
> > >>>>> down to the current iotlb approach for vhost.
> > >>>> We don't consider too much in the point when introducing vhost. And
> > >>>> before IOTLB, vhost has already know GPA through its mem table
> > >>>> (GPA->HVA). So it's nature and easier to track dirty pages at GPA level
> > >>>> then it won't any changes in the existing ABI.
> > >>> This is the same situation as VFIO.
> > >> It is? VFIO doesn't know GPAs, it only knows HVA, HPA, and IOVA. In
> > >> some cases IOVA is GPA, but not all.
> > > Well, I thought vhost has a similar design, that the index of its mem table
> > > is GPA when vIOMMU is off and then becomes IOVA when vIOMMU is on.
> > > But I may be wrong here. Jason, can you help clarify? I saw two
> > > interfaces which poke the mem table: VHOST_SET_MEM_TABLE (for GPA)
> > > and VHOST_IOTLB_UPDATE (for IOVA). Are they used exclusively or
> > together?
> > >
> >
> > Actually, vhost maintains two interval trees, mem table GPA->HVA, and
> > device IOTLB IOVA->HVA. Device IOTLB is only used when vIOMMU is
> > enabled, and in that case mem table is used only when vhost need to
> > track dirty pages (do reverse lookup of memtable to get HVA->GPA). So in
> > conclusion, for datapath, they are used exclusively, but they need
> > cowork for logging dirty pages when device IOTLB is enabled.
> >
>
> OK. Then it's different from current VFIO design, which maintains only
> one tree which is indexed by either GPA or IOVA exclusively, upon
> whether vIOMMU is in use.
Nit, the VFIO tree is only ever indexed by IOVA. The MAP_DMA ioctl is
only ever performed with an IOVA. Userspace decides how that IOVA maps
to GPA, VFIO only needs to know how the IOVA maps to HPA via the HVA.
Thanks,
Alex
next prev parent reply other threads:[~2019-09-19 17:28 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-16 1:51 [Qemu-devel] vhost, iova, and dirty page tracking Tian, Kevin
2019-09-16 8:33 ` Jason Wang
2019-09-17 8:48 ` Tian, Kevin
2019-09-17 10:36 ` Jason Wang
2019-09-18 1:44 ` Tian, Kevin
2019-09-18 6:10 ` Jason Wang
2019-09-18 7:41 ` Tian, Kevin
2019-09-18 8:37 ` Tian, Kevin
2019-09-19 1:05 ` Jason Wang
2019-09-19 5:28 ` Yan Zhao
2019-09-19 6:09 ` Jason Wang
2019-09-19 6:17 ` Yan Zhao
2019-09-19 6:32 ` Jason Wang
2019-09-19 6:29 ` Yan Zhao
2019-09-19 6:32 ` Yan Zhao
2019-09-19 9:35 ` Jason Wang
2019-09-19 9:36 ` Yan Zhao
2019-09-19 10:08 ` Jason Wang
2019-09-19 10:06 ` Jason Wang
2019-09-19 10:16 ` Yan Zhao
2019-09-19 12:14 ` Jason Wang
2019-09-19 7:16 ` Tian, Kevin
2019-09-19 9:37 ` Jason Wang
2019-09-19 14:06 ` Michael S. Tsirkin
2019-09-20 1:15 ` Jason Wang
2019-09-20 10:02 ` Michael S. Tsirkin
2019-09-19 11:14 ` Paolo Bonzini
2019-09-19 12:39 ` Jason Wang
2019-09-19 12:45 ` Paolo Bonzini
2019-09-19 22:54 ` Tian, Kevin
2019-09-20 1:18 ` Jason Wang
2019-09-24 2:02 ` Tian, Kevin
2019-09-25 3:46 ` Jason Wang
2019-09-17 14:54 ` Alex Williamson
2019-09-18 1:31 ` Tian, Kevin
2019-09-18 6:03 ` Jason Wang
2019-09-18 7:21 ` Tian, Kevin
2019-09-19 17:20 ` Alex Williamson [this message]
2019-09-19 22:40 ` Tian, Kevin
[not found] ` <AADFC41AFE54684AB9EE6CBC0274A5D19D57AFB7@SHSMSX104.ccr.corp.intel.com>
2019-09-18 2:15 ` Tian, Kevin
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=20190919112048.09b3edaa@x1.home \
--to=alex.williamson@redhat.com \
--cc=jasowang@redhat.com \
--cc=kevin.tian@intel.com \
--cc=qemu-devel@nongnu.org \
--cc=yan.y.zhao@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;
as well as URLs for NNTP newsgroup(s).