All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tiwei Bie <tiwei.bie@intel.com>
To: Jason Wang <jasowang@redhat.com>
Cc: mst@redhat.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: [virtio-dev] Re: [PATCH net-next v1 4/5] virtio_ring: add event idx support in packed ring
Date: Wed, 11 Jul 2018 09:09:05 +0800	[thread overview]
Message-ID: <20180711010905.GB28235@debian> (raw)
In-Reply-To: <9ee31221-9f4a-f1c5-0f0b-8d178bb536e9@redhat.com>

On Tue, Jul 10, 2018 at 01:50:03PM +0800, Jason Wang wrote:
> On 2018年07月09日 15:22, Tiwei Bie wrote:
> > @@ -1059,9 +1059,19 @@ static bool virtqueue_kick_prepare_packed(struct virtqueue *_vq)
> >   	 * suppressions. */
> >   	virtio_mb(vq->weak_barriers);
> > +	old = vq->next_avail_idx - vq->num_added;
> > +	new = vq->next_avail_idx;
> > +	vq->num_added = 0;
> > +
> >   	snapshot = *(u32 *)vq->vring_packed.device;
> 
> I think we should use READ_ONCE() to prevent compiler from re-reading.

I'll do it. Thanks!

Best regards,
Tiwei Bie

> 
> > +	off_wrap = virtio16_to_cpu(_vq->vdev, (__virtio16)(snapshot & 0xffff));
> >   	flags = virtio16_to_cpu(_vq->vdev, (__virtio16)(snapshot >> 16)) & 0x3;
> > +	wrap_counter = off_wrap >> 15;
> > +	event_idx = off_wrap & ~(1 << 15);
> > +	if (wrap_counter != vq->avail_wrap_counter)
> > +		event_idx -= vq->vring_packed.num;
> 
> Thanks
> 

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


WARNING: multiple messages have this Message-ID (diff)
From: Tiwei Bie <tiwei.bie@intel.com>
To: Jason Wang <jasowang@redhat.com>
Cc: mst@redhat.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: [virtio-dev] Re: [PATCH net-next v1 4/5] virtio_ring: add event idx support in packed ring
Date: Wed, 11 Jul 2018 09:09:05 +0800	[thread overview]
Message-ID: <20180711010905.GB28235@debian> (raw)
In-Reply-To: <9ee31221-9f4a-f1c5-0f0b-8d178bb536e9@redhat.com>

On Tue, Jul 10, 2018 at 01:50:03PM +0800, Jason Wang wrote:
> On 2018年07月09日 15:22, Tiwei Bie wrote:
> > @@ -1059,9 +1059,19 @@ static bool virtqueue_kick_prepare_packed(struct virtqueue *_vq)
> >   	 * suppressions. */
> >   	virtio_mb(vq->weak_barriers);
> > +	old = vq->next_avail_idx - vq->num_added;
> > +	new = vq->next_avail_idx;
> > +	vq->num_added = 0;
> > +
> >   	snapshot = *(u32 *)vq->vring_packed.device;
> 
> I think we should use READ_ONCE() to prevent compiler from re-reading.

I'll do it. Thanks!

Best regards,
Tiwei Bie

> 
> > +	off_wrap = virtio16_to_cpu(_vq->vdev, (__virtio16)(snapshot & 0xffff));
> >   	flags = virtio16_to_cpu(_vq->vdev, (__virtio16)(snapshot >> 16)) & 0x3;
> > +	wrap_counter = off_wrap >> 15;
> > +	event_idx = off_wrap & ~(1 << 15);
> > +	if (wrap_counter != vq->avail_wrap_counter)
> > +		event_idx -= vq->vring_packed.num;
> 
> Thanks
> 

  parent reply	other threads:[~2018-07-11  1:09 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-09  7:22 [virtio-dev] [PATCH net-next v1 0/5] virtio: support packed ring Tiwei Bie
2018-07-09  7:22 ` Tiwei Bie
2018-07-09  7:22 ` Tiwei Bie
2018-07-09  7:22 ` [PATCH net-next v1 1/5] virtio: add packed ring definitions Tiwei Bie
2018-07-09  7:22 ` [virtio-dev] " Tiwei Bie
2018-07-09  7:22   ` Tiwei Bie
2018-07-09  7:22 ` [virtio-dev] [PATCH net-next v1 2/5] virtio_ring: support creating packed ring Tiwei Bie
2018-07-09  7:22   ` Tiwei Bie
2018-07-09  7:22 ` Tiwei Bie
2018-07-09  7:22 ` [virtio-dev] [PATCH net-next v1 3/5] virtio_ring: add packed ring support Tiwei Bie
2018-07-09  7:22   ` Tiwei Bie
2018-07-09  7:22 ` Tiwei Bie
2018-07-09  7:22 ` [PATCH net-next v1 4/5] virtio_ring: add event idx support in packed ring Tiwei Bie
2018-07-09  7:22 ` [virtio-dev] " Tiwei Bie
2018-07-09  7:22   ` Tiwei Bie
2018-07-10  5:50   ` Jason Wang
2018-07-10  5:50   ` [virtio-dev] " Jason Wang
2018-07-10  5:50     ` Jason Wang
2018-07-11  1:09     ` [virtio-dev] " Tiwei Bie
2018-07-11  1:09     ` Tiwei Bie [this message]
2018-07-11  1:09       ` Tiwei Bie
2018-07-09  7:22 ` [virtio-dev] [PATCH net-next v1 5/5] virtio_ring: enable " Tiwei Bie
2018-07-09  7:22   ` Tiwei Bie
2018-07-10  5:51   ` [virtio-dev] " Jason Wang
2018-07-10  5:51     ` Jason Wang
2018-07-11  1:07     ` [virtio-dev] " Tiwei Bie
2018-07-11  1:07       ` Tiwei Bie
2018-07-11  1:07       ` Tiwei Bie
2018-07-10  5:51   ` Jason Wang
2018-07-09  7:22 ` Tiwei Bie

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=20180711010905.GB28235@debian \
    --to=tiwei.bie@intel.com \
    --cc=jasowang@redhat.com \
    --cc=jfreimann@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --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.