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 481DD45B38; Mon, 14 Oct 2024 16:26:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0A7B54027F; Mon, 14 Oct 2024 16:26:27 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 5751B40151 for ; Mon, 14 Oct 2024 16:26:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728915984; 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=/Yr8wxMUTdsTEN5WdKZojHiC42salNoRPoFfyfwyy0o=; b=f30xK7pVeypQzhFPnaQ8FKk4Vb90LRF8uJ4S2BKU8rgjXDLmZWoLwEL8Nb8x4skPZ3cFl7 vjpNozoN7sOoQ7BQnRGPND8yGhVNYojhIbEUWSzTIeobaqZJwXJ+2TTWMqdeCF0BrqP8Te KZwUKnkXNBLPD1j+/BMAFO6ZsE7FbUA= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-660--NaM3kQfOjynm07mMREq-w-1; Mon, 14 Oct 2024 10:26:23 -0400 X-MC-Unique: -NaM3kQfOjynm07mMREq-w-1 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-539e5f9df25so1565306e87.0 for ; Mon, 14 Oct 2024 07:26:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728915982; x=1729520782; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/Yr8wxMUTdsTEN5WdKZojHiC42salNoRPoFfyfwyy0o=; b=cebpvf3nzwl+jwRmLY97YxIcOddlfKfIeNWl1Fl5K2zNr4FEr+x9hW0hkkRHRmU8iq uDrLq7V0O1k2MOwp79kKQVRvTc/m1grVXbFgO+OePGnjBGKK14fLKOdt9TS/9h4vrROC ZMNNKoQiy1gIfGsGq4H7SMR7Ezgti6sfVeCsINZIDwQFNSikRjxzHMnH7EKY1dwWnPEY IH3jvNCLHj7NxmIyAR+4PAK6BMVEHi6TwNy/t72SuP+GdwiHJeZv01pyrQZ00jI9x46y yseJIv5hta+rOPJdO+gB+xkLPhTjgpub9JZ3coOlsAmVhq7bpzVxop4TOGblwFU2vHs5 VuOQ== X-Gm-Message-State: AOJu0YyOdQTd1SEdd3z5Bndh0Kkxf//dKJcwZKfZNQPbOqx9Y8G6y9ir UpdTJec2dH9/LmT8xhoTezzAv33Xg8oPxLprneXX6JJWbeGNSUCXEozCkXQrsbi05pumB9CMY+n rBfj2QV1KJopbIhKRPIzqkuMjZgupzAIX5oqGZlkd2+BPaiBGK1ZFgi4zZx6lzn7gTUbaXLS6RA Kav3Mybl0un7L+DIw= X-Received: by 2002:a05:6512:1250:b0:539:fa43:fc36 with SMTP id 2adb3069b0e04-539fa440821mr1483842e87.12.1728915982161; Mon, 14 Oct 2024 07:26:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGhO2jXvj/ClyvjB3Nng3e1FIHfyzPdoIjj3vcL+bIeV/kzRFh1KNPxCEE9uSRpvFx5X0Qa8feGELXX85DFT/g= X-Received: by 2002:a05:6512:1250:b0:539:fa43:fc36 with SMTP id 2adb3069b0e04-539fa440821mr1483805e87.12.1728915981712; Mon, 14 Oct 2024 07:26:21 -0700 (PDT) MIME-Version: 1.0 References: <20241011152533.3189097-1-david.marchand@redhat.com> <55889d87-e94c-4a94-9850-a2b3b7e8d5a4@lysator.liu.se> In-Reply-To: <55889d87-e94c-4a94-9850-a2b3b7e8d5a4@lysator.liu.se> From: David Marchand Date: Mon, 14 Oct 2024 16:26:10 +0200 Message-ID: Subject: Re: [PATCH] test/bitops: check worker lcore availability To: =?UTF-8?Q?Mattias_R=C3=B6nnblom?= Cc: dev@dpdk.org, Jack Bond-Preston , =?UTF-8?Q?Morten_Br=C3=B8rup?= , =?UTF-8?Q?Mattias_R=C3=B6nnblom?= , Tyler Retzlaff X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Sun, Oct 13, 2024 at 8:53=E2=80=AFAM Mattias R=C3=B6nnblom wrote: > > On 2024-10-11 17:25, David Marchand wrote: > > Coverity is not able to understand that having 2 lcores means that > > rte_get_next_lcore(-1, 0, 1) can't return RTE_MAX_LCORE. > > Add an assert. > > > > Coverity issue: 445382, 445383, 445384, 445387, 445389, 445391 > > Fixes: 35326b61aecb ("bitops: add atomic bit operations in new API") > > > > Signed-off-by: David Marchand > > --- > > Note: > > - a better fix would be to check lcore id validity in the EAL launch AP= I, > > but it requires inspecting all functions and it could result in some > > API change, so sending this as a simple fix for now, > > > > --- > > app/test/test_bitops.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/app/test/test_bitops.c b/app/test/test_bitops.c > > index 4200073ae4..4ed54709fb 100644 > > --- a/app/test/test_bitops.c > > +++ b/app/test/test_bitops.c > > @@ -159,6 +159,7 @@ test_bit_atomic_parallel_assign ## size(void) \ > > return TEST_SKIPPED; \ > > } \ > > worker_lcore_id =3D rte_get_next_lcore(-1, 1, 0); \ > > + TEST_ASSERT(worker_lcore_id < RTE_MAX_LCORE, "Failed to find a wo= rker lcore"); \ > > How about: > > static unsigned int > get_worker_lcore(void) > { > unsigned int lcore_id; > > lcore_id =3D rte_get_next_lcore(-1, 1, 0); > > /* avoid Coverity false positives */ > RTE_VERIFY(lcore_id < RTE_MAX_LCORE); > > return lcore_id; > } > > In the macros: > worker_lcore_id =3D get_worker_lcore(-1, 1, 0); > > Makes the macros a tiny bit smaller/less redundant and gives an > opportunity for a comment. Also, it's more appropriate to use RTE_VERIFY > I would argue, since rte_get_next_lcore() is not the SUT. I agree on the principle. I will send a new one when possible. --=20 David Marchand