[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH][for-next][for-4.19 v2 1/8] xen/include: add macro LOWEST_BIT


  • To: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 16 Oct 2023 17:33:36 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JBokwC2mnfdRoh97JfouDhPZyzLPNML0HpprPGECk6E=; b=bFGiE7VAvEepy8PhT1YL5SDtYdKCWVmUDzdo+A9IzR0QJbjiNQJ+8S1mx1Iq9SoJneKoHUA8hJY08fPNfQBNS5ow7BW2aZqD5C65JjJJPWurZk4jEaTy2WdMSvQHU43cj5wD0/GBNltWETgNZIgeXLo6PMoM4nvLpHK2wNu4Hrxjv7AwVs+TGOYLhEYrOkhKOIb7AoZD7rSteDJURRyVTXMNCCElfyNYfgjM6HDQrEx+v14ksQ7E4RtASD0wdVb6BxR3DsEROH+sBNr1dDwjr4H7MJ0+M3Alep1X4G1/3+1IQQq7lLzoxdP8wFWQPi55Nt6iWWkFTtO8FQ3yL0utmQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i9dHEMf131qX5IU4BsqCG4w7WCyJ9Xo400s52MwHu1IwsSFIlNpavUsM52eQD95ih5jwzV+vaoX7PIw4BnH1BuENzSqMyQUGZxRwzRkQVksG1aJ8OvSki/k+RmEae3nCpa+X4J/140k8VoRuAhZVH4j0dha/5Rb8reYe1I3kZIy5m6e/DpPSe5CnyjEqJzZmTq8iGQI2HhiSD/7PZHtpzMlwmvsRQwBIPGNbxvd6O5czgyzDJC9z6ijHC82qikuiKh/S5IwYHg4D37tub+0Dl+zEE0+WJztm+H5++vK64epZguUPdCQKbMhz5EjHGJfoX6VuSsyna6T2RKvxkm+PbA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: sstabellini@xxxxxxxxxx, michal.orzel@xxxxxxx, xenia.ragiadakou@xxxxxxx, ayan.kumar.halder@xxxxxxx, consulting@xxxxxxxxxxx, andrew.cooper3@xxxxxxxxxx, roger.pau@xxxxxxxxxx, Simone Ballarin <simone.ballarin@xxxxxxxxxxx>, Doug Goldstein <cardoe@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 16 Oct 2023 15:33:47 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 12.10.2023 17:28, Nicola Vetrini wrote:
> --- a/automation/eclair_analysis/ECLAIR/deviations.ecl
> +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
> @@ -274,6 +274,12 @@ still non-negative."
>  -config=MC3R1.R10.1,etypes+={safe, 
> "stmt(operator(logical)||node(conditional_operator||binary_conditional_operator))",
>  "dst_type(ebool||boolean)"}
>  -doc_end
> 
> +-doc_begin="The macro LOWEST_BIT encapsulates a well-known pattern to obtain 
> the value
> +2^ffs(x) for unsigned integers on two's complement architectures
> +(all the architectures supported by Xen satisfy this requirement)."
> +-config=MC3R1.R10.1,reports+={safe, 
> "any_area(any_loc(any_exp(macro(^LOWEST_BIT$))))"}
> +-doc_end

Why is this added here rather than by ...

> --- a/xen/include/xen/macros.h
> +++ b/xen/include/xen/macros.h
> @@ -8,8 +8,10 @@
>  #define DIV_ROUND(n, d) (((n) + (d) / 2) / (d))
>  #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
> 
> -#define MASK_EXTR(v, m) (((v) & (m)) / ((m) & -(m)))
> -#define MASK_INSR(v, m) (((v) * ((m) & -(m))) & (m))

a SAF-<n>-safe comment here?

> +#define LOWEST_BIT(x) ((x) & -(x))

Personally I consider the name misleading: I'd expect a macro of this
name to return a bit number, not a mask with a single bit set. No
good, reasonably short name comes to mind - ISOLATE_LOW_BIT() is too
long for my taste.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.