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 10711A051C for ; Tue, 11 Feb 2020 12:22:35 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 00F402BF4; Tue, 11 Feb 2020 12:22:35 +0100 (CET) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by dpdk.org (Postfix) with ESMTP id 437A62B9C for ; Tue, 11 Feb 2020 12:22:33 +0100 (CET) Received: by mail-wr1-f47.google.com with SMTP id u6so11902170wrt.0 for ; Tue, 11 Feb 2020 03:22:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=q7qvrY1RQy/vCJvStBmSD2E4TKKTPXE/dkqtak4WALw=; b=uorNOb1PHTvV9EBaT+vFaEq3k+CMAKwrjKBbGKztffrhaz6Vbjuqef0XgtWbPHz1Zt cIDab8TFCdRZzQsXRMFxgKD8OKjHbbt4OBYfOuik4WraWb+Km0/jqV6JCDmosOpr4+Oc B0A2cB/dNW579xCOmcKKxyigtu+PjS7/Vb2Z9Lr7PUiXxyAJVlE0pBANn07hZ9xROUgf sStwG0vGEkmQrpDC2/xY4X3iqXu7UYcs1nV8YSn/J/ZKZwoNHvddowGKF8cIN9JzpVg2 2Dtrb//w4TxsvnXRneXBhEnNrQZR29Oc1C3ZsfxErAdRsCeeaC9GRGKXrKPVXp+0+pk8 mKxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=q7qvrY1RQy/vCJvStBmSD2E4TKKTPXE/dkqtak4WALw=; b=r1K9dsG9BO7JibE863jJjyObCAk4P8hNrU312HgIaTdSck4MFrDnNEMu/gTfPbpYmb v5V1fM03HAxR+0klgMIopDVE788g4Mpcx2KhDYsxNETSWVH+Vvmvea6qDdcxfE2yWEKo SqGLZxSiXOK7ywtyyeYQkjEZAe1h6hEZhUAQmtXOHefvzfn1WuoZ7UH8nQVw7JWEHueX p0gBLnD5D+thM0b+O61kVrOYAi0DdGvhWnZb1Woy5cu/r5A8Qt5a1DjFz5OJL+GKxft6 moNIT6uqY4NkNPvHU/R+5fV0w6qaSK48mf4FWfgxb+qKv6pggbKn7jEB8WLGV3pV1OlM 9gdQ== X-Gm-Message-State: APjAAAXqSYhA2Y5v/BosmJ5z2JDYZElX8N5DmB2NkIgvmY/mUrHz2V7g kx+ig3xDqkMzdIdOMgzkNNg= X-Google-Smtp-Source: APXvYqwPcGrHvpvLWKNk3ziDEtjSTNeXNNRI/pawsGCbmS4B2zMF3vSxMoQGIB2diFmffMaV6bALfg== X-Received: by 2002:a5d:5345:: with SMTP id t5mr8747904wrv.0.1581420152966; Tue, 11 Feb 2020 03:22:32 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id 18sm3411509wmf.1.2020.02.11.03.22.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Feb 2020 03:22:32 -0800 (PST) From: luca.boccassi@gmail.com To: David Marchand Cc: Aaron Conole , dpdk stable Date: Tue, 11 Feb 2020 11:19:12 +0000 Message-Id: <20200211112216.3929-6-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200211112216.3929-1-luca.boccassi@gmail.com> References: <20200211112216.3929-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'test/common: fix log2 check' has been queued to stable release 19.11.1 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 stable release 19.11.1 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/13/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 rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From 80e5c632b72b582777a8615d7a2cb660b8425b27 Mon Sep 17 00:00:00 2001 From: David Marchand Date: Fri, 20 Dec 2019 15:01:49 +0100 Subject: [PATCH] test/common: fix log2 check [ upstream commit 30a0df64aaed5cbf33fd5d237d5812cee1cc0ef9 ] We recently started to get random failures on the common_autotest ut with clang on Ubuntu 16.04.6. Example: https://travis-ci.com/DPDK/dpdk/jobs/263177424 Wrong rte_log2_u64(0) val 0, expected ffffffff Test Failed The ut passes 0 to log2() to get an expected value. Quoting log2 / log(3) manual: If x is zero, then a pole error occurs, and the functions return -HUGE_VAL, -HUGE_VALF, or -HUGE_VALL, respectively. rte_log2_uXX helpers handle 0 as a special value and return 0. Let's have dedicated tests for this case. Fixes: 05c4345ef5c2 ("test: add unit test for integer log2 function") Signed-off-by: David Marchand Acked-by: Aaron Conole --- app/test/test_common.c | 14 +++++++++++++- lib/librte_eal/common/include/rte_common.h | 6 ++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/test/test_common.c b/app/test/test_common.c index 2b856f8ba5..12bd1cad90 100644 --- a/app/test/test_common.c +++ b/app/test/test_common.c @@ -216,7 +216,19 @@ test_log2(void) const uint32_t max = 0x10000; const uint32_t step = 1; - for (i = 0; i < max; i = i + step) { + compare = rte_log2_u32(0); + if (compare != 0) { + printf("Wrong rte_log2_u32(0) val %x, expected 0\n", compare); + return TEST_FAILED; + } + + compare = rte_log2_u64(0); + if (compare != 0) { + printf("Wrong rte_log2_u64(0) val %x, expected 0\n", compare); + return TEST_FAILED; + } + + for (i = 1; i < max; i = i + step) { uint64_t i64; /* extend range for 64-bit */ diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h index 459d082d14..c352838073 100644 --- a/lib/librte_eal/common/include/rte_common.h +++ b/lib/librte_eal/common/include/rte_common.h @@ -538,6 +538,9 @@ rte_bsf32_safe(uint64_t v, uint32_t *pos) /** * Return the rounded-up log2 of a integer. * + * @note Contrary to the logarithm mathematical operation, + * rte_log2_u32(0) == 0 and not -inf. + * * @param v * The input parameter. * @return @@ -632,6 +635,9 @@ rte_fls_u64(uint64_t x) /** * Return the rounded-up log2 of a 64-bit integer. * + * @note Contrary to the logarithm mathematical operation, + * rte_log2_u64(0) == 0 and not -inf. + * * @param v * The input parameter. * @return -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-02-11 11:17:39.145096561 +0000 +++ 0006-test-common-fix-log2-check.patch 2020-02-11 11:17:38.303999552 +0000 @@ -1,8 +1,10 @@ -From 30a0df64aaed5cbf33fd5d237d5812cee1cc0ef9 Mon Sep 17 00:00:00 2001 +From 80e5c632b72b582777a8615d7a2cb660b8425b27 Mon Sep 17 00:00:00 2001 From: David Marchand Date: Fri, 20 Dec 2019 15:01:49 +0100 Subject: [PATCH] test/common: fix log2 check +[ upstream commit 30a0df64aaed5cbf33fd5d237d5812cee1cc0ef9 ] + We recently started to get random failures on the common_autotest ut with clang on Ubuntu 16.04.6. @@ -21,7 +23,6 @@ Let's have dedicated tests for this case. Fixes: 05c4345ef5c2 ("test: add unit test for integer log2 function") -Cc: stable@dpdk.org Signed-off-by: David Marchand Acked-by: Aaron Conole