From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: Re: Memory leak when adding/removing vhost_user ports Date: Wed, 20 Apr 2016 22:54:58 -0700 Message-ID: <20160421055458.GD5872@yliu-dev.sh.intel.com> References: <20160418174650.GD2576@yliu-dev.sh.intel.com> <20160418181422.GE2576@yliu-dev.sh.intel.com> <20160420050445.GB5872@yliu-dev.sh.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: dev , Daniele Di Proietto To: Christian Ehrhardt Return-path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 59F84952 for ; Thu, 21 Apr 2016 07:53:37 +0200 (CEST) Content-Disposition: inline In-Reply-To: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, Apr 20, 2016 at 08:18:49AM +0200, Christian Ehrhardt wrote: > On Wed, Apr 20, 2016 at 7:04 AM, Yuanhan Liu > wrote: >=20 > On Tue, Apr 19, 2016 at 06:33:50PM +0200, Christian Ehrhardt wrote: >=20 > [...]=A0 >=20 > > With that applied one (and only one) of my two guests looses conn= ectivity > after > > removing the ports the first time. >=20 > Yeah, that's should be because I invoked the "->destroy_device()" > callback. >=20 >=20 > Shouldn't that not only destroy the particular vhost_user device I remo= ve? I assume the "not" is typed wrong here, then yes. Well, it turned out that I accidentally destroyed the first guest (with id 0) with following code: ctx.fh =3D g_vhost_server.server[i]->fh; vhost_destroy_device(ctx); server[i]->fh is initialized with 0 when no connection is established (check below for more info), and the first id is started with 0. Anyway, this could be fixed easily. > See below for some better details on the test to clarify that. >=20 >=20 > BTW, I'm curious how do you do the test? I saw you added 256 ports,= but > with 2 guests only? So, 254 of them are idle, just for testing the > memory leak bug? >=20 >=20 > Maybe I should describe it better: > 1. Spawn some vhost-user ports (40 in my case) > 2. Spawn a pair of guests that connect via four of those ports per gues= t > 3. Guests only intialize one of that vhost_user based NICs > 4. check connectivity between guests via the vhost_user based connectio= n > (working at this stage) > LOOP 5-7: > =A0 =A05. add ports 41-512 > =A0 =A06. remove =A0ports 41-512 > =A0 =A07. check connectivity between guests via the vhost_user based co= nnection Yes, it's much clearer now. Thanks. I then don't see it's a leak from DPDK vhost-user, at least not the leak on "struct virtio_net" I have mentioned before. "struct virito_net" will not even be allocated for those ports never used (ports 41-512 in your ca= se), as it will be allocated only when there is a connection established, aka, a guest is connected. BTW, will you be able to reproduce it without any connections? Say, all 512 ports are added, and then deleted. Thanks. --yliu >=20 > So the vhost_user ports the guests are using are never deleted. > Only some extra (not even used) ports are added&removed in the loop to = search > for potential leaks over a longer lifetime of an openvswitch-dpdk based > solution. >=20