From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id BE2971B2E1 for ; Fri, 26 Jan 2018 16:34:20 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 114ED20BB7; Fri, 26 Jan 2018 10:34:19 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Fri, 26 Jan 2018 10:34:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=PBvkVZ61nWRDlU60YGcxm8IBaLH9rpe7K3KfDFtquwQ=; b=cYCl5ili 4Gw92zQct2+bWQkKi7nEhurKiy9837gqojsmVTDz1BfaWQJHYvQXNMFOP2hVwj06 eJMGw0TJNl/x7ZK7t/1CJeRNlMkbbknoO9Gef1OCYFsWuGyTY7RFNBwGQK0UjD/w rojAyBQAulCZfUnPieiayN8plO5XvOAAFooP/nbYq90b2gPnieLES9TTv3/UZRtN az3oPc2pkKXH/AHq/hNr2llvUF/VE4Ert4r5tS8N/nQxqTtz3XFkzdlQfw+dZlIV /fQlayAD1hriM2DUGtEkh6p4Nzsb+iB/zLbiQvojCr43cEkcZj9ainCuyaQ9Sq6n rpbcrD3FWT95EQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=PBvkVZ61nWRDlU60YGcxm8IBaLH9r pe7K3KfDFtquwQ=; b=ZTsARttQDa5li3qWbnhgbovgLyMKyHLLXDn6GJ9K/X9Ou br0ifc7U4qvFx9gpGdpqfJLX8Kw2yJwnNOvpiPOzYWvkGi2xrUwTeo6L9Ez9IBVI /sqamHPsud0PNjXzwS1/gB+0Hl18X677+AItKzpbxGRzB3XuCUCmkiHFSYGvSjOo VyDChOIWQbNXe/BbrEgZ6Lik9/18WhJWjPB0GLbWDfkkEqwUfwX1GD1RFRYoc2dt zVevsXG3u5//4T0Wanvz2ylOcdmCKG7iU5inqIGMIpYR6+zPS+XyxCerJvqG1IOp D7BYaYSgJ/m8H6IikOrwmbGHdaq7V2KvSjxwcHZyg== X-ME-Sender: Received: from yliu-mob (unknown [182.84.185.39]) by mail.messagingengine.com (Postfix) with ESMTPA id B582424550; Fri, 26 Jan 2018 10:34:18 -0500 (EST) Date: Fri, 26 Jan 2018 23:34:15 +0800 From: Yuanhan Liu To: Olivier Matz Cc: dev@dpdk.org, Maxime Coquelin , Tiwei Bie Message-ID: <20180126153415.GF29540@yliu-mob> References: <20180119155556.32597-1-olivier.matz@6wind.com> <20180123155443.8883-1-olivier.matz@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180123155443.8883-1-olivier.matz@6wind.com> User-Agent: Mutt/1.5.24 (2015-08-30) Subject: Re: [dpdk-dev] [PATCH v3 0/4] net/virtio: fix memory leak when reinitializing device X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jan 2018 15:34:21 -0000 On Tue, Jan 23, 2018 at 04:54:39PM +0100, Olivier Matz wrote: > When devops->configure() is called, the queues may be reallocated > if the features flag changed, but the previous are not freed. This > patchset fixes this issue. Seires applied to dpdk-next-virtio. Thanks. --yliu > > To really point out the issue, I instrumented rte_malloc, > rte_memzone_reserve, rte_mbuf_alloc to track the allocations and frees. > For reference, the patch is available here: > https://www.droids-corp.org/~zer0/hidden/0001-debug-malloc.patch > Iit conflicts a bit with the patchset, but it is quite easy to solve. > > To reproduce the issue: > > cd dpdk > make config T=x86_64-native-linuxapp-gcc > sed -i 's,CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_INIT=n,CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_INIT=y,' build/.config > make -j4 > mkdir -p /mnt/huge > mount -t hugetlbfs nodev /mnt/huge > echo 256 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages > modprobe uio_pci_generic > python usertools/dpdk-devbind.py -b uio_pci_generic 0000:00:02.0 > ./build/app/testpmd -l 0,1 --log-level 8 -- --total-num-mbufs=16384 \ > -i --port-topology=chained --disable-hw-vlan-filter \ > --disable-hw-vlan-strip --enable-rx-cksum --enable-lro \ > --txqflags=0 --no-lsc-interrupt > > # testpmd commands > port stop 0 > port config all rx-cksum off > port start 0 > quit > > Without the patchset, the debug patch displays a leak of mbufs allocated > from virtio_dev_rx_queue_setup_finish() and a leak of rte_mallocs allocated > from virtio_init_queue(). > > After the patchset, only one malloc is remaining after the device close, > but this is normal, because this area is freed in dev_uninit(). > > v2 -> v3: > - fix queue flushing with vector Rx enabled (Tiwei). > The patch is slightly changed compared to what was proposed by mail, > due to a checkpatch warning. > > v1 -> v2: > - move the vq != NULL check from the refactor patch to the memory > leak fix patch (Yuanhan) > - new patch to fix queue flushing with vector Rx enabled (Tiwei) > - move the backportable fixes at the beginning of the patchset (Yuanhan) > - remove Cc stable on the typo fix (Yuanhan) > note: I finally kept it in the patchset > > > Olivier Matz (4): > net/virtio: fix queue flushing with vector Rx enabled > net/virtio: fix memory leak when reinitializing device > net/virtio: rationalize queue flushing > net/virtio: fix typo in function name > > drivers/net/virtio/virtio_ethdev.c | 71 +++++++++++++++++--------------------- > drivers/net/virtio/virtqueue.c | 30 +++++++++++++--- > drivers/net/virtio/virtqueue.h | 13 ++++++- > 3 files changed, 69 insertions(+), 45 deletions(-) > > -- > 2.11.0