Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp26726imu; Thu, 24 Jan 2019 19:02:29 -0800 (PST) X-Google-Smtp-Source: ALg8bN774/W+58DrjVP9wePXUULRmU3ieP0gbfqdbcGFR6PFwz0Aw4JfRRj+8snLa7jI54y2mCoZ X-Received: by 2002:a63:4926:: with SMTP id w38mr8004845pga.353.1548385349832; Thu, 24 Jan 2019 19:02:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548385349; cv=none; d=google.com; s=arc-20160816; b=DfEQKve07m+IZeYW5rPbh1JnEKTjxvOqCwoO8s6+oweEk/ZWhDYofXBO6lwoAv9R7Z EVyAUz8tLo4rERaYjEqxs2XJ+2Z27N2mOEjJsDy/Srn8uO57GMJX/m0yawmPjIJe7TVo xmkHKVEr9gZTBhMYqtZ9/5W8VxEClkx3G6nU2yn8eB1Jkf5KrpcAnYm2fpnauoyWnSsv SzNBN72KuC3rpYecidh9YlLAXe1HJtRSm5ZgvDQI7vSq4menxMnzHO5djsZh8ntekWkF q1xR5Ab2xFMs/ol+NBtn2uvY75YY2AB9tJsWSNAPxja485WeOyAlSc7R6q33AG0lHPEo THSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=mZjOvZHzJZfJRyZqQ0jVra0J6wT0Y3FMgLdS67rDGDc=; b=JOtCh0PChZHJofaKS14Gx7r42ph74Fuol0zDJkztXXm375CS0EpsTYMtvfltWTdFLl 5GCno+xjoCCw3egXKeufITRPkns9foubNXAQA1/qSIWBTxzcIfsPJltWsRgbX7cN6L+N xjQid06jpiKPqR0KEQnLhWdwOjxUi2suYpaPzSyTsKosEzpcmyLiZeuHK2zLdDVWH/xK aMsmWZPL5Vy4oViBfMOSCZikAby4Odq2tyddWMkK/AW9wPaaL9ZRXYQ5/q3DznDVwItp yoZZFPsW4t82WAhSYg+W790JbjIEUbVwCNlSqO1OdGQmygKBKLVf1TLlhOqLwU+LahVz msbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h189si23362646pfc.211.2019.01.24.19.02.08; Thu, 24 Jan 2019 19:02:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728703AbfAYDAa (ORCPT + 99 others); Thu, 24 Jan 2019 22:00:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36366 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725991AbfAYDAa (ORCPT ); Thu, 24 Jan 2019 22:00:30 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3E7002CD7EC; Fri, 25 Jan 2019 03:00:30 +0000 (UTC) Received: from redhat.com (ovpn-120-141.rdu2.redhat.com [10.10.120.141]) by smtp.corp.redhat.com (Postfix) with SMTP id 6B78917117; Fri, 25 Jan 2019 03:00:27 +0000 (UTC) Date: Thu, 24 Jan 2019 22:00:27 -0500 From: "Michael S. Tsirkin" To: Jason Wang Cc: virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH net-next V4 5/5] vhost: access vq metadata through kernel virtual address Message-ID: <20190124215912-mutt-send-email-mst@kernel.org> References: <20190123095557.30168-1-jasowang@redhat.com> <20190123095557.30168-6-jasowang@redhat.com> <20190123085821-mutt-send-email-mst@kernel.org> <335ba55b-087f-4b35-6311-540070b9647f@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <335ba55b-087f-4b35-6311-540070b9647f@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 25 Jan 2019 03:00:30 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 24, 2019 at 12:07:54PM +0800, Jason Wang wrote: > > Meanwhile, could you pls post data comparing this last patch with the > > below? This removes the speculation barrier replacing it with a > > (useless but at least more lightweight) data dependency. > > > SMAP off > > Your patch: 7.2MPPs > > vmap: 7.4Mpps OK so while we keep looking into vmap, why don't we merge something like the below? Seems quite straight forward ... > I don't test SMAP on, since it will be much slow for sure. > > Thanks > > > > > > Thanks! > > > > > > diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c > > index bac939af8dbb..352ee7e14476 100644 > > --- a/drivers/vhost/vhost.c > > +++ b/drivers/vhost/vhost.c > > @@ -739,7 +739,7 @@ static int vhost_copy_to_user(struct vhost_virtqueue *vq, void __user *to, > > int ret; > > if (!vq->iotlb) > > - return __copy_to_user(to, from, size); > > + return copy_to_user(to, from, size); > > else { > > /* This function should be called after iotlb > > * prefetch, which means we're sure that all vq > > @@ -752,7 +752,7 @@ static int vhost_copy_to_user(struct vhost_virtqueue *vq, void __user *to, > > VHOST_ADDR_USED); > > if (uaddr) > > - return __copy_to_user(uaddr, from, size); > > + return copy_to_user(uaddr, from, size); > > ret = translate_desc(vq, (u64)(uintptr_t)to, size, vq->iotlb_iov, > > ARRAY_SIZE(vq->iotlb_iov), > > @@ -774,7 +774,7 @@ static int vhost_copy_from_user(struct vhost_virtqueue *vq, void *to, > > int ret; > > if (!vq->iotlb) > > - return __copy_from_user(to, from, size); > > + return copy_from_user(to, from, size); > > else { > > /* This function should be called after iotlb > > * prefetch, which means we're sure that vq > > @@ -787,7 +787,7 @@ static int vhost_copy_from_user(struct vhost_virtqueue *vq, void *to, > > struct iov_iter f; > > if (uaddr) > > - return __copy_from_user(to, uaddr, size); > > + return copy_from_user(to, uaddr, size); > > ret = translate_desc(vq, (u64)(uintptr_t)from, size, vq->iotlb_iov, > > ARRAY_SIZE(vq->iotlb_iov), > > @@ -855,13 +855,13 @@ static inline void __user *__vhost_get_user(struct vhost_virtqueue *vq, > > ({ \ > > int ret = -EFAULT; \ > > if (!vq->iotlb) { \ > > - ret = __put_user(x, ptr); \ > > + ret = put_user(x, ptr); \ > > } else { \ > > __typeof__(ptr) to = \ > > (__typeof__(ptr)) __vhost_get_user(vq, ptr, \ > > sizeof(*ptr), VHOST_ADDR_USED); \ > > if (to != NULL) \ > > - ret = __put_user(x, to); \ > > + ret = put_user(x, to); \ > > else \ > > ret = -EFAULT; \ > > } \ > > @@ -872,14 +872,14 @@ static inline void __user *__vhost_get_user(struct vhost_virtqueue *vq, > > ({ \ > > int ret; \ > > if (!vq->iotlb) { \ > > - ret = __get_user(x, ptr); \ > > + ret = get_user(x, ptr); \ > > } else { \ > > __typeof__(ptr) from = \ > > (__typeof__(ptr)) __vhost_get_user(vq, ptr, \ > > sizeof(*ptr), \ > > type); \ > > if (from != NULL) \ > > - ret = __get_user(x, from); \ > > + ret = get_user(x, from); \ > > else \ > > ret = -EFAULT; \ > > } \