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 15E3B43F6A; Thu, 2 May 2024 18:21:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8EAFF402B2; Thu, 2 May 2024 18:21:04 +0200 (CEST) Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by mails.dpdk.org (Postfix) with ESMTP id DA8A740299 for ; Thu, 2 May 2024 18:21:03 +0200 (CEST) Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1ec92e355bfso19690725ad.3 for ; Thu, 02 May 2024 09:21:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1714666863; x=1715271663; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=TuuKlob0t7LT4n4h3d9IcVzloVwl/PuiUwTLuSbV2Eg=; b=D9+/ocq4fh2ADBpCtc01KZJzy2X3ufNNLSxhpDfMGt1VGdt/G8EGglfydhkDqH0sol 1/uTzvqbgPhhs+8vQ1YFwPxLa10QK/v9dwd4ctrPrOGf32NGBoZqpNPXCv3cXajVhWUC 2sLsOmYwsgpF666RENMYQRDRIFmNazGdC4sNWq6F8YALiajnr3cvn0SjEsssgbfjfsyu LtM5heJYKBSyg3AGu22WFDgtaiEU/4MOyu0v9BAZueaB6N2OUGBYPMit5ZkyU+kPUpFE D/4M08ZcnhTjUd0TryxgJYuSKGSobGI1AiW1MnrWFJ15Xi7Rxo7Fj+dfmw+x1PgguXkn QRfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714666863; x=1715271663; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TuuKlob0t7LT4n4h3d9IcVzloVwl/PuiUwTLuSbV2Eg=; b=BspnshsKlf8un2mpC/01QvJ/AQ/wL2tUpY18A9SGwp961hDZa/KGJ6GGK3L3wWbQ7N QlTvHVoJm3+s/j7a4qG9U3X/dg+TysJq1+PVY3r6FnIMeKPU0cnqFNxqHjr1fmA3kE3q iCxjsEflkFcfuDm2F51f8xxAEyh/KPlLENhjeoKxxMZbMB68cgsKbxR0Q04SqYi8hQ4O kUgUQxTm4YCP5ShsM7nw2sJpE4O0cujLrZ7+T4W35Z1fgKfwm66vrsqsCmNVfk8lyG/7 xrUofQSgcXVvglainQHeL5WREzs3upGy/gZtKdRUDkHdlAxcC+UzJO9GBrBVW+rpHHpQ ZW0g== X-Forwarded-Encrypted: i=1; AJvYcCUwVAOBJLUizOdPomrWYvpADzTo9YOGQQjmL/t0mPL/9RooV1HGiWKADR3gADQGJaPDud3PRU4TJw29Suc= X-Gm-Message-State: AOJu0YwrCF7AgA/H3DEltvnY5u41xuHE20fTjVaYJuarZhdlOpYML6No o9z/u20WsC0nECiQFKH8HL++xENv3GeqwVEu6PGjU9skyyjVBVBFBQX1EPo1GGc= X-Google-Smtp-Source: AGHT+IGb2VBi93lbjd16YMmNGsjEykT7WosEOY0yg/c31vTLpRnEUoqhO29rNCV7oCZ9y5SELD9yjg== X-Received: by 2002:a17:902:e891:b0:1e4:3ed8:e264 with SMTP id w17-20020a170902e89100b001e43ed8e264mr139133plg.43.1714666847280; Thu, 02 May 2024 09:20:47 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id i10-20020a170902c94a00b001eb4a71cb58sm1497303pla.114.2024.05.02.09.20.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 09:20:46 -0700 (PDT) Date: Thu, 2 May 2024 09:20:45 -0700 From: Stephen Hemminger To: Daniel Gregory Cc: Ruifeng Wang , dev@dpdk.org, Punit Agrawal , Liang Ma Subject: Re: [PATCH] eal/arm: replace RTE_BUILD_BUG on non-constant Message-ID: <20240502092045.02a426fe@hermes.local> In-Reply-To: <20240502142116.63760-1-daniel.gregory@bytedance.com> References: <20240502142116.63760-1-daniel.gregory@bytedance.com> MIME-Version: 1.0 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 Thu, 2 May 2024 15:21:16 +0100 Daniel Gregory wrote: > The ARM implementation of rte_pause uses RTE_BUILD_BUG_ON to check > memorder, which is not constant. This causes compile errors when it is > enabled with RTE_ARM_USE_WFE. eg. >=20 > ../lib/eal/arm/include/rte_pause_64.h: In function =E2=80=98rte_wait_unti= l_equal_16=E2=80=99: > ../lib/eal/include/rte_common.h:530:56: error: expression in static asser= tion is not constant > 530 | #define RTE_BUILD_BUG_ON(condition) do { static_assert(!(conditio= n), #condition); } while (0) > | ^~~~~~~~~~= ~~ > ../lib/eal/arm/include/rte_pause_64.h:156:9: note: in expansion of macro = =E2=80=98RTE_BUILD_BUG_ON=E2=80=99 > 156 | RTE_BUILD_BUG_ON(memorder !=3D rte_memory_order_acquire && > | ^~~~~~~~~~~~~~~~ >=20 > This has been the case since the switch to C11 assert (537caad2). Fix > the compile errors by replacing the check with an RTE_ASSERT. >=20 > Signed-off-by: Daniel Gregory The memory order passed to those routines must be constant. Why not: diff --git a/lib/eal/arm/include/rte_pause_64.h b/lib/eal/arm/include/rte_p= ause_64.h index 5cb8b59056..81987de771 100644 --- a/lib/eal/arm/include/rte_pause_64.h +++ b/lib/eal/arm/include/rte_pause_64.h @@ -172,6 +172,8 @@ rte_wait_until_equal_32(volatile uint32_t *addr, uint32= _t expected, { uint32_t value; =20 + static_assert(__builtin_constant_p(memorder), "memory order is not = a constant"); + RTE_BUILD_BUG_ON(memorder !=3D rte_memory_order_acquire && memorder !=3D rte_memory_order_relaxed); =20 @@ -191,6 +193,8 @@ rte_wait_until_equal_64(volatile uint64_t *addr, uint64= _t expected, { uint64_t value; =20 + static_assert(__builtin_constant_p(memorder), "memory order is not = a constant"); + RTE_BUILD_BUG_ON(memorder !=3D rte_memory_order_acquire && memorder !=3D rte_memory_order_relaxed); =20