[RFC PATCH 0/6] Deduplicating RISCV cmpxchg.h macros

Conor Dooley conor at kernel.org
Sun Mar 19 13:35:47 PDT 2023


On Sat, Mar 18, 2023 at 05:00:54AM -0300, Leonardo Bras wrote:
> While studying riscv's cmpxchg.h file, I got really interested in 
> understanding how RISCV asm implemented the different versions of 
> {cmp,}xchg.
> 
> When I understood the pattern, it made sense for me to remove the 
> duplications and create macros to make it easier to understand what exactly 
> changes between the versions: Instruction sufixes & barriers.
> 
> I split those changes in 3 levels for each cmpxchg and xchg, resulting a 
> total of 6 patches. I did this so it becomes easier to review and remove 
> the last levels if desired, but I have no issue squashing them if it's 
> better.
> 
> Please provide comments.
> 
> Thanks!
> Leo
> 
> Leonardo Bras (6):
>   riscv/cmpxchg: Deduplicate cmpxchg() asm functions
>   riscv/cmpxchg: Deduplicate cmpxchg() macros
>   riscv/cmpxchg: Deduplicate arch_cmpxchg() macros

>   riscv/cmpxchg: Deduplicate xchg() asm functions

FWIW, this patch seems to break the build pretty badly:
https://patchwork.kernel.org/project/linux-riscv/patch/20230318080059.1109286-5-leobras@redhat.com/

Patches 1 & 5 also add quite a lot of sparse issues (like 1000), but I
think that may be more of an artifact of the testing process as opposed
to something caused by this patchset.

Cheers,
Conor.

>   riscv/cmpxchg: Deduplicate xchg() macros
>   riscv/cmpxchg: Deduplicate arch_xchg() macros
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20230319/d2548071/attachment.sig>


More information about the linux-riscv mailing list