All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: Alex Williamson <alex.williamson@redhat.com>,
	"Aviv B.D." <bd.aviv@gmail.com>,
	qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
	Jan Kiszka <jan.kiszka@siemens.com>
Subject: Re: [Qemu-devel] [PATCH v4 RESEND 0/3] IOMMU: intel_iommu support map and unmap notifications
Date: Fri, 21 Oct 2016 13:17:08 +0800	[thread overview]
Message-ID: <20161021051708.GP15168@pxdev.xzpeter.org> (raw)
In-Reply-To: <20161021005005.GV11140@umbus.fritz.box>

On Fri, Oct 21, 2016 at 11:50:05AM +1100, David Gibson wrote:

[...]

> > > In my setup the VFIO registered two memory areas with one page of
> > > unregistered memory
> > > between them.
> > > 
> > > When I'm calling memory_region_notify_iommu it calls the notifier function
> > > of VFIO twice
> > > when the second time is failing with warning to console as the new mapping
> > > is already present.
> > > 
> > > The notifier function of VFIO should ignore IOMMUTLBEntry that is not in
> > > the correct
> > > range.
> > 
> > Hmm, right vfio_listener_region_add() is called for a
> > MemoryRegionSection, but then we add an iommu notifier to the
> > MemoryRegion, so we end up with a notifier per MemoryRegionSection
> > regardless of whether they're backed by the same MemoryRegion.  Seems
> > like we need a MemoryRegion based list of VFIOGuestIOMMUs so we only
> > register once per MemoryRegion and then sort though the list of
> > VFIOGuestIOMMUs for a given MemoryRegion to find the one affected.
> > David, does that sound right to you?

I think we already have such a list (VFIOContainer.giommu_list)? Can
we use that to do it? When we try to add a new IOMMU notifier for
specific MemoryRegion, we can first traverse VFIOContainer.giommu_list
and see whether there are existing MemoryRegion registered, and we
only register if it's the first one.

> 
> Well, I think that would work.  But I think it would be better to fix
> it from the other side:
> 
> We add the range to be notified into the IOMMUNotifier structure and
> filter based on that range in memory_region_notify_iommu.
> 
> It means a little more list searching and filtering on notify, but it
> avoids having to have another list and search on the VFIO side.  I
> think it will also better deal with cases where part of an IOMMU
> mapped region is inaccessible due to an intermediate bridge.

IIUC, this will still need to keep several VFIOGuestIOMMUs which
contains exactly the same content?

Thanks,

-- peterx

  reply	other threads:[~2016-10-21  5:17 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-17 15:44 [Qemu-devel] [PATCH v4 RESEND 0/3] IOMMU: intel_iommu support map and unmap notifications Aviv B.D
2016-10-17 15:44 ` [Qemu-devel] [PATCH v4 RESEND 1/3] IOMMU: add option to enable VTD_CAP_CM to vIOMMU capility exposoed to guest Aviv B.D
2016-10-21  7:14   ` Jason Wang
2016-10-21 19:47     ` Michael S. Tsirkin
2016-10-24  2:32       ` Jason Wang
2016-10-17 15:44 ` [Qemu-devel] [PATCH v4 RESEND 2/3] IOMMU: change iommu_op->translate's is_write to flags, add support to NO_FAIL flag mode Aviv B.D
2016-10-18  3:57   ` David Gibson
2016-10-19  8:35   ` Peter Xu
2016-10-20 18:54     ` Aviv B.D.
2016-10-17 15:44 ` [Qemu-devel] [PATCH v4 RESEND 3/3] IOMMU: enable intel_iommu map and unmap notifiers Aviv B.D
2016-10-18  4:04   ` David Gibson
2016-10-19  9:33   ` Peter Xu
2016-10-20 19:11     ` Aviv B.D.
2016-10-20 19:11       ` Aviv B.D.
2016-10-21  3:57       ` Peter Xu
2016-10-24  7:53         ` Aviv B.D.
2016-10-24  8:02           ` Peter Xu
2016-10-25 10:07             ` Aviv B.D.
2016-10-20  7:28   ` Peter Xu
2016-10-17 16:07 ` [Qemu-devel] [PATCH v4 RESEND 0/3] IOMMU: intel_iommu support map and unmap notifications Alex Williamson
2016-10-18  4:06   ` David Gibson
2016-10-18  4:47     ` Alex Williamson
2016-10-18  5:52       ` David Gibson
2016-10-18  8:03         ` Alex Williamson
2016-10-20 19:17   ` Aviv B.D.
2016-10-20 20:06     ` Alex Williamson
2016-10-21  0:50       ` David Gibson
2016-10-21  5:17         ` Peter Xu [this message]
2016-10-21 14:43           ` Alex Williamson
2016-10-31  6:47             ` Peter Xu
2016-10-24  6:03           ` David Gibson

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=20161021051708.GP15168@pxdev.xzpeter.org \
    --to=peterx@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=bd.aviv@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=jan.kiszka@siemens.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.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.