All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: Tiwei Bie <tiwei.bie@intel.com>,
	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
Date: Thu, 8 Nov 2018 23:00:28 -0500	[thread overview]
Message-ID: <20181108225858-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <67bd6a88-00f2-ed13-ad13-bdfe92ceeffc@redhat.com>

On Fri, Nov 09, 2018 at 10:30:50AM +0800, Jason Wang wrote:
> 
> On 2018/11/8 下午11:56, Michael S. Tsirkin wrote:
> > On Thu, Nov 08, 2018 at 07:51:48PM +0800, Tiwei Bie wrote:
> > > 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?
> > Yes. QEMU has a mode where it disables notifications and processes TX
> > ring periodically from a timer.  It's off by default but used to be on
> > by default a long time ago. If ring becomes full this causes traffic
> > stalls.
> 
> 
> Do you mean tx-timer? If yes, we can still enable it for packed ring

Yes we can but I doubt anyone does.

> and the
> timer will finally fired and we can go.

on tx ring full we probably don't want to wait for timer.
But I think we can just prevent qemu from using tx timer
with virtio 1.

> 
> > As a work-around Rusty put in this hack to kick on ring full
> > even with notifications disabled.
> 
> 
> From the commit log it looks more like a performance workaround instead of a
> bug fix.

it's a quality of implementation issue, yes.

> 
> > It's easy enough to make sure QEMU
> > does not combine devices with packed ring support with the timer hack.
> > And I am guessing it's safe enough to also block that option completely
> > e.g. when virtio 1.0 is enabled.
> 
> 
> I agree.
> 
> Thanks
> 
> 
> > > > 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<rusty@rustcorp.com.au>
> > > > > 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<rusty@rustcorp.com.au>
> > > > > 
> > > > > 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;
> > > > >    	}
> > > > > 
> > > > > 

WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: Tiwei Bie <tiwei.bie@intel.com>,
	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: [virtio-dev] Re: [PATCH net-next v2 3/5] virtio_ring: add packed ring support
Date: Thu, 8 Nov 2018 23:00:28 -0500	[thread overview]
Message-ID: <20181108225858-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <67bd6a88-00f2-ed13-ad13-bdfe92ceeffc@redhat.com>

On Fri, Nov 09, 2018 at 10:30:50AM +0800, Jason Wang wrote:
> 
> On 2018/11/8 下午11:56, Michael S. Tsirkin wrote:
> > On Thu, Nov 08, 2018 at 07:51:48PM +0800, Tiwei Bie wrote:
> > > 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?
> > Yes. QEMU has a mode where it disables notifications and processes TX
> > ring periodically from a timer.  It's off by default but used to be on
> > by default a long time ago. If ring becomes full this causes traffic
> > stalls.
> 
> 
> Do you mean tx-timer? If yes, we can still enable it for packed ring

Yes we can but I doubt anyone does.

> and the
> timer will finally fired and we can go.

on tx ring full we probably don't want to wait for timer.
But I think we can just prevent qemu from using tx timer
with virtio 1.

> 
> > As a work-around Rusty put in this hack to kick on ring full
> > even with notifications disabled.
> 
> 
> From the commit log it looks more like a performance workaround instead of a
> bug fix.

it's a quality of implementation issue, yes.

> 
> > It's easy enough to make sure QEMU
> > does not combine devices with packed ring support with the timer hack.
> > And I am guessing it's safe enough to also block that option completely
> > e.g. when virtio 1.0 is enabled.
> 
> 
> I agree.
> 
> Thanks
> 
> 
> > > > 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<rusty@rustcorp.com.au>
> > > > > 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<rusty@rustcorp.com.au>
> > > > > 
> > > > > 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;
> > > > >    	}
> > > > > 
> > > > > 

---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org


  reply	other threads:[~2018-11-09  4:00 UTC|newest]

