Re: [PATCH net-next V4 0/5] vhost: accelerate metadata access through vmap()

From: Jason Wang
Date: Mon Jan 28 2019 - 21:35:01 EST



On 2019/1/27 äå8:31, Michael S. Tsirkin wrote:
On Sat, Jan 26, 2019 at 02:37:08PM -0800, David Miller wrote:
From: Jason Wang <jasowang@xxxxxxxxxx>
Date: Wed, 23 Jan 2019 17:55:52 +0800

This series tries to access virtqueue metadata through kernel virtual
address instead of copy_user() friends since they had too much
overheads like checks, spec barriers or even hardware feature
toggling.

Test shows about 24% improvement on TX PPS. It should benefit other
cases as well.
I've read over the discussion of patch #5 a few times.

And it seems to me that, at a minimum, a few things still need to
be resolved:

1) More perf data added to commit message.


Ok.



2) Whether invalidate_range_start() and invalidate_range_end() must
be paired.


The reason that vhost doesn't need an invalidate_range_end() is because we have a fallback to copy_to_user() friends. So there's no requirement to setup the mapping in range_end() or lock the vq between range_start() and range_end(). We try to delay the setup of vmap until it will be really used in vhost_meta_prefetch() and we hold mmap_sem when trying to setup vmap, this will guarantee there's no intermediate state at this time.



Add dirty tracking.


I think this could be solved by introducing e.g vhost_meta_prefetch_done() at the end of handle_tx()/handle_rx() and call set_page_dirty() for used pages instead of the tricks of classifying VMA. (As I saw hugetlbfs has its own set dirty method).

Thanks



Etc. So I am marking this series "Changes Requested".