* [PATCH 0/4] xen/bitops: ADDR removal
@ 2026-09-02 11:43 Andrew Cooper
2026-09-02 11:43 ` [PATCH 1/4] arm/bitops: Drop unused ADDR macros Andrew Cooper
` (3 more replies)
0 siblings, 4 replies; 14+ messages in thread
From: Andrew Cooper @ 2026-09-02 11:43 UTC (permalink / raw)
To: xen-devel
Cc: Andrew Cooper, Jan Beulich, Roger Pau Monné, Teddy Astie,
Stefano Stabellini, Julien Grall, Bertrand Marquis, Michal Orzel,
Volodymyr Babchuk
Andrew Cooper (3):
arm/bitops: Drop unused ADDR macros
x86/bitops: Remove CONST_ADDR
x86/bitops: Remove ADDR
Jan Beulich (1):
x86/bitops: don't cast away volatile-ness
docs/misra/rules.rst | 3 +-
xen/arch/arm/include/asm/bitops.h | 3 --
xen/arch/x86/include/asm/bitops.h | 51 ++++++++++++++++++-------------
3 files changed, 32 insertions(+), 25 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/4] arm/bitops: Drop unused ADDR macros
2026-09-02 11:43 [PATCH 0/4] xen/bitops: ADDR removal Andrew Cooper
@ 2026-09-02 11:43 ` Andrew Cooper
2026-09-02 11:51 ` Orzel, Michal
2026-09-02 12:09 ` Teddy Astie
2026-09-02 11:43 ` [PATCH 2/4] x86/bitops: Remove CONST_ADDR Andrew Cooper
` (2 subsequent siblings)
3 siblings, 2 replies; 14+ messages in thread
From: Andrew Cooper @ 2026-09-02 11:43 UTC (permalink / raw)
To: xen-devel
Cc: Andrew Cooper, Jan Beulich, Roger Pau Monné, Teddy Astie,
Stefano Stabellini, Julien Grall, Bertrand Marquis, Michal Orzel,
Volodymyr Babchuk
These are unused and do not want new users to appear.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <jbeulich@suse.com>
CC: Roger Pau Monné <roger@xenproject.org>
CC: Teddy Astie <teddy.astie@vates.tech>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien@xen.org>
CC: Bertrand Marquis <bertrand.marquis@arm.com>
CC: Michal Orzel <michal.orzel@amd.com>
CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
---
xen/arch/arm/include/asm/bitops.h | 3 ---
1 file changed, 3 deletions(-)
diff --git a/xen/arch/arm/include/asm/bitops.h b/xen/arch/arm/include/asm/bitops.h
index 60686a3a5503..52131892b1f1 100644
--- a/xen/arch/arm/include/asm/bitops.h
+++ b/xen/arch/arm/include/asm/bitops.h
@@ -22,9 +22,6 @@
#define __set_bit(n,p) set_bit(n,p)
#define __clear_bit(n,p) clear_bit(n,p)
-#define ADDR (*(volatile int *) addr)
-#define CONST_ADDR (*(const volatile int *) addr)
-
#if defined(CONFIG_ARM_32)
# include <asm/arm32/bitops.h>
#elif defined(CONFIG_ARM_64)
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/4] x86/bitops: Remove CONST_ADDR
2026-09-02 11:43 [PATCH 0/4] xen/bitops: ADDR removal Andrew Cooper
2026-09-02 11:43 ` [PATCH 1/4] arm/bitops: Drop unused ADDR macros Andrew Cooper
@ 2026-09-02 11:43 ` Andrew Cooper
2026-09-02 12:10 ` Teddy Astie
2026-09-02 12:43 ` Jan Beulich
2026-09-02 11:43 ` [PATCH 3/4] x86/bitops: Remove ADDR Andrew Cooper
2026-09-02 11:43 ` [PATCH 4/4] x86/bitops: don't cast away volatile-ness Andrew Cooper
3 siblings, 2 replies; 14+ messages in thread
From: Andrew Cooper @ 2026-09-02 11:43 UTC (permalink / raw)
To: xen-devel
Cc: Andrew Cooper, Jan Beulich, Roger Pau Monné, Teddy Astie,
Stefano Stabellini, Julien Grall, Bertrand Marquis, Michal Orzel,
Volodymyr Babchuk
All this does is obfuscate the usage sites.
No functional change.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <jbeulich@suse.com>
CC: Roger Pau Monné <roger@xenproject.org>
CC: Teddy Astie <teddy.astie@vates.tech>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien@xen.org>
CC: Bertrand Marquis <bertrand.marquis@arm.com>
CC: Michal Orzel <michal.orzel@amd.com>
CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
---
xen/arch/x86/include/asm/bitops.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/bitops.h
index 69ffed510c0a..fbcab32fd239 100644
--- a/xen/arch/x86/include/asm/bitops.h
+++ b/xen/arch/x86/include/asm/bitops.h
@@ -18,7 +18,6 @@
*/
#define ADDR (*(volatile int *) addr)
-#define CONST_ADDR (*(const volatile int *) addr)
/**
* set_bit - Atomically set a bit in memory
@@ -285,7 +284,9 @@ static inline int variable_test_bit(int nr, const volatile void *addr)
asm volatile ( "btl %[nr], %[addr]\n\t"
ASM_FLAG_OUT(, "sbbl %[old], %[old]\n\t")
: [old] ASM_FLAG_OUT("=@ccc", "=r") (oldbit)
- : [addr] "m" (CONST_ADDR), [nr] "Ir" (nr) : "memory" );
+ : [addr] "m" (*(const volatile int *)addr),
+ [nr] "Ir" (nr)
+ : "memory" );
return oldbit;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/4] x86/bitops: Remove ADDR
2026-09-02 11:43 [PATCH 0/4] xen/bitops: ADDR removal Andrew Cooper
2026-09-02 11:43 ` [PATCH 1/4] arm/bitops: Drop unused ADDR macros Andrew Cooper
2026-09-02 11:43 ` [PATCH 2/4] x86/bitops: Remove CONST_ADDR Andrew Cooper
@ 2026-09-02 11:43 ` Andrew Cooper
2026-09-02 12:12 ` Teddy Astie
2026-09-02 12:50 ` Jan Beulich
2026-09-02 11:43 ` [PATCH 4/4] x86/bitops: don't cast away volatile-ness Andrew Cooper
3 siblings, 2 replies; 14+ messages in thread
From: Andrew Cooper @ 2026-09-02 11:43 UTC (permalink / raw)
To: xen-devel
Cc: Andrew Cooper, Jan Beulich, Roger Pau Monné, Teddy Astie,
Stefano Stabellini, Julien Grall, Bertrand Marquis, Michal Orzel,
Volodymyr Babchuk
All this does is obfuscate the usage sites.
No functional change.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <jbeulich@suse.com>
CC: Roger Pau Monné <roger@xenproject.org>
CC: Teddy Astie <teddy.astie@vates.tech>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien@xen.org>
CC: Bertrand Marquis <bertrand.marquis@arm.com>
CC: Michal Orzel <michal.orzel@amd.com>
CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
---
docs/misra/rules.rst | 3 ++-
xen/arch/x86/include/asm/bitops.h | 34 ++++++++++++++++---------------
2 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index b3e929307d51..d6be4b0c5d43 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -212,7 +212,8 @@ maintainers if you want to suggest a change.
static inline void set_bit(int nr, volatile void *addr)
{
asm volatile ( "lock btsl %1,%0"
- : "+m" (ADDR) : "Ir" (nr) : "memory");
+ : "+m" (*(volatile int *)addr)
+ : "Ir" (nr) : "memory" );
}
#define set_bit(nr, addr) ({ \
if ( bitop_bad_size(addr) ) __bitop_bad_size(); \
diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/bitops.h
index fbcab32fd239..45fc64474344 100644
--- a/xen/arch/x86/include/asm/bitops.h
+++ b/xen/arch/x86/include/asm/bitops.h
@@ -9,16 +9,6 @@
#include <asm/asm_defns.h>
#include <asm/cpufeatureset.h>
-/*
- * We specify the memory operand as both input and output because the memory
- * operand is both read from and written to. Since the operand is in fact a
- * word array, we also specify "memory" in the clobbers list to indicate that
- * words other than the one directly addressed by the memory operand may be
- * modified.
- */
-
-#define ADDR (*(volatile int *) addr)
-
/**
* set_bit - Atomically set a bit in memory
* @nr: the bit to set
@@ -32,7 +22,9 @@
static inline void set_bit(int nr, volatile void *addr)
{
asm volatile ( "lock btsl %1,%0"
- : "+m" (ADDR) : "Ir" (nr) : "memory");
+ : "+m" (*(volatile int *)addr)
+ : "Ir" (nr)
+ : "memory" );
}
#define set_bit(nr, addr) ({ \
if ( bitop_bad_size(addr) ) __bitop_bad_size(); \
@@ -73,7 +65,9 @@ static inline void constant_set_bit(int nr, void *addr)
static inline void clear_bit(int nr, volatile void *addr)
{
asm volatile ( "lock btrl %1,%0"
- : "+m" (ADDR) : "Ir" (nr) : "memory");
+ : "+m" (*(volatile int *)addr)
+ : "Ir" (nr)
+ : "memory" );
}
#define clear_bit(nr, addr) ({ \
if ( bitop_bad_size(addr) ) __bitop_bad_size(); \
@@ -140,7 +134,9 @@ static inline void constant_change_bit(int nr, void *addr)
static inline void change_bit(int nr, volatile void *addr)
{
asm volatile ( "lock btcl %1,%0"
- : "+m" (ADDR) : "Ir" (nr) : "memory");
+ : "+m" (*(volatile int *)addr)
+ : "Ir" (nr)
+ : "memory" );
}
#define change_bit(nr, addr) ({ \
if ( bitop_bad_size(addr) ) __bitop_bad_size(); \
@@ -162,7 +158,9 @@ static inline int test_and_set_bit(int nr, volatile void *addr)
asm volatile ( "lock btsl %[nr], %[addr]\n\t"
ASM_FLAG_OUT(, "sbbl %[old], %[old]\n\t")
: [old] ASM_FLAG_OUT("=@ccc", "=r") (oldbit),
- [addr] "+m" (ADDR) : [nr] "Ir" (nr) : "memory" );
+ [addr] "+m" (*(volatile int *)addr)
+ : [nr] "Ir" (nr)
+ : "memory" );
return oldbit;
}
@@ -208,7 +206,9 @@ static inline int test_and_clear_bit(int nr, volatile void *addr)
asm volatile ( "lock btrl %[nr], %[addr]\n\t"
ASM_FLAG_OUT(, "sbbl %[old], %[old]\n\t")
: [old] ASM_FLAG_OUT("=@ccc", "=r") (oldbit),
- [addr] "+m" (ADDR) : [nr] "Ir" (nr) : "memory" );
+ [addr] "+m" (*(volatile int *)addr)
+ : [nr] "Ir" (nr)
+ : "memory" );
return oldbit;
}
@@ -268,7 +268,9 @@ static inline int test_and_change_bit(int nr, volatile void *addr)
asm volatile ( "lock btcl %[nr], %[addr]\n\t"
ASM_FLAG_OUT(, "sbbl %[old], %[old]\n\t")
: [old] ASM_FLAG_OUT("=@ccc", "=r") (oldbit),
- [addr] "+m" (ADDR) : [nr] "Ir" (nr) : "memory" );
+ [addr] "+m" (*(volatile int *)addr)
+ : [nr] "Ir" (nr)
+ : "memory" );
return oldbit;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/4] x86/bitops: don't cast away volatile-ness
2026-09-02 11:43 [PATCH 0/4] xen/bitops: ADDR removal Andrew Cooper
` (2 preceding siblings ...)
2026-09-02 11:43 ` [PATCH 3/4] x86/bitops: Remove ADDR Andrew Cooper
@ 2026-09-02 11:43 ` Andrew Cooper
2026-09-02 12:13 ` Teddy Astie
3 siblings, 1 reply; 14+ messages in thread
From: Andrew Cooper @ 2026-09-02 11:43 UTC (permalink / raw)
To: xen-devel
Cc: Jan Beulich, Andrew Cooper, Roger Pau Monné, Teddy Astie,
Stefano Stabellini, Julien Grall, Bertrand Marquis, Michal Orzel,
Volodymyr Babchuk
From: Jan Beulich <jbeulich@suse.com>
Doing so, besides being a bad idea in general, violates Misra rule 11.8.
Use the helper macro we have available anyway.
No functional change intended.
Fixes: f1879b2c2584 ("xen: introduce generic non-atomic test_*bit()")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <jbeulich@suse.com>
CC: Roger Pau Monné <roger@xenproject.org>
CC: Teddy Astie <teddy.astie@vates.tech>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien@xen.org>
CC: Bertrand Marquis <bertrand.marquis@arm.com>
CC: Michal Orzel <michal.orzel@amd.com>
CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Rebase over removal of ADDR.
---
xen/arch/x86/include/asm/bitops.h | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/bitops.h
index 45fc64474344..8f6bea388035 100644
--- a/xen/arch/x86/include/asm/bitops.h
+++ b/xen/arch/x86/include/asm/bitops.h
@@ -185,7 +185,9 @@ static inline int arch__test_and_set_bit(int nr, volatile void *addr)
asm volatile ( "btsl %[nr], %[addr]\n\t"
ASM_FLAG_OUT(, "sbbl %[old], %[old]\n\t")
: [old] ASM_FLAG_OUT("=@ccc", "=r") (oldbit),
- [addr] "+m" (*(int *)addr) : [nr] "Ir" (nr) : "memory" );
+ [addr] "+m" (*(volatile int *)addr)
+ : [nr] "Ir" (nr)
+ : "memory" );
return oldbit;
}
@@ -233,7 +235,9 @@ static inline int arch__test_and_clear_bit(int nr, volatile void *addr)
asm volatile ( "btrl %[nr], %[addr]\n\t"
ASM_FLAG_OUT(, "sbbl %[old], %[old]\n\t")
: [old] ASM_FLAG_OUT("=@ccc", "=r") (oldbit),
- [addr] "+m" (*(int *)addr) : [nr] "Ir" (nr) : "memory" );
+ [addr] "+m" (*(volatile int *)addr)
+ : [nr] "Ir" (nr)
+ : "memory" );
return oldbit;
}
@@ -247,7 +251,9 @@ static inline int arch__test_and_change_bit(int nr, volatile void *addr)
asm volatile ( "btcl %[nr], %[addr]\n\t"
ASM_FLAG_OUT(, "sbbl %[old], %[old]\n\t")
: [old] ASM_FLAG_OUT("=@ccc", "=r") (oldbit),
- [addr] "+m" (*(int *)addr) : [nr] "Ir" (nr) : "memory" );
+ [addr] "+m" (*(volatile int *)addr)
+ : [nr] "Ir" (nr)
+ : "memory" );
return oldbit;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 1/4] arm/bitops: Drop unused ADDR macros
2026-09-02 11:43 ` [PATCH 1/4] arm/bitops: Drop unused ADDR macros Andrew Cooper
@ 2026-09-02 11:51 ` Orzel, Michal
2026-09-02 12:09 ` Teddy Astie
1 sibling, 0 replies; 14+ messages in thread
From: Orzel, Michal @ 2026-09-02 11:51 UTC (permalink / raw)
To: Andrew Cooper, xen-devel
Cc: Jan Beulich, Roger Pau Monné, Teddy Astie,
Stefano Stabellini, Julien Grall, Bertrand Marquis,
Volodymyr Babchuk
On 02-Sep-26 13:43, Andrew Cooper wrote:
> These are unused and do not want new users to appear.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
~Michal
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/4] arm/bitops: Drop unused ADDR macros
2026-09-02 11:43 ` [PATCH 1/4] arm/bitops: Drop unused ADDR macros Andrew Cooper
2026-09-02 11:51 ` Orzel, Michal
@ 2026-09-02 12:09 ` Teddy Astie
1 sibling, 0 replies; 14+ messages in thread
From: Teddy Astie @ 2026-09-02 12:09 UTC (permalink / raw)
To: Andrew Cooper, xen-devel
Cc: Jan Beulich, Roger Pau Monné, Stefano Stabellini,
Julien Grall, Bertrand Marquis, Michal Orzel, Volodymyr Babchuk
[-- Attachment #1.1: Type: text/plain, Size: 1243 bytes --]
Le 02/09/2026 à 13:43, Andrew Cooper a écrit :
> These are unused and do not want new users to appear.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Jan Beulich <jbeulich@suse.com>
> CC: Roger Pau Monné <roger@xenproject.org>
> CC: Teddy Astie <teddy.astie@vates.tech>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Julien Grall <julien@xen.org>
> CC: Bertrand Marquis <bertrand.marquis@arm.com>
> CC: Michal Orzel <michal.orzel@amd.com>
> CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
> ---
> xen/arch/arm/include/asm/bitops.h | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/xen/arch/arm/include/asm/bitops.h b/xen/arch/arm/include/asm/bitops.h
> index 60686a3a5503..52131892b1f1 100644
> --- a/xen/arch/arm/include/asm/bitops.h
> +++ b/xen/arch/arm/include/asm/bitops.h
> @@ -22,9 +22,6 @@
> #define __set_bit(n,p) set_bit(n,p)
> #define __clear_bit(n,p) clear_bit(n,p)
>
> -#define ADDR (*(volatile int *) addr)
> -#define CONST_ADDR (*(const volatile int *) addr)
> -
> #if defined(CONFIG_ARM_32)
> # include <asm/arm32/bitops.h>
> #elif defined(CONFIG_ARM_64)
Reviewed-by: Teddy Astie <teddy.astie@vates.tech>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 665 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/4] x86/bitops: Remove CONST_ADDR
2026-09-02 11:43 ` [PATCH 2/4] x86/bitops: Remove CONST_ADDR Andrew Cooper
@ 2026-09-02 12:10 ` Teddy Astie
2026-09-02 12:43 ` Jan Beulich
1 sibling, 0 replies; 14+ messages in thread
From: Teddy Astie @ 2026-09-02 12:10 UTC (permalink / raw)
To: Andrew Cooper, xen-devel
Cc: Jan Beulich, Roger Pau Monné, Stefano Stabellini,
Julien Grall, Bertrand Marquis, Michal Orzel, Volodymyr Babchuk
[-- Attachment #1.1: Type: text/plain, Size: 1652 bytes --]
Le 02/09/2026 à 13:43, Andrew Cooper a écrit :
> All this does is obfuscate the usage sites.
>
> No functional change.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Jan Beulich <jbeulich@suse.com>
> CC: Roger Pau Monné <roger@xenproject.org>
> CC: Teddy Astie <teddy.astie@vates.tech>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Julien Grall <julien@xen.org>
> CC: Bertrand Marquis <bertrand.marquis@arm.com>
> CC: Michal Orzel <michal.orzel@amd.com>
> CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
> ---
> xen/arch/x86/include/asm/bitops.h | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/bitops.h
> index 69ffed510c0a..fbcab32fd239 100644
> --- a/xen/arch/x86/include/asm/bitops.h
> +++ b/xen/arch/x86/include/asm/bitops.h
> @@ -18,7 +18,6 @@
> */
>
> #define ADDR (*(volatile int *) addr)
> -#define CONST_ADDR (*(const volatile int *) addr)
>
> /**
> * set_bit - Atomically set a bit in memory
> @@ -285,7 +284,9 @@ static inline int variable_test_bit(int nr, const volatile void *addr)
> asm volatile ( "btl %[nr], %[addr]\n\t"
> ASM_FLAG_OUT(, "sbbl %[old], %[old]\n\t")
> : [old] ASM_FLAG_OUT("=@ccc", "=r") (oldbit)
> - : [addr] "m" (CONST_ADDR), [nr] "Ir" (nr) : "memory" );
> + : [addr] "m" (*(const volatile int *)addr),
> + [nr] "Ir" (nr)
> + : "memory" );
>
> return oldbit;
> }
Reviewed-by: Teddy Astie <teddy.astie@vates.tech>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 665 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/4] x86/bitops: Remove ADDR
2026-09-02 11:43 ` [PATCH 3/4] x86/bitops: Remove ADDR Andrew Cooper
@ 2026-09-02 12:12 ` Teddy Astie
2026-09-02 12:50 ` Jan Beulich
1 sibling, 0 replies; 14+ messages in thread
From: Teddy Astie @ 2026-09-02 12:12 UTC (permalink / raw)
To: Andrew Cooper, xen-devel
Cc: Jan Beulich, Roger Pau Monné, Stefano Stabellini,
Julien Grall, Bertrand Marquis, Michal Orzel, Volodymyr Babchuk
[-- Attachment #1.1: Type: text/plain, Size: 817 bytes --]
Le 02/09/2026 à 13:43, Andrew Cooper a écrit :
> All this does is obfuscate the usage sites.
>
> No functional change.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Jan Beulich <jbeulich@suse.com>
> CC: Roger Pau Monné <roger@xenproject.org>
> CC: Teddy Astie <teddy.astie@vates.tech>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Julien Grall <julien@xen.org>
> CC: Bertrand Marquis <bertrand.marquis@arm.com>
> CC: Michal Orzel <michal.orzel@amd.com>
> CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
> ---
> docs/misra/rules.rst | 3 ++-
> xen/arch/x86/include/asm/bitops.h | 34 ++++++++++++++++---------------
> 2 files changed, 20 insertions(+), 17 deletions(-)
>
(...)
Reviewed-by: Teddy Astie <teddy.astie@vates.tech>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 665 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 4/4] x86/bitops: don't cast away volatile-ness
2026-09-02 11:43 ` [PATCH 4/4] x86/bitops: don't cast away volatile-ness Andrew Cooper
@ 2026-09-02 12:13 ` Teddy Astie
0 siblings, 0 replies; 14+ messages in thread
From: Teddy Astie @ 2026-09-02 12:13 UTC (permalink / raw)
To: Andrew Cooper, xen-devel
Cc: Jan Beulich, Roger Pau Monné, Stefano Stabellini,
Julien Grall, Bertrand Marquis, Michal Orzel, Volodymyr Babchuk
[-- Attachment #1.1: Type: text/plain, Size: 923 bytes --]
Le 02/09/2026 à 13:43, Andrew Cooper a écrit :
> From: Jan Beulich <jbeulich@suse.com>
>
> Doing so, besides being a bad idea in general, violates Misra rule 11.8.
> Use the helper macro we have available anyway.
>
> No functional change intended.
>
> Fixes: f1879b2c2584 ("xen: introduce generic non-atomic test_*bit()")
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Jan Beulich <jbeulich@suse.com>
> CC: Roger Pau Monné <roger@xenproject.org>
> CC: Teddy Astie <teddy.astie@vates.tech>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Julien Grall <julien@xen.org>
> CC: Bertrand Marquis <bertrand.marquis@arm.com>
> CC: Michal Orzel <michal.orzel@amd.com>
> CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
>
> Rebase over removal of ADDR.
> ---
(...)
Reviewed-by: Teddy Astie <teddy.astie@vates.tech>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 665 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/4] x86/bitops: Remove CONST_ADDR
2026-09-02 11:43 ` [PATCH 2/4] x86/bitops: Remove CONST_ADDR Andrew Cooper
2026-09-02 12:10 ` Teddy Astie
@ 2026-09-02 12:43 ` Jan Beulich
2026-09-02 12:55 ` Andrew Cooper
1 sibling, 1 reply; 14+ messages in thread
From: Jan Beulich @ 2026-09-02 12:43 UTC (permalink / raw)
To: Andrew Cooper
Cc: Roger Pau Monné, Teddy Astie, Stefano Stabellini,
Julien Grall, Bertrand Marquis, Michal Orzel, Volodymyr Babchuk,
xen-devel
On 02.09.2026 13:43, Andrew Cooper wrote:
> @@ -285,7 +284,9 @@ static inline int variable_test_bit(int nr, const volatile void *addr)
> asm volatile ( "btl %[nr], %[addr]\n\t"
> ASM_FLAG_OUT(, "sbbl %[old], %[old]\n\t")
> : [old] ASM_FLAG_OUT("=@ccc", "=r") (oldbit)
> - : [addr] "m" (CONST_ADDR), [nr] "Ir" (nr) : "memory" );
> + : [addr] "m" (*(const volatile int *)addr),
> + [nr] "Ir" (nr)
> + : "memory" );
Hard tabs look to have slipped in here and in patch 3.
Jan
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/4] x86/bitops: Remove ADDR
2026-09-02 11:43 ` [PATCH 3/4] x86/bitops: Remove ADDR Andrew Cooper
2026-09-02 12:12 ` Teddy Astie
@ 2026-09-02 12:50 ` Jan Beulich
2026-09-02 20:40 ` Andrew Cooper
1 sibling, 1 reply; 14+ messages in thread
From: Jan Beulich @ 2026-09-02 12:50 UTC (permalink / raw)
To: Andrew Cooper
Cc: Roger Pau Monné, Teddy Astie, Stefano Stabellini,
Julien Grall, Bertrand Marquis, Michal Orzel, Volodymyr Babchuk,
xen-devel
On 02.09.2026 13:43, Andrew Cooper wrote:
> All this does is obfuscate the usage sites.
I don't mind these changes, yet I'd like to express that as so often there
are multiple ways of looking at things. The benefit of the macros was that
the use sites were textually shorter, and hence easier to process (assuming
you know what ADDR stands for).
> --- a/xen/arch/x86/include/asm/bitops.h
> +++ b/xen/arch/x86/include/asm/bitops.h
> @@ -9,16 +9,6 @@
> #include <asm/asm_defns.h>
> #include <asm/cpufeatureset.h>
>
> -/*
> - * We specify the memory operand as both input and output because the memory
> - * operand is both read from and written to. Since the operand is in fact a
> - * word array, we also specify "memory" in the clobbers list to indicate that
> - * words other than the one directly addressed by the memory operand may be
> - * modified.
> - */
Might we not better keep this justification for the seemingly odd memory
clobbers? (The first sentence, otoh, I agree can be dropped.)
Jan
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/4] x86/bitops: Remove CONST_ADDR
2026-09-02 12:43 ` Jan Beulich
@ 2026-09-02 12:55 ` Andrew Cooper
0 siblings, 0 replies; 14+ messages in thread
From: Andrew Cooper @ 2026-09-02 12:55 UTC (permalink / raw)
To: Jan Beulich
Cc: Andrew Cooper, Roger Pau Monné, Teddy Astie,
Stefano Stabellini, Julien Grall, Bertrand Marquis, Michal Orzel,
Volodymyr Babchuk, xen-devel
On 02/09/2026 1:43 pm, Jan Beulich wrote:
> On 02.09.2026 13:43, Andrew Cooper wrote:
>> @@ -285,7 +284,9 @@ static inline int variable_test_bit(int nr, const volatile void *addr)
>> asm volatile ( "btl %[nr], %[addr]\n\t"
>> ASM_FLAG_OUT(, "sbbl %[old], %[old]\n\t")
>> : [old] ASM_FLAG_OUT("=@ccc", "=r") (oldbit)
>> - : [addr] "m" (CONST_ADDR), [nr] "Ir" (nr) : "memory" );
>> + : [addr] "m" (*(const volatile int *)addr),
>> + [nr] "Ir" (nr)
>> + : "memory" );
> Hard tabs look to have slipped in here and in patch 3.
Yes, sorry. I only noticed after emailing out, and fixed up locally.
~Andrew
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/4] x86/bitops: Remove ADDR
2026-09-02 12:50 ` Jan Beulich
@ 2026-09-02 20:40 ` Andrew Cooper
0 siblings, 0 replies; 14+ messages in thread
From: Andrew Cooper @ 2026-09-02 20:40 UTC (permalink / raw)
To: Jan Beulich
Cc: Andrew Cooper, Roger Pau Monné, Teddy Astie,
Stefano Stabellini, Julien Grall, Bertrand Marquis, Michal Orzel,
Volodymyr Babchuk, xen-devel
On 02/09/2026 1:50 pm, Jan Beulich wrote:
> On 02.09.2026 13:43, Andrew Cooper wrote:
>> All this does is obfuscate the usage sites.
> I don't mind these changes, yet I'd like to express that as so often there
> are multiple ways of looking at things. The benefit of the macros was that
> the use sites were textually shorter, and hence easier to process (assuming
> you know what ADDR stands for).
"assuming" is the whole problem, and what makes this obfuscation. If it
were a pattern we used everywhere, it would be fine, but it's unique to
this header.
It hides the width and volatility of the access, which variable is being
referenced, and the indirection.
The only thing it has going for it is that it is recognisable as
"probably a macro", but you're still forced to look elsewhere to
identify how it works.
>
>> --- a/xen/arch/x86/include/asm/bitops.h
>> +++ b/xen/arch/x86/include/asm/bitops.h
>> @@ -9,16 +9,6 @@
>> #include <asm/asm_defns.h>
>> #include <asm/cpufeatureset.h>
>>
>> -/*
>> - * We specify the memory operand as both input and output because the memory
>> - * operand is both read from and written to. Since the operand is in fact a
>> - * word array, we also specify "memory" in the clobbers list to indicate that
>> - * words other than the one directly addressed by the memory operand may be
>> - * modified.
>> - */
> Might we not better keep this justification for the seemingly odd memory
> clobbers? (The first sentence, otoh, I agree can be dropped.)
I don't think it's useful to keep, but fine...
~Andrew
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2026-09-02 20:40 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-02 11:43 [PATCH 0/4] xen/bitops: ADDR removal Andrew Cooper
2026-09-02 11:43 ` [PATCH 1/4] arm/bitops: Drop unused ADDR macros Andrew Cooper
2026-09-02 11:51 ` Orzel, Michal
2026-09-02 12:09 ` Teddy Astie
2026-09-02 11:43 ` [PATCH 2/4] x86/bitops: Remove CONST_ADDR Andrew Cooper
2026-09-02 12:10 ` Teddy Astie
2026-09-02 12:43 ` Jan Beulich
2026-09-02 12:55 ` Andrew Cooper
2026-09-02 11:43 ` [PATCH 3/4] x86/bitops: Remove ADDR Andrew Cooper
2026-09-02 12:12 ` Teddy Astie
2026-09-02 12:50 ` Jan Beulich
2026-09-02 20:40 ` Andrew Cooper
2026-09-02 11:43 ` [PATCH 4/4] x86/bitops: don't cast away volatile-ness Andrew Cooper
2026-09-02 12:13 ` Teddy Astie
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.