From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <jianfeng.tan@intel.com>
Received: from mga14.intel.com (mga14.intel.com [192.55.52.115])
 by dpdk.org (Postfix) with ESMTP id B9B722949
 for <dev@dpdk.org>; Thu,  7 Apr 2016 13:48:38 +0200 (CEST)
Received: from fmsmga002.fm.intel.com ([10.253.24.26])
 by fmsmga103.fm.intel.com with ESMTP; 07 Apr 2016 04:48:37 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.24,449,1455004800"; d="scan'208";a="953672454"
Received: from shwdeisgchi083.ccr.corp.intel.com (HELO [10.239.67.193])
 ([10.239.67.193])
 by fmsmga002.fm.intel.com with ESMTP; 07 Apr 2016 04:48:36 -0700
To: Rich Lane <rich.lane@bigswitch.com>, dev@dpdk.org
References: <1459988946-5956-1-git-send-email-rich.lane@bigswitch.com>
Cc: Tetsuya Mukawa <mukawa@igel.co.jp>,
 Yuanhan Liu <yuanhan.liu@linux.intel.com>
From: "Tan, Jianfeng" <jianfeng.tan@intel.com>
Message-ID: <57064914.4040703@intel.com>
Date: Thu, 7 Apr 2016 19:48:36 +0800
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101
 Thunderbird/38.7.2
MIME-Version: 1.0
In-Reply-To: <1459988946-5956-1-git-send-email-rich.lane@bigswitch.com>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH] vhost: call
 rte_vhost_enable_guest_notification only on enabled queues
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 07 Apr 2016 11:48:39 -0000

Hi,

On 4/7/2016 8:29 AM, Rich Lane wrote:
> If the vhost PMD were configured with more queues than the guest, the old
> code would segfault in rte_vhost_enable_guest_notification due to a NULL
> virtqueue pointer.
>
> Fixes: ee584e9710b9 ("vhost: add driver on top of the library")
> Signed-off-by: Rich Lane <rich.lane@bigswitch.com>
> ---
>   drivers/net/vhost/rte_eth_vhost.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
> index b1eb082..310cbef 100644
> --- a/drivers/net/vhost/rte_eth_vhost.c
> +++ b/drivers/net/vhost/rte_eth_vhost.c
> @@ -265,7 +265,6 @@ new_device(struct virtio_net *dev)
>   		vq->device = dev;
>   		vq->internal = internal;
>   		vq->port = eth_dev->data->port_id;
> -		rte_vhost_enable_guest_notification(dev, vq->virtqueue_id, 0);
>   	}
>   	for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
>   		vq = eth_dev->data->tx_queues[i];
> @@ -274,9 +273,11 @@ new_device(struct virtio_net *dev)
>   		vq->device = dev;
>   		vq->internal = internal;
>   		vq->port = eth_dev->data->port_id;
> -		rte_vhost_enable_guest_notification(dev, vq->virtqueue_id, 0);
>   	}
>   
> +	for (i = 0; i < dev->virt_qp_nb * VIRTIO_QNUM; i++)
> +		rte_vhost_enable_guest_notification(dev, i, 0);
> +
>   	dev->flags |= VIRTIO_DEV_RUNNING;
>   	dev->priv = eth_dev;
>   	eth_dev->data->dev_link.link_status = ETH_LINK_UP;

Just one question, when qemu starts a vm, usually, only one queue is 
enabled, then only 1 tx and 1 rx are called 
rte_vhost_enable_guest_notification; but after system is up, we use 
"ethtool -K eth0 combined x" to enable multiqueues, there's no chance to 
call rte_vhost_enable_guest_notification for other queues, right?

Thanks,
Jianfeng