From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 96BC545D76 for ; Wed, 27 Nov 2024 01:54:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 90054402E0; Wed, 27 Nov 2024 01:54:47 +0100 (CET) Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by mails.dpdk.org (Postfix) with ESMTP id D715E42D26 for ; Wed, 27 Nov 2024 01:54:45 +0100 (CET) Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-382423f4082so4502237f8f.3 for ; Tue, 26 Nov 2024 16:54:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732668885; x=1733273685; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=x0cDat7H8hY98Ma0alYRZCH2gHKNfw/5YFMjP8AMM54=; b=VQfJH72temN0vzjxSZsVsuBECQAj37+x7WMxKeSUnJ2YkdxDxdp19C9DQD+nxrPfrc BlMLcDqJ2jcv1RmETNC9p2s4/mkVSb4Ohiyhu/GN36MI+2jpSi0opvebH8HU4eG0N+0K e1BJ+bZ9ulAc3yXYIVY6auISbTauAXHkrPpK+za2G7tH9SmeGB1mjF9BJXrSLixowvhO LDRLz2nl2Yoxw8dBGoWA1FocDqoeviKaYlSZQrzSzIw/codNExBw0U2CmryL/+3CYAiG cSH83wURauyOjpgTktdvn3Q0pNviQjUJqaBAGrXICPBucbekLSzXDimE2yEZmv/8uo5K zaTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732668885; x=1733273685; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x0cDat7H8hY98Ma0alYRZCH2gHKNfw/5YFMjP8AMM54=; b=m6drjvrdQu3DZ5t+oJ8V24q77ouzWxAzwcP4kNW5xFvxOW/YgZLZ8p/9UA2HP8MbU1 yH3EF7XW+Edl96I6Y+U3Lzm1sFow3Ap3X8MesfoBBnBUWb7ZCFwjxto38qg1LfIQPm6C 9YCqo+WwpH8CnbxLrTHPE3bG0SqlbhSEZFA0Q0lHW1PvE9uS1CftEjFne3caJf4ADugQ gPuEOAVePYe+IJ5oVBJQvl8gYbtv74sWpyzZArAZu0cY69F9DcqV5fisM4dBXXfAty/Q 79PQb6GNsU9u4Tzg2rnY9Ph4Hr46dsE8heO9sKryt7/TGdw8UjHim8r69V3KPeSJnZNY Kg7w== X-Forwarded-Encrypted: i=1; AJvYcCVH4lJyNcdsFr7+20IQEIEjHLdxbpGxuypyDpFOHMaNGHYr0EHE/NipyLJ2+9VarKoIzohM8qw=@dpdk.org X-Gm-Message-State: AOJu0YxJ8M9uy3xchyGPEFy4QQP5hbUII6SL0mlri8lxNAy7Orziwh0C gAavBVur33sVk0aPC3fIexkcqkp3Z21X5EstU0AiBZi1rTtptq6TZB0hlQ== X-Gm-Gg: ASbGncs6Jpl9b18ePyh44zjCAlFyuY+ZSMMZt0I9QXgjdCvGgbmi+MHKrBY2DCvBWgv yH+4MC4ffUSNXoKVvI6XtdAp6FTxXhvLtDq52TBTdQxzEgZgAITuTUfr/dqRSvGl16bSlWnz9i0 YjjIBH7xnlfaozIBujmfZLdu07MnpyhNApYJdTCDvoygrGHE3g80EUz+Fnv+lMpUaE4sxwHtrws hreAERcKJ9pIL037aRp0u5WTbTscj+HhoEO3Pl8HdkGJaDGJ6Fo3dwn X-Google-Smtp-Source: AGHT+IG4ZQiZfscj1L2mC8xfdOo2f23HF2morD3ABDD2wHEBLmV9+UD0oBRBRz95UhSwjoqQoQRq+A== X-Received: by 2002:a5d:64ce:0:b0:382:31db:d61 with SMTP id ffacd0b85a97d-385c6edd761mr573626f8f.38.1732668885419; Tue, 26 Nov 2024 16:54:45 -0800 (PST) Received: from localhost ([2a01:4b00:d036:ae00:2203:ead5:e694:df3c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3825fb537dfsm14645223f8f.63.2024.11.26.16.54.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 16:54:44 -0800 (PST) From: luca.boccassi@gmail.com To: Stephen Hemminger Cc: Bruce Richardson , dpdk stable Subject: patch 'test/eal: fix loop coverage for alignment macros' has been queued to stable release 22.11.7 Date: Wed, 27 Nov 2024 00:54:30 +0000 Message-ID: <20241127005435.188430-4-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241127005435.188430-1-luca.boccassi@gmail.com> References: <20241120234215.233355-28-luca.boccassi@gmail.com> <20241127005435.188430-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 Hi, FYI, your patch has been queued to stable release 22.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 11/29/24. 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. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/f7b5b45e72939a8bd23d6dc75da6bbeed353c7af Thanks. Luca Boccassi --- >From f7b5b45e72939a8bd23d6dc75da6bbeed353c7af Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 21 Nov 2024 10:23:27 -0800 Subject: [PATCH] test/eal: fix loop coverage for alignment macros [ upstream commit b3e64fe596a3117edf6d3a79a6c5238a9b92dc4f ] The test loop was much shorter than desired because when MAX_NUM is defined with out paren's the divide operator / takes precedence over shift. But when MAX_NUM is fixed, some tests take too long and have to be modified to avoid running over full N^2 space of 1<<20. Note: this is a very old bug, goes back to 2013. Link: https://pvs-studio.com/en/blog/posts/cpp/1179/ Fixes: 1fb8b07ee511 ("app: add some tests") Signed-off-by: Stephen Hemminger Acked-by: Bruce Richardson --- app/test/test_common.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/app/test/test_common.c b/app/test/test_common.c index f89e1eb7ee..372bb8f6ba 100644 --- a/app/test/test_common.c +++ b/app/test/test_common.c @@ -8,11 +8,12 @@ #include #include #include +#include #include #include "test.h" -#define MAX_NUM 1 << 20 +#define MAX_NUM (1 << 20) #define FAIL(x)\ {printf(x "() test failed!\n");\ @@ -217,19 +218,21 @@ test_align(void) } } - for (p = 1; p <= MAX_NUM / 2; p++) { - for (i = 1; i <= MAX_NUM / 2; i++) { - val = RTE_ALIGN_MUL_CEIL(i, p); - if (val % p != 0 || val < i) - FAIL_ALIGN("RTE_ALIGN_MUL_CEIL", i, p); - val = RTE_ALIGN_MUL_FLOOR(i, p); - if (val % p != 0 || val > i) - FAIL_ALIGN("RTE_ALIGN_MUL_FLOOR", i, p); - val = RTE_ALIGN_MUL_NEAR(i, p); - if (val % p != 0 || ((val != RTE_ALIGN_MUL_CEIL(i, p)) - & (val != RTE_ALIGN_MUL_FLOOR(i, p)))) - FAIL_ALIGN("RTE_ALIGN_MUL_NEAR", i, p); - } + /* testing the whole space of 2^20^2 takes too long. */ + for (j = 1; j <= MAX_NUM ; j++) { + i = rte_rand_max(MAX_NUM - 1) + 1; + p = rte_rand_max(MAX_NUM - 1) + 1; + + val = RTE_ALIGN_MUL_CEIL(i, p); + if (val % p != 0 || val < i) + FAIL_ALIGN("RTE_ALIGN_MUL_CEIL", i, p); + val = RTE_ALIGN_MUL_FLOOR(i, p); + if (val % p != 0 || val > i) + FAIL_ALIGN("RTE_ALIGN_MUL_FLOOR", i, p); + val = RTE_ALIGN_MUL_NEAR(i, p); + if (val % p != 0 || ((val != RTE_ALIGN_MUL_CEIL(i, p)) + & (val != RTE_ALIGN_MUL_FLOOR(i, p)))) + FAIL_ALIGN("RTE_ALIGN_MUL_NEAR", i, p); } return 0; -- 2.45.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-11-27 00:29:59.642992233 +0000 +++ 0004-test-eal-fix-loop-coverage-for-alignment-macros.patch 2024-11-27 00:29:59.504711022 +0000 @@ -1 +1 @@ -From b3e64fe596a3117edf6d3a79a6c5238a9b92dc4f Mon Sep 17 00:00:00 2001 +From f7b5b45e72939a8bd23d6dc75da6bbeed353c7af Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit b3e64fe596a3117edf6d3a79a6c5238a9b92dc4f ] + @@ -18 +19,0 @@ -Cc: stable@dpdk.org @@ -27 +28 @@ -index 21eb2285e1..6dbd7fc9a9 100644 +index f89e1eb7ee..372bb8f6ba 100644 @@ -30 +31,2 @@ -@@ -9,11 +9,12 @@ +@@ -8,11 +8,12 @@ + #include @@ -32 +33,0 @@ - #include @@ -44 +45 @@ -@@ -218,19 +219,21 @@ test_align(void) +@@ -217,19 +218,21 @@ test_align(void)