public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Steven Sistare <steven.sistare@oracle.com>
Cc: kvm@vger.kernel.org, Alex Williamson <alex.williamson@redhat.com>,
	Cornelia Huck <cohuck@redhat.com>
Subject: Re: [PATCH V1 7/8] vfio: change dma owner
Date: Thu, 8 Dec 2022 13:15:42 -0400	[thread overview]
Message-ID: <Y5Ibvv9PNMifi0NF@ziepe.ca> (raw)
In-Reply-To: <0f6d9adb-b5b9-ca52-9723-752c113e97c4@oracle.com>

On Thu, Dec 08, 2022 at 11:48:08AM -0500, Steven Sistare wrote:

> > Anyhow, I came up with this thing. Needs a bit of polishing, the
> > design is a bit odd for performance reasons, and I only compiled it.
> 
> Thanks, I'll pull an iommfd development environment together and try it.
> However, it will also need an interface to change vaddr for each dma region.
> In general the vaddr will be different when the memory object is re-mapped 
> after exec.

Ahh that is yuky :\

So I still like the one shot approach because it has nice error
handling properties, and it lets us use the hacky very expensive "stop
the world" lockng to avoid slowing the fast paths.

Passing in a sorted list of old_vaddr,new_vaddr is possibly fine, the
kernel can bsearch it as it goes through all the pages objects.

Due to the way iommufd works, especially with copy, you end up with
the 'pages' handle that holds the vaddr that many different IOVAs may
refer to. So it is kind of weird to ask to change a single IOVA's
mapping, it must always change all the mappings that have been copied
that share vaddr, pin accounting and so forth.

This is another reason why I liked the one-shot global everything
approach, as narrowing the objects to target cannot be done by IOVA -
at best you could target a specific mm and vaddr range.

FWIW, there is a nice selftest in iommufd in
tools/testing/selftests/iommu/iommufd.c and the way to develop
something like this is to add a simple selftes to exercise your
scenario and get everything sorted like that before going to qemu.

Using the vfio compat you can keep the existing qemu vfio type1 and
just hack in a call the IOMMUFD ioctl in the right spot. No need to
jump to the iommfd version of qemu for testing.

Jason

  reply	other threads:[~2022-12-08 17:15 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-06 21:55 [PATCH V1 0/8] vfio virtual address update redo Steve Sistare
2022-12-06 21:55 ` [PATCH V1 1/8] vfio: delete interfaces to update vaddr Steve Sistare
2022-12-06 23:52   ` Alex Williamson
2022-12-07 14:26     ` Steven Sistare
2022-12-07 15:14       ` Alex Williamson
2023-05-17 16:12       ` Jason Gunthorpe
2023-05-17 17:35         ` Steven Sistare
2022-12-07 15:19     ` Jason Gunthorpe
2022-12-08 19:09       ` Steven Sistare
2022-12-08 19:44         ` Alex Williamson
2022-12-07 23:20   ` Jason Gunthorpe
2022-12-08 22:18   ` Alex Williamson
2022-12-06 21:55 ` [PATCH V1 2/8] vfio/type1: dma owner permission Steve Sistare
2022-12-07 15:28   ` Jason Gunthorpe
2022-12-08 20:13     ` Steven Sistare
2022-12-06 21:55 ` [PATCH V1 3/8] vfio: close dma owner Steve Sistare
2022-12-06 21:55 ` [PATCH V1 4/8] vfio/type1: " Steve Sistare
2022-12-06 21:55 ` [PATCH V1 5/8] vfio/type1: track locked_vm per dma Steve Sistare
2022-12-06 21:55 ` [PATCH V1 6/8] vfio/type1: update vaddr Steve Sistare
2022-12-06 21:55 ` [PATCH V1 7/8] vfio: change dma owner Steve Sistare
2022-12-07 16:58   ` Jason Gunthorpe
2022-12-08 16:48     ` Steven Sistare
2022-12-08 17:15       ` Jason Gunthorpe [this message]
2022-12-08 17:39         ` Steven Sistare
2022-12-08 17:46           ` Jason Gunthorpe
2022-12-06 21:55 ` [PATCH V1 8/8] vfio/type1: " Steve Sistare
2022-12-07 17:00   ` Jason Gunthorpe
2022-12-08  7:22   ` Dan Carpenter
2022-12-07 15:23 ` [PATCH V1 0/8] vfio virtual address update redo Jason Gunthorpe

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=Y5Ibvv9PNMifi0NF@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=steven.sistare@oracle.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