linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Tom Lyon <pugs@lyon-about.com>
Cc: randy.dunlap@oracle.com, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org, chrisw@sous-sol.org, joro@8bytes.org,
	hjk@linutronix.de, mst@redhat.com, avi@redhat.com,
	gregkh@suse.de, aafabbri@cisco.com, scofeldm@cisco.com
Subject: Re: [PATCH V2] VFIO driver: Non-privileged user level PCI drivers
Date: Wed, 30 Jun 2010 23:16:33 -0600	[thread overview]
Message-ID: <1277961393.10112.37.camel@x201> (raw)
In-Reply-To: <201006302130.38987.pugs@lyon-about.com>

On Wed, 2010-06-30 at 21:30 -0700, Tom Lyon wrote:
> On Wednesday 30 June 2010 09:16:23 pm Alex Williamson wrote:
> > On Tue, 2010-06-08 at 14:21 -0700, Tom Lyon wrote:
> > > +int vfio_dma_unmap_dm(struct vfio_listener *listener, struct vfio_dma_map *dmp)
> > > +{
> > > +	unsigned long start, npage;
> > > +	struct dma_map_page *mlp;
> > > +	struct list_head *pos, *pos2;
> > > +	int ret;
> > > +
> > > +	start = dmp->vaddr & ~PAGE_SIZE;
> > > +	npage = dmp->size >> PAGE_SHIFT;
> > > +
> > > +	ret = -ENXIO;
> > > +	mutex_lock(&listener->vdev->dgate);
> > > +	list_for_each_safe(pos, pos2, &listener->dm_list) {
> > > +		mlp = list_entry(pos, struct dma_map_page, list);
> > > +		if (dmp->vaddr != mlp->vaddr || mlp->npage != npage)
> > > +			continue;
> > > +		ret = 0;
> > > +		vfio_dma_unmap(listener, mlp);
> > > +		break;
> > > +	}
> > 
> > Hi Tom,
> > 
> > Shouldn't we be matching the mlp based on daddr instead of vaddr?  We
> > can have multiple dma address pointing at the same virtual address, so
> > dma address is the unique element.  I'm also nervous about this dm_list.
> > For qemu device assignment, we're potentially statically mapping many GB
> > of iova space.  It seems like this could get incredibly bloated and
> > slow.  Thanks,
> > 
> > Alex
> 
> In weird circumstances, differing user vaddrs could reolve to the same physical address,
> so the uniqueness of any mapping is the <vaddr,len>.

That sounds like another argument for using daddr to me, no?  There's
only one address space on the PCI bus, daddr.  There's a 1:1 mapping of
daddr to physical page, but an N:1 mapping of vaddr to a physical page.

> Yes, a linear list is slow, but does qemu need a lot of mappings, or just big ones?

I'm not sure yet, the first interface I tried seems to be giving me
handfuls of pages.  We sometimes reprogram the guest physical address
(daddr) to a new virtual address (vaddr), but I don't know what the old
virtual address was, so I can't unmap it.  That's when I ran into the
issue above.  Thanks,

Alex


  reply	other threads:[~2010-07-01  5:17 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-08 21:21 [PATCH V2] VFIO driver: Non-privileged user level PCI drivers Tom Lyon
2010-06-08 21:41 ` Randy Dunlap
2010-06-09 12:11   ` Arnd Bergmann
2010-06-08 21:45 ` Randy Dunlap
2010-06-08 22:38 ` Michael S. Tsirkin
2010-06-08 23:54   ` Tom Lyon
2010-06-09  5:45     ` Michael S. Tsirkin
2010-06-11 22:15       ` Tom Lyon
2010-06-13 10:23         ` Michael S. Tsirkin
2010-06-17 21:14           ` Tom Lyon
2010-06-17 21:47             ` Michael S. Tsirkin
2010-06-24 12:22             ` Joerg Roedel
2010-06-24 15:03               ` Michael S. Tsirkin
2010-06-09 11:04 ` Avi Kivity
2010-06-09 15:25   ` Greg KH
2010-06-09 16:05 ` Michael S. Tsirkin
2010-06-10 17:27 ` Konrad Rzeszutek Wilk
2010-06-11  1:58   ` Tom Lyon
2010-06-11  4:19     ` Greg KH
2010-06-11  4:56     ` Avi Kivity
2010-06-30  6:14 ` Alex Williamson
2010-06-30 13:36   ` Michael S. Tsirkin
2010-06-30 14:00     ` Alex Williamson
2010-06-30 22:17   ` Tom Lyon
2010-06-30 22:32     ` Michael S. Tsirkin
2010-06-30 22:49       ` Tom Lyon
2010-07-01  4:16 ` Alex Williamson
2010-07-01  4:30   ` Tom Lyon
2010-07-01  5:16     ` Alex Williamson [this message]
2010-07-01 15:29 ` Alex Williamson
2010-07-01 15:31   ` Michael S. Tsirkin
2010-07-01 15:48     ` Alex Williamson
2010-07-01 16:22       ` Michael S. Tsirkin
2010-07-01 18:49       ` Tom Lyon
2010-07-06  4:50 ` Alex Williamson

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=1277961393.10112.37.camel@x201 \
    --to=alex.williamson@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=mst@redhat.com \
    --cc=pugs@lyon-about.com \
    --cc=randy.dunlap@oracle.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).