From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 3F3832934 for ; Fri, 4 Nov 2016 02:49:50 +0100 (CET) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP; 03 Nov 2016 18:49:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,589,1473145200"; d="scan'208";a="27291052" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by fmsmga005.fm.intel.com with ESMTP; 03 Nov 2016 18:49:49 -0700 Date: Fri, 4 Nov 2016 09:50:48 +0800 From: Yuanhan Liu To: Maxime Coquelin Cc: dev@dpdk.org, Ilya Maximets Message-ID: <20161104015048.GS16751@yliu-dev.sh.intel.com> References: <1478189400-14606-1-git-send-email-yuanhan.liu@linux.intel.com> <1478189400-14606-5-git-send-email-yuanhan.liu@linux.intel.com> <3106a280-db21-604d-7f3f-dd2575efa1e8@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3106a280-db21-604d-7f3f-dd2575efa1e8@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH 4/8] net/virtio: allocate queue at init stage 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: Fri, 04 Nov 2016 01:49:51 -0000 On Thu, Nov 03, 2016 at 10:11:43PM +0100, Maxime Coquelin wrote: > > > On 11/03/2016 05:09 PM, Yuanhan Liu wrote: > >Queue allocation should be done once, since the queue related info (such > >as vring addreess) will only be informed to the vhost-user backend once > >without virtio device reset. > > > >That means, if you allocate queues again after the vhost-user negotiation, > >the vhost-user backend will not be informed any more. Leading to a state > >that the vring info mismatches between virtio PMD driver and vhost-backend: > >the driver switches to the new address has just been allocated, while the > >vhost-backend still sticks to the old address has been assigned in the init > >stage. > > > >Unfortunately, that is exactly how the virtio driver is coded so far: queue > >allocation is done at queue_setup stage (when rte_eth_tx/rx_queue_setup is > >invoked). This is wrong, because queue_setup can be invoked several times. > >For example, > > > > $ start_testpmd.sh ... --txq=1 --rxq=1 ... > > > port stop 0 > > > port config all txq 1 # just trigger the queue_setup callback again > > > port config all rxq 1 > > > port start 0 > > > >The right way to do is allocate the queues in the init stage, so that the > >vring info could be persistent with the vhost-user backend. > > > >Besides that, we should allocate max_queue pairs the device supports, but > >not nr queue pairs firstly configured, to make following case work. > I understand, but how much memory overhead does that represent? We are allocating max queue pairs the device supports, but not the virtio-net spec supports, which, as you stated, would be too much. I don't know the typical value of the queue pairs being used in production, but normally, I would assume it be small, something like 2, or 4. It's 1 by default after all. So I think it will not be an issue. > Have you considered performing a device reset when queue number is > changed? Not a good idea and clean solution to me. --yliu