From: "Michael S. Tsirkin" <mst@redhat.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: Avi Kivity <avi@redhat.com>, Tom Lyon <pugs@cisco.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
chrisw@sous-sol.org, hjk@linutronix.de, gregkh@suse.de,
aafabbri@cisco.com, scofeldm@cisco.com
Subject: Re: [PATCH] VFIO driver: Non-privileged user level PCI drivers
Date: Wed, 2 Jun 2010 15:34:17 +0300 [thread overview]
Message-ID: <20100602123417.GA29815@redhat.com> (raw)
In-Reply-To: <20100602121927.GA11162@8bytes.org>
On Wed, Jun 02, 2010 at 02:19:28PM +0200, Joerg Roedel wrote:
> On Wed, Jun 02, 2010 at 02:21:00PM +0300, Michael S. Tsirkin wrote:
> > On Wed, Jun 02, 2010 at 01:12:25PM +0200, Joerg Roedel wrote:
>
> > > Even if it is bound to a domain the userspace driver could program the
> > > device to do dma to unmapped regions causing io-page-faults. The kernel
> > > can't do anything about it.
> >
> > It can always corrupt its own memory directly as well :)
> > But that is not a reason not to detect errors if we can,
> > and not to make APIs hard to misuse.
>
> Changing the domain of a device while dma can happen is the same type of
> bug as unmapping potential dma target addresses. We can't catch this
> kind of misuse.
you normally need device mapped to start DMA.
SHARE makes this bug more likely as you allow
switching domains: mmap could be done before switching.
> > > > With 10 devices you have 10 extra ioctls.
> > >
> > > And this works implicitly with your proposal?
> >
> > Yes. so you do:
> > iommu = open
> > ioctl(dev1, BIND, iommu)
> > ioctl(dev2, BIND, iommu)
> > ioctl(dev3, BIND, iommu)
> > ioctl(dev4, BIND, iommu)
> >
> > No need to add a SHARE ioctl.
>
> In my proposal this looks like:
>
>
> dev1 = open();
> ioctl(dev2, SHARE, dev1);
> ioctl(dev3, SHARE, dev1);
> ioctl(dev4, SHARE, dev1);
>
> So we actually save an ioctl.
I thought we had a BIND ioctl?
> > > Remember that we still need to be able to provide seperate mappings
> > > for each device to support IOMMU emulation for the guest.
> >
> > Generally not true. E.g. guest can enable iommu passthrough
> > or have domain per a group of devices.
>
> What I meant was that there may me multiple io-addresses spaces
> necessary for one process. I didn't want to say that every device
> _needs_ to have its own address space.
>
> > > As I wrote the domain has a reference count and is destroyed only when
> > > it goes down to zero. This does not happen as long as a device is bound
> > > to it.
> > >
> > > Joerg
> >
> > We were talking about UNSHARE ioctl:
> > ioctl(dev1, UNSHARE, dev2)
> > Does it change the domain for dev1 or dev2?
> > If you make a mistake you get a hard to debug bug.
>
> As I already wrote we would have an UNBIND ioctl which just removes a
> device from its current domain. UNBIND is better than UNSHARE for
> exactly the reason you pointed out above. I thought I stated that
> already.
>
> Joerg
You undo SHARE with UNBIND?
next prev parent reply other threads:[~2010-06-02 12:38 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-28 23:07 [PATCH] VFIO driver: Non-privileged user level PCI drivers Tom Lyon
2010-05-28 23:36 ` Randy Dunlap
2010-05-28 23:56 ` Randy Dunlap
2010-05-29 11:55 ` Arnd Bergmann
2010-05-29 12:16 ` Avi Kivity
2010-05-30 12:19 ` Michael S. Tsirkin
2010-05-30 12:27 ` Avi Kivity
2010-05-30 12:49 ` Michael S. Tsirkin
2010-05-30 13:01 ` Avi Kivity
2010-05-30 13:03 ` Michael S. Tsirkin
2010-05-30 13:13 ` Avi Kivity
2010-05-30 14:53 ` Michael S. Tsirkin
2010-05-31 11:50 ` Avi Kivity
2010-05-31 17:10 ` Michael S. Tsirkin
2010-06-01 8:10 ` Avi Kivity
2010-06-01 9:55 ` Michael S. Tsirkin
2010-06-01 10:28 ` Avi Kivity
2010-06-01 10:46 ` Michael S. Tsirkin
2010-06-01 12:41 ` Avi Kivity
2010-06-02 9:45 ` Joerg Roedel
2010-06-02 9:49 ` Avi Kivity
2010-06-02 10:04 ` Joerg Roedel
2010-06-02 10:09 ` Michael S. Tsirkin
2010-06-02 11:21 ` Avi Kivity
2010-06-02 16:53 ` Chris Wright
2010-06-06 13:44 ` Avi Kivity
2010-06-02 10:15 ` Michael S. Tsirkin
2010-06-02 10:26 ` Joerg Roedel
2010-06-01 21:26 ` Tom Lyon
2010-06-02 2:59 ` Avi Kivity
2010-06-02 5:29 ` Chris Wright
2010-06-02 5:40 ` Avi Kivity
2010-06-02 4:29 ` Alex Williamson
2010-06-02 4:59 ` Tom Lyon
2010-06-02 5:08 ` Avi Kivity
2010-06-02 9:53 ` Joerg Roedel
2010-06-02 9:42 ` Joerg Roedel
2010-06-02 9:50 ` Avi Kivity
2010-06-02 9:53 ` Michael S. Tsirkin
2010-06-02 10:19 ` Joerg Roedel
2010-06-02 10:21 ` Michael S. Tsirkin
2010-06-02 10:35 ` Joerg Roedel
2010-06-02 10:38 ` Michael S. Tsirkin
2010-06-02 11:12 ` Joerg Roedel
2010-06-02 11:21 ` Michael S. Tsirkin
2010-06-02 12:19 ` Joerg Roedel
2010-06-02 12:25 ` Avi Kivity
2010-06-02 12:50 ` Joerg Roedel
2010-06-02 13:06 ` Avi Kivity
2010-06-02 13:53 ` Joerg Roedel
2010-06-02 13:17 ` Michael S. Tsirkin
2010-06-02 14:01 ` Joerg Roedel
2010-06-02 12:34 ` Michael S. Tsirkin [this message]
2010-06-02 13:02 ` Joerg Roedel
2010-06-02 17:46 ` Chris Wright
2010-06-02 18:09 ` Tom Lyon
2010-06-02 19:46 ` Joerg Roedel
2010-06-03 6:23 ` Avi Kivity
2010-06-03 21:41 ` Tom Lyon
2010-06-06 9:54 ` Michael S. Tsirkin
2010-06-07 19:01 ` Tom Lyon
2010-06-08 21:22 ` Michael S. Tsirkin
2010-06-02 10:44 ` Michael S. Tsirkin
2010-05-30 12:59 ` Avi Kivity
2010-05-31 17:17 ` Alan Cox
2010-06-01 21:29 ` Tom Lyon
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=20100602123417.GA29815@redhat.com \
--to=mst@redhat.com \
--cc=aafabbri@cisco.com \
--cc=avi@redhat.com \
--cc=chrisw@sous-sol.org \
--cc=gregkh@suse.de \
--cc=hjk@linutronix.de \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pugs@cisco.com \
--cc=scofeldm@cisco.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).