From nobody Sat Nov 23 14:52:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1724882661; cv=none; d=zohomail.com; s=zohoarc; b=c/wxh4WfV8pOWEsK68k20bI+Ff847Gk0SOYDC/F+LjDdyjvdA8MhzbjX9rmBEnxantqThjsjC3tl5p0Eb67lD/HD/GWWjU1TMrG5vycwnrbPPwRkTlcd7wwrGP8nMkyyr2PTMLcO0sDsIErS7pCdrwbWTuH6aV2wOFx5yRIXM6o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724882661; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=uiSYv9zaENNOFB/jb2t7LrfrF1ZHW6+ZFjjQ3yb40Ek=; b=UnOvfAcbKy57ICn9hrDKbXEmz/zaduh3WGdIbcNcyCtr2/4zLquxrRK0zL6Pkqs4zIw+gIIX3hOOQ2Qjhf496Pvqs3zV/Ht2GVBP7MGL9VXIoDKAYxwYGAtZv/cm8+IMHwaJG2Fbi+VZOgA8pK/wkU0K/ygIliwJAyEBqMVSatg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1724882661261533.2032549346937; Wed, 28 Aug 2024 15:04:21 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.785164.1194571 (Exim 4.92) (envelope-from ) id 1sjQll-0006HE-2D; Wed, 28 Aug 2024 22:04:01 +0000 Received: by outflank-mailman (output) from mailman id 785164.1194571; Wed, 28 Aug 2024 22:04:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sjQlk-0006Fq-TV; Wed, 28 Aug 2024 22:04:00 +0000 Received: by outflank-mailman (input) for mailman id 785164; Wed, 28 Aug 2024 22:03:59 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sjQlj-0006E0-Ig for xen-devel@lists.xenproject.org; Wed, 28 Aug 2024 22:03:59 +0000 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [2a00:1450:4864:20::532]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 6cff8213-6589-11ef-a0b0-8be0dac302b0; Thu, 29 Aug 2024 00:03:58 +0200 (CEST) Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-5bf0261f162so8588209a12.0 for ; Wed, 28 Aug 2024 15:03:58 -0700 (PDT) Received: from andrewcoop.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c0bb1c2d2esm2695898a12.16.2024.08.28.15.03.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2024 15:03:56 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 6cff8213-6589-11ef-a0b0-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1724882637; x=1725487437; darn=lists.xenproject.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=uiSYv9zaENNOFB/jb2t7LrfrF1ZHW6+ZFjjQ3yb40Ek=; b=LMPUC3MnPKJV7324noSpfQG0pAxQKQJhuYPfYeJ31TavdAs7Jxa2pqenUnBGyaS3sb ok8QdClTdQoSjGELTwaWPNNAfmPxmvWrhnGGsE3rapP06R4DMySkSsdlvGsa87nUFjY0 UWRuoEBRNslNz1NcTjJTcYbKTXnsdNpresrbg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724882637; x=1725487437; 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=uiSYv9zaENNOFB/jb2t7LrfrF1ZHW6+ZFjjQ3yb40Ek=; b=Km9tPHpJv1nzLDzy4wc1QXFEO1AxW3lYYsARG7k6rUzhMfSoajRsbzsXYvLY0Fz2ad ltxZhfky9hZMprmCkmO8K2Q5yH5FY84T0S7ZuhctJyDXIexSwPz+CZL1X1RgcsO/ZeVz BpX6QNwlZfWxQqlHMuvHbIk9YtF1NtSNpbFJ4pxwVNmfKMeIs/kWUUcsveGhhK9Rtvq6 ZGphpN2RnRuUIE3Us6MzRXHJcZP7LnzV8S7C+uR4/gGWm6+NVcxHdIAFn+UbzzUWq4/l BjzpIRdkPZ/J2WOmKUVqUOsThpFI5s2Vy8OdyS3QewMhYOUb7vloCqfKfJLDC7tlo+pH wPxg== X-Gm-Message-State: AOJu0YwM6aSQo45fcKnidNEIdmXdPhr2YcPkeFInuzPKRhVrLZaJpugt 3fpuq1kxoCDP4LB0BSSNfU38DEKS8S2OeKwqR0ZFwctsEHJxciGEGk+8Y6T/amitum61EZHUD8m d X-Google-Smtp-Source: AGHT+IEtdemzdGxMgWOSMC2OOmCx1wf030Xl+NsCnh9UAs1rIvfUrQcYgpBhIgnas5MaVAkOPz96nA== X-Received: by 2002:a05:6402:518e:b0:5c0:bba6:860e with SMTP id 4fb4d7f45d1cf-5c21ed52c4dmr755306a12.18.1724882637093; Wed, 28 Aug 2024 15:03:57 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Michal Orzel , Oleksii Kurochko , Shawn Anastasio Subject: [PATCH v2 02/11] xen/bitops: Switch from __pure to attr_const Date: Wed, 28 Aug 2024 23:03:42 +0100 Message-Id: <20240828220351.2686408-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240828220351.2686408-1-andrew.cooper3@citrix.com> References: <20240828220351.2686408-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1724882663612116600 All of the ffs()/fls() infrastructure is in fact (attr) const, because it doesn't even read global state. This allows the compiler even more flexibility to optimise. No functional change. Reported-by: Jan Beulich Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Oleksii Kurochko CC: Shawn Anastasio v2: * New --- xen/include/xen/bitops.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h index 1cd43e464d9e..94af6da18b9b 100644 --- a/xen/include/xen/bitops.h +++ b/xen/include/xen/bitops.h @@ -32,8 +32,8 @@ extern void __bitop_bad_size(void); * * Bits are labelled from 1. Returns 0 if given 0. */ -unsigned int __pure generic_ffsl(unsigned long x); -unsigned int __pure generic_flsl(unsigned long x); +unsigned int attr_const generic_ffsl(unsigned long x); +unsigned int attr_const generic_flsl(unsigned long x); =20 /** * generic__test_and_set_bit - Set a bit and return its old value @@ -204,7 +204,7 @@ static always_inline bool test_bit(int nr, const volati= le void *addr) test_bit(nr, addr); \ }) =20 -static always_inline __pure unsigned int ffs(unsigned int x) +static always_inline attr_const unsigned int ffs(unsigned int x) { if ( __builtin_constant_p(x) ) return __builtin_ffs(x); @@ -216,7 +216,7 @@ static always_inline __pure unsigned int ffs(unsigned i= nt x) #endif } =20 -static always_inline __pure unsigned int ffsl(unsigned long x) +static always_inline attr_const unsigned int ffsl(unsigned long x) { if ( __builtin_constant_p(x) ) return __builtin_ffsl(x); @@ -228,7 +228,7 @@ static always_inline __pure unsigned int ffsl(unsigned = long x) #endif } =20 -static always_inline __pure unsigned int ffs64(uint64_t x) +static always_inline attr_const unsigned int ffs64(uint64_t x) { if ( BITS_PER_LONG =3D=3D 64 ) return ffsl(x); @@ -246,7 +246,7 @@ static always_inline __pure unsigned int ffs64(uint64_t= x) sizeof(x) <=3D sizeof(uint64_t) ? ffs64(x) : \ ({ BUILD_ERROR("ffs_g() Bad input type"); 0; })) =20 -static always_inline __pure unsigned int fls(unsigned int x) +static always_inline attr_const unsigned int fls(unsigned int x) { if ( __builtin_constant_p(x) ) return x ? 32 - __builtin_clz(x) : 0; @@ -258,7 +258,7 @@ static always_inline __pure unsigned int fls(unsigned i= nt x) #endif } =20 -static always_inline __pure unsigned int flsl(unsigned long x) +static always_inline attr_const unsigned int flsl(unsigned long x) { if ( __builtin_constant_p(x) ) return x ? BITS_PER_LONG - __builtin_clzl(x) : 0; @@ -270,7 +270,7 @@ static always_inline __pure unsigned int flsl(unsigned = long x) #endif } =20 -static always_inline __pure unsigned int fls64(uint64_t x) +static always_inline attr_const unsigned int fls64(uint64_t x) { if ( BITS_PER_LONG =3D=3D 64 ) return flsl(x); --=20 2.39.2