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 BAD1743F6C; Thu, 2 May 2024 23:48:30 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 89BB0402C9; Thu, 2 May 2024 23:48:30 +0200 (CEST) Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by mails.dpdk.org (Postfix) with ESMTP id 7F93F402C4 for ; Thu, 2 May 2024 23:48:29 +0200 (CEST) Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-6f44b296e1fso105935b3a.3 for ; Thu, 02 May 2024 14:48:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1714686508; x=1715291308; 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=N22S20m6h+2l+HfkGJFr3ymIT3kGOOzXx4xdldSg0wY=; b=iMXxNTQ4ggti9iOfbNIkJjpEzlRfRi5Kov/nqp1cW7odIqYi8k0+fTrlicaBK23ONg CIg7nSV92xcWMSMlypiZqI/92stYDbl4zj85C3cmP+r8W/sfGUS9ukKw4J151nhGt/u5 J54zPN4pCiYjwSx0s5xaSklYmJvQOIdUqgOHVSipSfs5aGTTXBkWQwvSUJBnAPEJIbbj MANcvV+uGqPjkSLTzIApz4hr+FzdCOSt/7P0FZnNAMk4s4PseuJ57PDuN328FNrs/OJ2 77+h3SM1jNLP3elRx1pqU6nep4t8c6aC3+Sl6w3xCzLd+6nKhDm/3E2AvWndeRZwTgvI 51cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714686508; x=1715291308; 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=N22S20m6h+2l+HfkGJFr3ymIT3kGOOzXx4xdldSg0wY=; b=ccGO56xP/I5ujeToDXiGRJwnXDZ5GB8LLvsrWhtKl74hLcG2ThY+FfnyP/Op1dxuq6 tCG/gvB+BgZRuN0Nl9U9EL7syaumE9nZn7szvt5a5CBSNTRKzdi2My7MosgWijZvjT85 5ftM15632DVEaho+mAzKk0c/5shCeEHayQkuAz9NvoJx1ensGzbyhTFDrsshXnHD4LOS HORjomSg4Xi6h64CM1AZKNW3XNwgktMnjQNABEE6lQcZeolWO90JvIN8iIBmSVBGgaWR NFVX0TAl+4945Df3OJm+qGawNb/VU1odAjnSlPpvk+lndfOrfIWSB1gkQYTxVLj/pQH0 VTvg== X-Forwarded-Encrypted: i=1; AJvYcCWulVVagdTsl8vsdO4qYbo084wRNPeQwK66QSW5iOdcXxomEedgrVjnSP5CE6Akp1IIIyEIMmVPOB/WmRs= X-Gm-Message-State: AOJu0YzguKW8vA85KFHenh6whGWu2ipmfh5nzCqaX2fcjqmFb4eiJ6OP puohHA/oCeU/sotZS3tJxCwiCKe/szYUSaplCOqkdi5rx01kFoo5ffJeb0W3rOw= X-Google-Smtp-Source: AGHT+IExOSko+FFjD2cleI/bn0S5KHRD5K4MBQtjjM/jU/v9bqdCYG4EdKEcnK+OBBMVNEROwRThzw== X-Received: by 2002:a05:6a20:20c5:b0:1ad:68c9:7e4c with SMTP id t5-20020a056a2020c500b001ad68c97e4cmr832989pza.43.1714686508637; Thu, 02 May 2024 14:48:28 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id ft22-20020a17090b0f9600b002acfe00c742sm1761273pjb.21.2024.05.02.14.48.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 14:48:28 -0700 (PDT) Date: Thu, 2 May 2024 14:48:26 -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: <20240502144826.42d7012a@hermes.local> In-Reply-To: <20240502174420.GA3883350@ste-uk-lab-gw> References: <20240502142116.63760-1-daniel.gregory@bytedance.com> <20240502092045.02a426fe@hermes.local> <20240502174420.GA3883350@ste-uk-lab-gw> 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 18:44:20 +0100 Daniel Gregory wrote: > On Thu, May 02, 2024 at 09:20:45AM -0700, Stephen Hemminger wrote: > > Why not: > > diff --git a/lib/eal/arm/include/rte_pause_64.h b/lib/eal/arm/include/r= te_pause_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, ui= nt32_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, ui= nt64_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 >=20 > What toolchain are you using? With your change I still get errors about > the expression not being constant: >=20 > In file included from ../lib/eal/arm/include/rte_pause.h:13, > from ../lib/eal/include/generic/rte_spinlock.h:25, > from ../lib/eal/arm/include/rte_spinlock.h:17, > from ../lib/telemetry/telemetry.c:20: > ../lib/eal/arm/include/rte_pause_64.h: In function =E2=80=98rte_wait_unti= l_equal_16=E2=80=99: > ../lib/eal/arm/include/rte_pause_64.h:156:23: error: expression in static= assertion is not constant > 156 | static_assert(__builtin_constant_p(memorder), "memory ord= er is not a constant"); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >=20 > I'm cross-compiling with GCC v12.2 using the > config/arm/arm64_armv8_linux_gcc cross-file, and enabling > RTE_ARM_USE_WFE by uncommenting it in config/arm/meson.build and setting > its value to true. I don't do ARM any more, suppose could build on Raspberry Pi but havent. There are already constant checks like this elsewhere in the file. Why not = this: diff --git a/lib/eal/arm/include/rte_pause_64.h b/lib/eal/arm/include/rte_p= ause_64.h index 5cb8b59056..4f54f5dac3 100644 --- a/lib/eal/arm/include/rte_pause_64.h +++ b/lib/eal/arm/include/rte_pause_64.h @@ -153,6 +153,7 @@ rte_wait_until_equal_16(volatile uint16_t *addr, uint16= _t expected, { uint16_t value; =20 + RTE_BUILD_BUG_ON(!__builtin_constant_p(memorder)); RTE_BUILD_BUG_ON(memorder !=3D rte_memory_order_acquire && memorder !=3D rte_memory_order_relaxed); =20 @@ -172,6 +173,7 @@ rte_wait_until_equal_32(volatile uint32_t *addr, uint32= _t expected, { uint32_t value; =20 + RTE_BUILD_BUG_ON(!__builtin_constant_p(memorder)); RTE_BUILD_BUG_ON(memorder !=3D rte_memory_order_acquire && memorder !=3D rte_memory_order_relaxed); =20 @@ -191,6 +193,7 @@ rte_wait_until_equal_64(volatile uint64_t *addr, uint64= _t expected, { uint64_t value; =20 + RTE_BUILD_BUG_ON(!__builtin_constant_p(memorder)); RTE_BUILD_BUG_ON(memorder !=3D rte_memory_order_acquire && memorder !=3D rte_memory_order_relaxed);