From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id E7AB42935 for ; Thu, 7 Apr 2016 17:29:36 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP; 07 Apr 2016 08:29:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,449,1455004800"; d="scan'208";a="682467934" Received: from irsmsx105.ger.corp.intel.com ([163.33.3.28]) by FMSMGA003.fm.intel.com with ESMTP; 07 Apr 2016 08:29:34 -0700 Received: from irsmsx106.ger.corp.intel.com ([169.254.8.172]) by irsmsx105.ger.corp.intel.com ([169.254.7.35]) with mapi id 14.03.0248.002; Thu, 7 Apr 2016 16:29:33 +0100 From: "Loftus, Ciara" To: "Tan, Jianfeng" , Rich Lane , "dev@dpdk.org" CC: Tetsuya Mukawa , Yuanhan Liu Thread-Topic: [dpdk-dev] [PATCH] vhost: call rte_vhost_enable_guest_notification only on enabled queues Thread-Index: AQHRkMOBrtVs32N9q027aPtTRNGMVJ9+oYmA Date: Thu, 7 Apr 2016 15:29:32 +0000 Message-ID: <74F120C019F4A64C9B78E802F6AD4CC24F863996@IRSMSX106.ger.corp.intel.com> References: <1459988946-5956-1-git-send-email-rich.lane@bigswitch.com> <57064914.4040703@intel.com> In-Reply-To: <57064914.4040703@intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzM0NGRjYWQtYzY4Mi00NzJkLWFiZjMtYTczNmIyYTdkNzkzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6ImM4VDR6Um9zWnFXZ2xHTVlGRTFYZFwvcCtnaDZVWkc2dkVnVE9MTG9VelVvPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 15:29:37 -0000 > 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 NUL= L > > virtqueue pointer. > > > > Fixes: ee584e9710b9 ("vhost: add driver on top of the library") > > Signed-off-by: Rich Lane > > --- > > 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 =3D dev; > > vq->internal =3D internal; > > vq->port =3D eth_dev->data->port_id; > > - rte_vhost_enable_guest_notification(dev, vq- > >virtqueue_id, 0); > > } > > for (i =3D 0; i < eth_dev->data->nb_tx_queues; i++) { > > vq =3D eth_dev->data->tx_queues[i]; > > @@ -274,9 +273,11 @@ new_device(struct virtio_net *dev) > > vq->device =3D dev; > > vq->internal =3D internal; > > vq->port =3D eth_dev->data->port_id; > > - rte_vhost_enable_guest_notification(dev, vq- > >virtqueue_id, 0); > > } > > > > + for (i =3D 0; i < dev->virt_qp_nb * VIRTIO_QNUM; i++) > > + rte_vhost_enable_guest_notification(dev, i, 0); > > + > > dev->flags |=3D VIRTIO_DEV_RUNNING; > > dev->priv =3D eth_dev; > > eth_dev->data->dev_link.link_status =3D ETH_LINK_UP; >=20 > 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? As far as I know, virt_qp_nb will report the number of queues available, re= gardless of their state enabled/disabled. So for example if we have 4 queue= s, but only one enabled, virt_qp_nb should still =3D 4 and rte_vhost_enable= _guest_notification() will be called for all of these queues. Thanks, Ciara >=20 > Thanks, > Jianfeng