[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cfe1ddd7-cc14-49ee-4126-83bd940b5777@redhat.com>
Date: Tue, 22 Jun 2021 16:00:19 +0800
From: Jason Wang <jasowang@...hat.com>
To: David Woodhouse <dwmw2@...radead.org>,
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
在 2021/6/22 下午3:28, David Woodhouse 写道:
> 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 :)
This means we need validate the userspace address each time before vhost
tries to use that. This will de-gradate the performance. So we still
need to figure out the legal userspace address range which might not be
easy.
Thanks
>
Powered by blists - more mailing lists