From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <jasowang@redhat.com>
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])
 by dpdk.org (Postfix) with ESMTP id 670411B49F;
 Thu, 11 Oct 2018 15:34:20 +0200 (CEST)
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 AA244308AA14;
 Thu, 11 Oct 2018 13:34:19 +0000 (UTC)
Received: from [10.72.12.114] (ovpn-12-114.pek2.redhat.com [10.72.12.114])
 by smtp.corp.redhat.com (Postfix) with ESMTPS id 11C3E6BC3E;
 Thu, 11 Oct 2018 13:34:08 +0000 (UTC)
To: Tiwei Bie <tiwei.bie@intel.com>, maxime.coquelin@redhat.com,
 zhihong.wang@intel.com, dev@dpdk.org
Cc: mst@redhat.com, stable@dpdk.org
References: <20181011130655.5485-1-tiwei.bie@intel.com>
From: Jason Wang <jasowang@redhat.com>
Message-ID: <ec712175-3425-02ad-0131-ea9ce595b00b@redhat.com>
Date: Thu, 11 Oct 2018 21:34:06 +0800
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <20181011130655.5485-1-tiwei.bie@intel.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Content-Language: en-US
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.41]); Thu, 11 Oct 2018 13:34:19 +0000 (UTC)
Subject: Re: [dpdk-stable] [PATCH] vhost: fix notification for packed ring
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 11 Oct 2018 13:34:20 -0000



On 2018年10月11日 21:06, Tiwei Bie wrote:
> The notification can't be disabled in packed ring when
> application tries to disable notification, because the
> device event flags field is overwritten by an unexpected
> value. This patch fixes this issue.
>
> Fixes: b1cce26af1dc ("vhost: add notification for packed ring")
> Cc: stable@dpdk.org
>
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
>   lib/librte_vhost/vhost.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c
> index e62f4c594..c9270bdec 100644
> --- a/lib/librte_vhost/vhost.c
> +++ b/lib/librte_vhost/vhost.c
> @@ -667,8 +667,10 @@ vhost_enable_notify_packed(struct virtio_net *dev,
>   {
>   	uint16_t flags;
>   
> -	if (!enable)
> -		vq->device_event->flags = VRING_EVENT_F_DISABLE;
> +	if (!enable) {
> +		flags = VRING_EVENT_F_DISABLE;
> +		goto out;
> +	}
>   
>   	flags = VRING_EVENT_F_ENABLE;
>   	if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX)) {
> @@ -677,6 +679,7 @@ vhost_enable_notify_packed(struct virtio_net *dev,
>   			vq->avail_wrap_counter << 15;
>   	}
>   
> +out:
>   	rte_smp_wmb();
>   

It looks to me the barrier is even not needed for !enable.

Thanks

>   	vq->device_event->flags = flags;