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

Re: [PATCH v14 1/9] xen: introduce generic non-atomic test_*bit()


  • To: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Tue, 2 Jul 2024 15:11:05 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gmail.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=PeWdMwVCY3f6tmMWnRqlf2QOlbDIcDm8kK0e0AHA6s4=; b=UClKFA4ceThDIMMc21fo/nPbeXpGJz7ZuKF/C+tVb4MT9PQoaobdfWIIifGBTZwcVJtO1tHgLSMO/gcXMz6FCX9+qcyTsN8Vcx2WbgQRyerS4laXE3E4DWyBBzCRwbhaO0lKUHJ7LsSHfYijcBvLS/Z3vuen8TRCSbbY92kPSrof9k9LY77IQdPLhGboxEjOyyl9XhcFkdh8187xr0vzWaI93yGvLwnVSCjgV8iaBl9r71QcXEMr+XsB/Z+eNI/6jXfTpuu7kzYveb+i4RogkzLH7i8YEGmSQF0iiOmBmho4JRiNYw+lF/uLTAKiauhZhlHO3jjkRs8k0PcXJ3lqvw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cUK7oA9iSOfv6ozm9mUpeEzjo1AHxx9sHtzqmcKA6MxMu3H2UYbZYGR9g4ZTL7EdbXT78iQ3p0Es8GRCFtHzlfYgLPMQ6RIWHVn7UcWXvuhdPNOThKjy3nmfUdxKr2rfcxDIoCNAdB+4IT2WzPPTwqLjXYO2qR0pCKUaYxexCrNVKgTyXpLXvuhZIgrw+7pLiSumYBZe3kWGJ6I4EQmW/uSXMIvpDq5ApOY31QCUtbcrsu9/dAubH9pSx8O9Qkix3INLF+jARj1BAIE8UJ0iaRFD7iXp1ytjbO1Le3QoRkK2wZLJvfQwKoxY3U5W9zg+4+vRG9v04yPLNvVsDHzt+w==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Shawn Anastasio <sanastasio@xxxxxxxxxxxxxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Tue, 02 Jul 2024 13:11:27 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Oleksii,

On 02/07/2024 13:01, Oleksii Kurochko wrote:
> 
> 
> The following generic functions were introduced:
> * test_bit
> * generic__test_and_set_bit
> * generic__test_and_clear_bit
> * generic__test_and_change_bit
> 
> These functions and macros can be useful for architectures
> that don't have corresponding arch-specific instructions.
> 
> Also, the patch introduces the following generics which are
> used by the functions mentioned above:
> * BITOP_BITS_PER_WORD
> * BITOP_MASK
> * BITOP_WORD
> * BITOP_TYPE
> 
> The following approach was chosen for generic*() and arch*() bit
> operation functions:
> If the bit operation function that is going to be generic starts
> with the prefix "__", then the corresponding generic/arch function
> will also contain the "__" prefix. For example:
>  * test_bit() will be defined using arch_test_bit() and
>    generic_test_bit().
>  * __test_and_set_bit() will be defined using
>    arch__test_and_set_bit() and generic__test_and_set_bit().
> 
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>

with one question...

[...]

> diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
> index 6a5e28730a..cc09d273c9 100644
> --- a/xen/include/xen/bitops.h
> +++ b/xen/include/xen/bitops.h
> @@ -4,6 +4,19 @@
>  #include <xen/compiler.h>
>  #include <xen/types.h>
> 
> +#define BITOP_BITS_PER_WORD 32
> +typedef uint32_t bitop_uint_t;
> +
> +#define BITOP_MASK(nr)  ((bitop_uint_t)1 << ((nr) % BITOP_BITS_PER_WORD))
> +
> +#define BITOP_WORD(nr)  ((nr) / BITOP_BITS_PER_WORD)
> +
> +#define BITS_PER_BYTE 8
Shouldn't you remove the same macros from riscv and x86 config.h ?

~Michal




 


Rackspace

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