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 800F5A04F0 for ; Tue, 10 Dec 2019 16:00:36 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 758511B13C; Tue, 10 Dec 2019 16:00:36 +0100 (CET) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id 516A81BE3D for ; Tue, 10 Dec 2019 16:00:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575990034; 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=sollI/+46TlyEF6H/ZZnS1ZTMOIHEzwbRIYJFJrS+mo=; b=P0+fZ5+0weBHcwun88wlWj3TR7Sf8vebYWbuyBiaP7MtHb2UHCj53sG6T65VYF+kNHUxzS e48wwGH3ayI3GdY+NMFYA850HmD7vam2cBm5oEBWlJg5YocMJ7HcA9TS85pmX/CRaf02V3 EfK2qgkqQbhkxzg+EwX4JPqcHZBzq5g= 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-199-wTC485LnODiUdGXBrisXcw-1; Tue, 10 Dec 2019 10:00:32 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3D939800D5E; Tue, 10 Dec 2019 15:00:31 +0000 (UTC) Received: from rh.redhat.com (ovpn-116-64.ams2.redhat.com [10.36.116.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 61D4B5D9C5; Tue, 10 Dec 2019 15:00:30 +0000 (UTC) From: Kevin Traynor To: Pavan Nikhilesh Cc: dpdk stable Date: Tue, 10 Dec 2019 14:58:54 +0000 Message-Id: <20191210145937.32755-20-ktraynor@redhat.com> In-Reply-To: <20191210145937.32755-1-ktraynor@redhat.com> References: <20191210145937.32755-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: wTC485LnODiUdGXBrisXcw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: [dpdk-stable] patch 'reciprocal: fix off-by-one with 32-bit divisor' has been queued to LTS release 18.11.6 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.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/16/19. 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/28450d0732da46af14= c4f39ef38a3db5a20cb478 Thanks. Kevin. --- >From 28450d0732da46af14c4f39ef38a3db5a20cb478 Mon Sep 17 00:00:00 2001 From: Pavan Nikhilesh Date: Wed, 4 Sep 2019 00:46:45 +0530 Subject: [PATCH] reciprocal: fix off-by-one with 32-bit divisor [ upstream commit 9b0a1dadc345805ca9d7428a977da080d5eee7e2 ] Fix off-by-one error in 64bit reciprocal division when divisor is 32bit. Caught with the unit test: RTE>>reciprocal_division Validating unsigned 32bit division. Validating unsigned 64bit division. Validating unsigned 64bit division with 32bit divisor. Division failed, 16983222950483802557/819 =3D expected 20736535959076681 result 20736535959076682 Validating division by power of 2. Test Failed Fixes: 6d45659eacb8 ("eal: add u64-bit variant for reciprocal divide") Signed-off-by: Pavan Nikhilesh --- lib/librte_eal/common/rte_reciprocal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/common/rte_reciprocal.c b/lib/librte_eal/common= /rte_reciprocal.c index f017d0c28..1c6d10e73 100644 --- a/lib/librte_eal/common/rte_reciprocal.c +++ b/lib/librte_eal/common/rte_reciprocal.c @@ -134,10 +134,13 @@ rte_reciprocal_value_u64(uint64_t d) =09struct rte_reciprocal_u64 R; =09uint64_t m; +=09uint64_t r; =09int l; =20 =09l =3D 63 - __builtin_clzll(d); =20 -=09m =3D divide_128_div_64_to_64((1ULL << l), 0, d, NULL) << 1; -=09m =3D (1ULL << l) - d ? m + 2 : 1; +=09m =3D divide_128_div_64_to_64((1ULL << l), 0, d, &r) << 1; +=09if (r << 1 < r || r << 1 >=3D d) +=09=09m++; +=09m =3D (1ULL << l) - d ? m + 1 : 1; =09R.m =3D m; =20 --=20 2.21.0 --- Diff of the applied patch vs upstream commit (please double-check if non-= empty: --- --- -=092019-12-10 14:49:40.427435154 +0000 +++ 0020-reciprocal-fix-off-by-one-with-32-bit-divisor.patch=092019-12-10 1= 4:49:39.012458513 +0000 @@ -1 +1 @@ -From 9b0a1dadc345805ca9d7428a977da080d5eee7e2 Mon Sep 17 00:00:00 2001 +From 28450d0732da46af14c4f39ef38a3db5a20cb478 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 9b0a1dadc345805ca9d7428a977da080d5eee7e2 ] + @@ -20 +21,0 @@ -Cc: stable@dpdk.org