Re: [PATCH 2/7] xen/bitops: Implement ffs() in common logic

2024-03-14 Thread Jan Beulich
On 14.03.2024 17:23, Andrew Cooper wrote: > On 14/03/2024 2:16 pm, Jan Beulich wrote: >> On 13.03.2024 18:27, Andrew Cooper wrote: >>> --- a/xen/arch/arm/include/asm/bitops.h >>> +++ b/xen/arch/arm/include/asm/bitops.h >>> @@ -157,7 +157,7 @@ static inline int fls(unsigned int x) >>> } >>> >>>

Re: [PATCH 2/7] xen/bitops: Implement ffs() in common logic

2024-03-14 Thread Andrew Cooper
On 14/03/2024 2:16 pm, Jan Beulich wrote: > On 13.03.2024 18:27, Andrew Cooper wrote: >> --- a/xen/arch/arm/include/asm/bitops.h >> +++ b/xen/arch/arm/include/asm/bitops.h >> @@ -157,7 +157,7 @@ static inline int fls(unsigned int x) >> } >> >> >> -#define ffs(x) ({ unsigned int __t = (x); fls(

Re: [PATCH 2/7] xen/bitops: Implement ffs() in common logic

2024-03-14 Thread Jan Beulich
On 13.03.2024 18:27, Andrew Cooper wrote: > --- a/xen/arch/arm/include/asm/bitops.h > +++ b/xen/arch/arm/include/asm/bitops.h > @@ -157,7 +157,7 @@ static inline int fls(unsigned int x) > } > > > -#define ffs(x) ({ unsigned int __t = (x); fls(ISOLATE_LSB(__t)); }) > +#define arch_ffs(x) ({ uns

[PATCH 2/7] xen/bitops: Implement ffs() in common logic

2024-03-13 Thread Andrew Cooper
Allow the optimiser to elimiate the call completely, and use the compiler builtin by default. Architectures should only proide arch_ffs() if they think they can do better than the compiler. Confirm the expected behaviour with compile time and boot time tests. For x86, correct the prototype, and