blob: 1432a7122e69c8d5b55c4824ffc86fc79f740624 [file] [log] [blame]
Return-Path: <>
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0
Received: from ( [])
by (Postfix) with ESMTP id 0F2A9C10F14
for <>; Tue, 23 Apr 2019 05:54:33 +0000 (UTC)
Received: from ( [])
by (Postfix) with ESMTP id D159A20674
for <>; Tue, 23 Apr 2019 05:54:32 +0000 (UTC)
Received: ( by via listexpand
id S1725939AbfDWFyc (ORCPT
Tue, 23 Apr 2019 01:54:32 -0400
Received: from ([]:37488 "EHLO"
rhost-flags-OK-OK-OK-OK) by with ESMTP
id S1725888AbfDWFyc (ORCPT <rfc822;>);
Tue, 23 Apr 2019 01:54:32 -0400
Received: from ( [])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by (Postfix) with ESMTPS id D805D20277;
Tue, 23 Apr 2019 05:54:31 +0000 (UTC)
Received: from ( [])
by (Postfix) with ESMTP id 7040E19C7E;
Tue, 23 Apr 2019 05:54:22 +0000 (UTC)
From: Jason Wang <>
Subject: [RFC PATCH V3 0/6] vhost: accelerate metadata access
Date: Tue, 23 Apr 2019 01:54:14 -0400
Message-Id: <>
X-Scanned-By: MIMEDefang 2.84 on
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 ( []); Tue, 23 Apr 2019 05:54:32 +0000 (UTC)
Precedence: bulk
List-ID: <>
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. This is done through setup kernel address through direct
mapping and co-opreate VM management with MMU notifiers.
Test shows about 23% improvement on TX PPS. TCP_STREAM doesn't see
obvious improvement.
Changes from RFC V2:
- switch to use direct mapping instead of vmap()
- switch to use spinlock + RCU to synchronize MMU notifier and vhost
data/control path
- set dirty pages in the invalidation callbacks
- always use copy_to/from_users() friends for the archs that may need
- various minor fixes
Changes from V4:
- use invalidate_range() instead of invalidate_range_start()
- track dirty pages
Changes from V3:
- don't try to use vmap for file backed pages
- rebase to master
Changes from V2:
- fix buggy range overlapping check
- tear down MMU notifier during vhost ioctl to make sure invalidation
request can read metadata userspace address and vq size without
holding vq mutex.
Changes from V1:
- instead of pinning pages, use MMU notifier to invalidate vmaps and
remap duing metadata prefetch
- fix build warning on MIPS
Jason Wang (6):
vhost: generalize adding used elem
vhost: fine grain userspace memory accessors
vhost: rename vq_iotlb_prefetch() to vq_meta_prefetch()
vhost: introduce helpers to get the size of metadata area
vhost: factor out setting vring addr and num
vhost: access vq metadata through kernel virtual address
drivers/vhost/net.c | 4 +-
drivers/vhost/vhost.c | 852 ++++++++++++++++++++++++++++++++++++------
drivers/vhost/vhost.h | 34 +-
3 files changed, 764 insertions(+), 126 deletions(-)