From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5BE36A054C for ; Fri, 14 Feb 2020 18:04:42 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 46C4BF72; Fri, 14 Feb 2020 18:04:42 +0100 (CET) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by dpdk.org (Postfix) with ESMTP id C674BF72 for ; Fri, 14 Feb 2020 18:04:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581699880; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sDMqpEKXvUoaVgjm/w858FnOvQhIxJeCNxEfQG20PUI=; b=Wc7/OxlN4/sEDxQb83QV+mq3Cnl3WNzaT1zWRoEMRlKKuRRX7s96HKtZGE7d7gR5Egj5RO E01x2YcAnOjYmsMN4Oa1KNpl3yYbiDJumznNGXNwPLvQMzJBgeE+nHMoNgOx5F4xlvEShq U1XARojTGeeDohx4hvtiNLre0S6VFf8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-6-MZ3hP1E2NWenjAcMFEgWiw-1; Fri, 14 Feb 2020 12:04:37 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 844AA13E2; Fri, 14 Feb 2020 17:04:36 +0000 (UTC) Received: from rh.redhat.com (unknown [10.33.36.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 29A9A8AC49; Fri, 14 Feb 2020 17:04:34 +0000 (UTC) From: Kevin Traynor To: Olivier Matz Cc: dpdk stable Date: Fri, 14 Feb 2020 17:03:06 +0000 Message-Id: <20200214170337.25093-12-ktraynor@redhat.com> In-Reply-To: <20200214170337.25093-1-ktraynor@redhat.com> References: <20200214170337.25093-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: MZ3hP1E2NWenjAcMFEgWiw-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: [dpdk-stable] patch 'mempool: fix anonymous populate' has been queued to LTS release 18.11.7 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to LTS release 18.11.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/20/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasi= ng (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/bb443e3fa89409c154= cfbd738fcc2ea3b50f858c Thanks. Kevin. --- >From bb443e3fa89409c154cfbd738fcc2ea3b50f858c Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Fri, 17 Jan 2020 15:34:29 +0100 Subject: [PATCH] mempool: fix anonymous populate [ upstream commit f159c61c35ebc6ff18d2c6c2cb07c177935a96e3 ] The documentation says that a negative errno is returned on error, but in most places that's not the case. Fix the documentation and the exceptions in code. The second one (return from populate_virt) also fixes a memory leak. Note that testpmd was using the function correctly. Fixes: aa10457eb4c2 ("mempool: make mempool populate and free api public") Fixes: 6780f72fb82f ("mempool: populate with anonymous memory") Fixes: 66e7ba0bad4c ("mempool: ensure mempool is initialized before populat= ing") Signed-off-by: Olivier Matz --- lib/librte_mempool/rte_mempool.c | 10 +++++++--- lib/librte_mempool/rte_mempool.h | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_memp= ool.c index 99530a5955..9fc038b745 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -679,6 +679,8 @@ rte_mempool_populate_anon(struct rte_mempool *mp) =20 =09ret =3D mempool_ops_alloc_once(mp); -=09if (ret !=3D 0) -=09=09return ret; +=09if (ret < 0) { +=09=09rte_errno =3D -ret; +=09=09return 0; +=09} =20 =09size =3D get_anon_size(mp); @@ -704,6 +706,8 @@ rte_mempool_populate_anon(struct rte_mempool *mp) =09ret =3D rte_mempool_populate_virt(mp, addr, size, getpagesize(), =09=09rte_mempool_memchunk_anon_free, addr); -=09if (ret =3D=3D 0) +=09if (ret < 0) { +=09=09rte_errno =3D -ret; =09=09goto fail; +=09} =20 =09return mp->populated_size; diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_memp= ool.h index fe2f33352c..a22cef49e0 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -1088,6 +1088,6 @@ int rte_mempool_populate_default(struct rte_mempool *= mp); * @return * The number of objects added on success. - * On error, the chunk is not added in the memory list of the - * mempool and a negative errno is returned. + * On error, 0 is returned, rte_errno is set, and the chunk is not added= in + * the memory list of the mempool. */ int rte_mempool_populate_anon(struct rte_mempool *mp); --=20 2.21.1 --- Diff of the applied patch vs upstream commit (please double-check if non-= empty: --- --- -=092020-02-14 17:02:37.705900070 +0000 +++ 0012-mempool-fix-anonymous-populate.patch=092020-02-14 17:02:36.9394081= 89 +0000 @@ -1 +1 @@ -From f159c61c35ebc6ff18d2c6c2cb07c177935a96e3 Mon Sep 17 00:00:00 2001 +From bb443e3fa89409c154cfbd738fcc2ea3b50f858c Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit f159c61c35ebc6ff18d2c6c2cb07c177935a96e3 ] + @@ -17 +18,0 @@ -Cc: stable@dpdk.org @@ -26 +27 @@ -index 78d8eb941e..f8d453d21f 100644 +index 99530a5955..9fc038b745 100644 @@ -29 +30 @@ -@@ -646,6 +646,8 @@ rte_mempool_populate_anon(struct rte_mempool *mp) +@@ -679,6 +679,8 @@ rte_mempool_populate_anon(struct rte_mempool *mp) @@ -40 +41 @@ -@@ -671,6 +673,8 @@ rte_mempool_populate_anon(struct rte_mempool *mp) +@@ -704,6 +706,8 @@ rte_mempool_populate_anon(struct rte_mempool *mp) @@ -51 +52 @@ -index f81152af96..0a1dc6059f 100644 +index fe2f33352c..a22cef49e0 100644 @@ -54 +55 @@ -@@ -1168,6 +1168,6 @@ int rte_mempool_populate_default(struct rte_mempool = *mp); +@@ -1088,6 +1088,6 @@ int rte_mempool_populate_default(struct rte_mempool = *mp);