Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp399444imu; Thu, 8 Nov 2018 03:55:35 -0800 (PST) X-Google-Smtp-Source: AJdET5fkl6Hl0qVVuJ0Gofcda7cCmkCG9Zb2OB1wqpdDPWhzosa44ZfIFO81m5zvv2I8PyuKOGFT X-Received: by 2002:a63:f412:: with SMTP id g18mr3556046pgi.262.1541678135850; Thu, 08 Nov 2018 03:55:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541678135; cv=none; d=google.com; s=arc-20160816; b=zviNQwBFtxu4Bw1ZQGQ2XUNvRydkRFpW6E8JuuTzlyIY9nDfcaa6tczVxEC63Zcq/4 MlvQT3Tkl6FAVqmrPyF78tbQlecvqyWQAy8siysgGtojaarpsR/cxP9FezNX5HdSduxG P9hvrf4QtCumAklpTRm2xrgKnjeNowh+/7V63lP8wk8NvDjoosBg5zEkxKzZxLGuppX8 GWfDMw7QJa6qDDO44a5Jls1Y5kYxegGkIqs9Rg841BYPf4P1aWNFsnk/0vYzKf4z+iL+ Nh6Q0DiKJYSMtOWffWRUZLeDkrzDUFh+4Ip7mTJCOI5ettrUb7GAMG3m7avyOxDt3Kpb X+vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=sy2CshLMTKyIIKbcs7qE3T0Bz2XyKAIb+L0f1xMlI58=; b=Gg3Dub1E23sS4npBgVdKKeAirv8tlBjJPh9wBh5hfPOyet3bL7zC2y6RzrVmtGX9PO o+ismKlY3bZQFFZi/OC5CjkRoct7+NBI9LcIYBH4SGqXJulApLpPd5pS3wN7ByuN1ayW q5wBOLYXeXijR7ux2qbv69Q3wYtje6jABHB4YmGHsvf0xYZ0avib3RLmNLfczJJywXEV srLpeqBGOhNTNSpByDn0D2yQLUyYemdnRPHUf56LXv+bhNwboDvxMAmBtU0/mJ9UzxcV AHzeAD5Jbt3tiflsSLm5/ek1voy9/ENV1AKX7uaLtQNj+fJicHjrWd1UkJ8FvBJ4hj5F rbJw== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si3925215pfd.146.2018.11.08.03.55.19; Thu, 08 Nov 2018 03:55:35 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726924AbeKHV2b (ORCPT + 99 others); Thu, 8 Nov 2018 16:28:31 -0500 Received: from mga14.intel.com ([192.55.52.115]:64446 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726304AbeKHV2b (ORCPT ); Thu, 8 Nov 2018 16:28:31 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Nov 2018 03:53:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,478,1534834800"; d="scan'208";a="84292164" Received: from btwcube1.sh.intel.com (HELO debian) ([10.67.104.173]) by fmsmga007.fm.intel.com with ESMTP; 08 Nov 2018 03:53:21 -0800 Date: Thu, 8 Nov 2018 19:51:48 +0800 From: Tiwei Bie To: Jason Wang Cc: "Michael S. Tsirkin" , virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, virtio-dev@lists.oasis-open.org, wexu@redhat.com, jfreimann@redhat.com Subject: Re: [PATCH net-next v2 3/5] virtio_ring: add packed ring support Message-ID: <20181108115148.GA15701@debian> References: <20180711022711.7090-1-tiwei.bie@intel.com> <20180711022711.7090-4-tiwei.bie@intel.com> <20181107123933-mutt-send-email-mst@kernel.org> <20181108013759.GA20591@debian> <2d46a41e-bc00-276a-e19a-105c9dffc75a@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2d46a41e-bc00-276a-e19a-105c9dffc75a@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 08, 2018 at 04:18:25PM +0800, Jason Wang wrote: > > On 2018/11/8 上午9:38, Tiwei Bie wrote: > > > > + > > > > + if (vq->vq.num_free < descs_used) { > > > > + pr_debug("Can't add buf len %i - avail = %i\n", > > > > + descs_used, vq->vq.num_free); > > > > + /* FIXME: for historical reasons, we force a notify here if > > > > + * there are outgoing parts to the buffer. Presumably the > > > > + * host should service the ring ASAP. */ > > > I don't think we have a reason to do this for packed ring. > > > No historical baggage there, right? > > Based on the original commit log, it seems that the notify here > > is just an "optimization". But I don't quite understand what does > > the "the heuristics which KVM uses" refer to. If it's safe to drop > > this in packed ring, I'd like to do it. > > > According to the commit log, it seems like a workaround of lguest networking > backend. Do you know why removing this notify in Tx will break "the heuristics which KVM uses"? Or what does "the heuristics which KVM uses" refer to? > I agree to drop it, we should not have such burden. > > But we should notice that, with this removed, the compare between packed vs > split is kind of unfair. Consider the removal of lguest support recently, > maybe we can drop this for split ring as well? > > Thanks > > > > > > commit 44653eae1407f79dff6f52fcf594ae84cb165ec4 > > Author: Rusty Russell > > Date: Fri Jul 25 12:06:04 2008 -0500 > > > > virtio: don't always force a notification when ring is full > > We force notification when the ring is full, even if the host has > > indicated it doesn't want to know. This seemed like a good idea at > > the time: if we fill the transmit ring, we should tell the host > > immediately. > > Unfortunately this logic also applies to the receiving ring, which is > > refilled constantly. We should introduce real notification thesholds > > to replace this logic. Meanwhile, removing the logic altogether breaks > > the heuristics which KVM uses, so we use a hack: only notify if there are > > outgoing parts of the new buffer. > > Here are the number of exits with lguest's crappy network implementation: > > Before: > > network xmit 7859051 recv 236420 > > After: > > network xmit 7858610 recv 118136 > > Signed-off-by: Rusty Russell > > > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c > > index 72bf8bc09014..21d9a62767af 100644 > > --- a/drivers/virtio/virtio_ring.c > > +++ b/drivers/virtio/virtio_ring.c > > @@ -87,8 +87,11 @@ static int vring_add_buf(struct virtqueue *_vq, > > if (vq->num_free < out + in) { > > pr_debug("Can't add buf len %i - avail = %i\n", > > out + in, vq->num_free); > > - /* We notify*even if* VRING_USED_F_NO_NOTIFY is set here. */ > > - vq->notify(&vq->vq); > > + /* FIXME: for historical reasons, we force a notify here if > > + * there are outgoing parts to the buffer. Presumably the > > + * host should service the ring ASAP. */ > > + if (out) > > + vq->notify(&vq->vq); > > END_USE(vq); > > return -ENOSPC; > > } > > > >