[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b287e6a4e5968e524daeeee4216286666a83bcd8.camel@infradead.org>
Date: Tue, 22 Jun 2021 08:28:51 +0100
From: David Woodhouse <dwmw2@...radead.org>
To: Jason Wang <jasowang@...hat.com>, netdev <netdev@...r.kernel.org>
Cc: Eugenio PĂ©rez <eperezma@...hat.com>
Subject: Re: [PATCH] net: tun: fix tun_xdp_one() for IFF_TUN mode
On Tue, 2021-06-22 at 12:34 +0800, Jason Wang wrote:
> >
> > Secondly, I need to pull numbers out of my posterior for the
> > VHOST_SET_MEM_TABLE call. This works for x86_64:
> >
> > vmem->nregions = 1;
> > vmem->regions[0].guest_phys_addr = 4096;
> > vmem->regions[0].memory_size = 0x7fffffffe000;
> > vmem->regions[0].userspace_addr = 4096;
> > if (ioctl(vpninfo->vhost_fd, VHOST_SET_MEM_TABLE, vmem) < 0) {
> >
> > Is there a way to bypass that and just unconditionally set a 1:1
> > mapping of *all* userspace address space?
>
>
> Memory Table is one of the basic abstraction of the vhost. Basically,
> you only need to map the userspace buffers. This is how DPDK virtio-user
> PMD did. Vhost will validate the addresses through access_ok() during
> VHOST_SET_MEM_TABLE.
>
> The range of all usersapce space seems architecture specific, I'm not
> sure if it's worth to bother.
The buffers are just malloc'd. I just need a full 1:1 mapping of all
"guest" memory to userspace addresses, and was trying to avoid having
to map them on demand *just* because I don't know the full range of
possible addresses that malloc will return, in advance.
I'm tempted to add a new feature for that 1:1 access, with no ->umem or
->iotlb at all. And then I can use it as a key to know that the XDP
bugs are fixed too :)
Download attachment "smime.p7s" of type "application/x-pkcs7-signature" (5174 bytes)
Powered by blists - more mailing lists