From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2C46C43387 for ; Tue, 25 Dec 2018 12:52:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B2FBE2173B for ; Tue, 25 Dec 2018 12:52:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725918AbeLYMwp (ORCPT ); Tue, 25 Dec 2018 07:52:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48620 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725871AbeLYMwp (ORCPT ); Tue, 25 Dec 2018 07:52:45 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B5E6737E8E; Tue, 25 Dec 2018 12:52:44 +0000 (UTC) Received: from redhat.com (ovpn-120-80.rdu2.redhat.com [10.10.120.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id 70726600C2; Tue, 25 Dec 2018 12:52:43 +0000 (UTC) Date: Tue, 25 Dec 2018 07:52:42 -0500 From: "Michael S. Tsirkin" To: Jason Wang Cc: kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 0/3] vhost: accelerate metadata access through vmap() Message-ID: <20181225075054-mutt-send-email-mst@kernel.org> References: <20181213101022.12475-1-jasowang@redhat.com> <20181213102315-mutt-send-email-mst@kernel.org> <9459e227-a943-8553-732b-d7f5225a0f22@redhat.com> <20181214072334-mutt-send-email-mst@kernel.org> <20181224131040-mutt-send-email-mst@kernel.org> <51fa034d-99ae-3820-c3a4-d9e6f2eefe34@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <51fa034d-99ae-3820-c3a4-d9e6f2eefe34@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 25 Dec 2018 12:52:44 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 25, 2018 at 06:09:19PM +0800, Jason Wang wrote: > > On 2018/12/25 上午2:12, Michael S. Tsirkin wrote: > > On Mon, Dec 24, 2018 at 04:32:39PM +0800, Jason Wang wrote: > > > On 2018/12/14 下午8:33, Michael S. Tsirkin wrote: > > > > On Fri, Dec 14, 2018 at 11:42:18AM +0800, Jason Wang wrote: > > > > > On 2018/12/13 下午11:27, Michael S. Tsirkin wrote: > > > > > > On Thu, Dec 13, 2018 at 06:10:19PM +0800, Jason Wang wrote: > > > > > > > Hi: > > > > > > > > > > > > > > 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. > > > > > > Userspace accesses through remapping tricks and next time there's a need > > > > > > for a new barrier we are left to figure it out by ourselves. > > > > > I don't get here, do you mean spec barriers? > > > > I mean the next barrier people decide to put into userspace > > > > memory accesses. > > > > > > > > > It's completely unnecessary for > > > > > vhost which is kernel thread. > > > > It's defence in depth. Take a look at the commit that added them. > > > > And yes quite possibly in most cases we actually have a spec > > > > barrier in the validation phase. If we do let's use the > > > > unsafe variants so they can be found. > > > > > > unsafe variants can only work if you can batch userspace access. This is not > > > necessarily the case for light load. > > > > Do we care a lot about the light load? How would you benchmark it? > > > > If we can reduce the latency that's will be more than what we expect. > > 1 byte TCP_RR shows 1.5%-2% improvement. It's nice but not great. E.g. adaptive polling would be a better approach to work on latency imho. > > > > > > And even if you're right, vhost is not the > > > > > only place, there's lots of vmap() based accessing in kernel. > > > > For sure. But if one can get by without get user pages, one > > > > really should. Witness recently uncovered mess with file > > > > backed storage. > > > > > > We only pin metadata pages, I don't believe they will be used by any DMA. > > It doesn't matter really, if you dirty pages behind the MM back > > the problem is there. > > > Ok, but the usual case is anonymous pages, do we use file backed pages for > user of vhost? Some people use file backed pages for vms. Nothing prevents them from using vhost as well. > And even if we use sometime, according to the pointer it's > not something that can fix, RFC has been posted to solve this issue. > > Thanks Except it's not broken if we don't to gup + write. So yea, wait for rfc to be merged.