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

From: Conor Dooley
Date: Sun Mar 19 2023 - 16:35:59 EST


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@xxxxxxxxxx/

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

Attachment: signature.asc
Description: PGP signature