Thread overview: 167+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-11  2:27 [PATCH net-next v2 0/5] virtio: support packed ring Tiwei Bie
2018-07-11  2:27 ` [virtio-dev] " Tiwei Bie
2018-07-11  2:27 ` Tiwei Bie
2018-07-11  2:27 ` [PATCH net-next v2 1/5] virtio: add packed ring definitions Tiwei Bie
2018-07-11  2:27   ` [virtio-dev] " Tiwei Bie
2018-09-07 13:51   ` Michael S. Tsirkin
2018-09-07 13:51     ` [virtio-dev] " Michael S. Tsirkin
2018-09-10  2:13     ` Tiwei Bie
2018-09-10  2:13       ` [virtio-dev] " Tiwei Bie
2018-09-12 12:53       ` Michael S. Tsirkin
2018-09-12 12:53       ` Michael S. Tsirkin
2018-09-12 12:53         ` [virtio-dev] " Michael S. Tsirkin
2018-09-10  2:13     ` Tiwei Bie
2018-09-07 13:51   ` Michael S. Tsirkin
2018-07-11  2:27 ` Tiwei Bie
2018-07-11  2:27 ` [PATCH net-next v2 2/5] virtio_ring: support creating packed ring Tiwei Bie
2018-07-11  2:27   ` [virtio-dev] " Tiwei Bie
2018-09-07 14:03   ` Michael S. Tsirkin
2018-09-07 14:03   ` Michael S. Tsirkin
2018-09-07 14:03     ` [virtio-dev] " Michael S. Tsirkin
2018-09-10  2:28     ` Tiwei Bie
2018-09-10  2:28       ` [virtio-dev] " Tiwei Bie
2018-09-12  7:51       ` Tiwei Bie
2018-09-12  7:51       ` Tiwei Bie
2018-09-12  7:51         ` [virtio-dev] " Tiwei Bie
2018-09-12 16:12         ` Michael S. Tsirkin
2018-09-12 16:12         ` Michael S. Tsirkin
2018-09-12 16:12           ` [virtio-dev] " Michael S. Tsirkin
2018-09-12 12:45       ` Michael S. Tsirkin
2018-09-12 12:45         ` [virtio-dev] " Michael S. Tsirkin
2018-09-12 12:45       ` Michael S. Tsirkin
2018-09-10  2:28     ` Tiwei Bie
2018-07-11  2:27 ` Tiwei Bie
2018-07-11  2:27 ` [PATCH net-next v2 3/5] virtio_ring: add packed ring support Tiwei Bie
2018-07-11  2:27   ` [virtio-dev] " Tiwei Bie
2018-09-07 13:49   ` Michael S. Tsirkin
2018-09-07 13:49   ` Michael S. Tsirkin
2018-09-07 13:49     ` [virtio-dev] " Michael S. Tsirkin
2018-09-10  2:03     ` Tiwei Bie
2018-09-10  2:03       ` [virtio-dev] " Tiwei Bie
2018-09-10  2:03       ` Tiwei Bie
2018-09-12 16:22   ` Michael S. Tsirkin
2018-09-12 16:22     ` [virtio-dev] " Michael S. Tsirkin
2018-09-12 16:22   ` Michael S. Tsirkin
2018-11-07 17:48   ` Michael S. Tsirkin
2018-11-07 17:48     ` [virtio-dev] " Michael S. Tsirkin
2018-11-08  1:38     ` Tiwei Bie
2018-11-08  1:38     ` Tiwei Bie
2018-11-08  1:38       ` [virtio-dev] " Tiwei Bie
2018-11-08  8:18       ` Jason Wang
2018-11-08  8:18       ` Jason Wang
2018-11-08  8:18         ` [virtio-dev] " Jason Wang
2018-11-08 11:51         ` Tiwei Bie
2018-11-08 11:51           ` [virtio-dev] " Tiwei Bie
2018-11-08 15:56           ` Michael S. Tsirkin
2018-11-08 15:56           ` Michael S. Tsirkin
2018-11-08 15:56             ` [virtio-dev] " Michael S. Tsirkin
2018-11-09  1:50             ` Tiwei Bie
2018-11-09  1:50             ` Tiwei Bie
2018-11-09  1:50               ` [virtio-dev] " Tiwei Bie
2018-11-09  2:30             ` Jason Wang
2018-11-09  2:30             ` Jason Wang
2018-11-09  2:30               ` [virtio-dev] " Jason Wang
2018-11-09  4:00               ` Michael S. Tsirkin [this message]
2018-11-09  4:00                 ` Michael S. Tsirkin
2018-11-09 10:05                 ` Jason Wang
2018-11-09 10:05                   ` [virtio-dev] " Jason Wang
2018-11-09 10:05                 ` Jason Wang
2018-11-09  4:00               ` Michael S. Tsirkin
2018-11-08 11:51         ` Tiwei Bie
2018-11-08 14:14         ` Michael S. Tsirkin
2018-11-08 14:14         ` Michael S. Tsirkin
2018-11-08 14:14           ` [virtio-dev] " Michael S. Tsirkin
2018-11-09  2:25           ` Jason Wang
2018-11-09  2:25             ` [virtio-dev] " Jason Wang
2018-11-09  3:58             ` Michael S. Tsirkin
2018-11-09  3:58             ` Michael S. Tsirkin
2018-11-09  3:58               ` [virtio-dev] " Michael S. Tsirkin
2018-11-09 10:04               ` Jason Wang
2018-11-09 10:04                 ` [virtio-dev] " Jason Wang
2018-11-09 10:04                 ` Jason Wang
2018-11-09  2:25           ` Jason Wang
2018-11-07 17:48   ` Michael S. Tsirkin
2018-07-11  2:27 ` Tiwei Bie
2018-07-11  2:27 ` [PATCH net-next v2 4/5] virtio_ring: add event idx support in packed ring Tiwei Bie
2018-07-11  2:27   ` [virtio-dev] " Tiwei Bie
2018-09-07 14:10   ` Michael S. Tsirkin
2018-09-07 14:10   ` Michael S. Tsirkin
2018-09-07 14:10     ` [virtio-dev] " Michael S. Tsirkin
2018-09-10  2:35     ` Tiwei Bie
2018-09-10  2:35     ` Tiwei Bie
2018-09-10  2:35       ` Tiwei Bie
2018-09-10  2:35       ` Tiwei Bie
2018-07-11  2:27 ` Tiwei Bie
2018-07-11  2:27 ` [PATCH net-next v2 5/5] virtio_ring: enable " Tiwei Bie
2018-07-11  2:27 ` Tiwei Bie
2018-07-11  2:27   ` [virtio-dev] " Tiwei Bie
2018-07-11  2:52 ` [PATCH net-next v2 0/5] virtio: support " Jason Wang
2018-07-11  2:52 ` Jason Wang
2018-07-11  2:52   ` [virtio-dev] " Jason Wang
2018-07-12 21:44 ` David Miller
2018-07-12 21:44   ` David Miller
2018-07-13  0:52   ` Jason Wang
2018-07-13  0:52   ` Jason Wang
2018-07-13  0:52     ` [virtio-dev] " Jason Wang
2018-07-13  3:26   ` Michael S. Tsirkin
2018-07-13  3:26     ` [virtio-dev] " Michael S. Tsirkin
2018-07-13  3:26   ` Michael S. Tsirkin
2018-08-27 14:00 ` Michael S. Tsirkin
2018-08-27 14:00 ` Michael S. Tsirkin
2018-08-27 14:00   ` [virtio-dev] " Michael S. Tsirkin
2018-08-28  5:51   ` Jens Freimann
2018-09-07  1:22   ` Tiwei Bie
2018-09-07  1:22   ` Tiwei Bie
2018-09-07  1:22     ` Tiwei Bie
2018-09-07  1:22     ` Tiwei Bie
2018-09-07 13:00     ` [virtio-dev] " Michael S. Tsirkin
2018-09-07 13:00     ` Michael S. Tsirkin
2018-09-07 13:00       ` Michael S. Tsirkin
2018-09-07 13:00       ` Michael S. Tsirkin
2018-09-10  3:00       ` [virtio-dev] " Tiwei Bie
2018-09-10  3:00       ` Tiwei Bie
2018-09-10  3:00         ` Tiwei Bie
2018-09-10  3:00         ` Tiwei Bie
2018-09-10  3:33         ` [virtio-dev] " Jason Wang
2018-09-10  3:33           ` Jason Wang
2018-09-11  5:37           ` Tiwei Bie
2018-09-11  5:37           ` Tiwei Bie
2018-09-11  5:37             ` Tiwei Bie
2018-09-11  5:37             ` Tiwei Bie
2018-09-12 16:16             ` [virtio-dev] " Michael S. Tsirkin
2018-09-12 16:16               ` Michael S. Tsirkin
2018-09-13  8:59               ` Tiwei Bie
2018-09-13  8:59                 ` Tiwei Bie
2018-09-13  8:59                 ` Tiwei Bie
2018-09-13  9:47                 ` [virtio-dev] " Jason Wang
2018-09-13  9:47                   ` Jason Wang
2018-09-13  9:47                   ` Jason Wang
2018-10-10 14:36                   ` [virtio-dev] " Michael S. Tsirkin
2018-10-10 14:36                     ` Michael S. Tsirkin
2018-10-11 12:12                     ` Tiwei Bie
2018-10-11 12:12                     ` Tiwei Bie
2018-10-11 12:12                       ` Tiwei Bie
2018-10-11 12:12                       ` Tiwei Bie
2018-10-11 13:48                       ` [virtio-dev] " Michael S. Tsirkin
2018-10-11 13:48                       ` Michael S. Tsirkin
2018-10-11 13:48                         ` Michael S. Tsirkin
2018-10-11 14:13                         ` Tiwei Bie
2018-10-11 14:13                           ` Tiwei Bie
2018-10-11 14:17                           ` Michael S. Tsirkin
2018-10-11 14:17                             ` Michael S. Tsirkin
2018-10-11 14:17                             ` Michael S. Tsirkin
2018-10-11 14:34                             ` [virtio-dev] " Tiwei Bie
2018-10-11 14:34                               ` Tiwei Bie
2018-10-11 14:34                               ` Tiwei Bie
2018-10-11 14:34                             ` [virtio-dev] " Tiwei Bie
2018-10-11 14:17                           ` Michael S. Tsirkin
2018-10-11 14:13                         ` Tiwei Bie
2018-10-10 14:36                   ` Michael S. Tsirkin
2018-09-13  9:47                 ` Jason Wang
2018-09-13  8:59               ` Tiwei Bie
2018-09-12 16:16             ` Michael S. Tsirkin
2018-09-10  3:33         ` Jason Wang
2018-09-12 13:06         ` Michael S. Tsirkin
2018-09-12 13:06         ` Michael S. Tsirkin
2018-09-12 13:06           ` Michael S. Tsirkin
2018-09-12 13:06           ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181108225858-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=jfreimann@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tiwei.bie@intel.com \
    --cc=virtio-dev@lists.oasis-open.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=wexu@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.