From: Leonardo Bras <leobras@redhat.com> To: Will Deacon <will@kernel.org>, Peter Zijlstra <peterz@infradead.org>, Boqun Feng <boqun.feng@gmail.com>, Mark Rutland <mark.rutland@arm.com>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Leonardo Bras <leobras@redhat.com>, Andrzej Hajda <andrzej.hajda@intel.com>, Arnd Bergmann <arnd@arndb.de>, Ingo Molnar <mingo@kernel.org>, Palmer Dabbelt <palmer@rivosinc.com>, Guo Ren <guoren@kernel.org> Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [RFC PATCH v2 0/3] Deduplicate RISCV cmpxchg.h and atomic.c macros Date: Thu, 3 Aug 2023 02:13:57 -0300 [thread overview] Message-ID: <20230803051401.710236-2-leobras@redhat.com> (raw) I unified previous patchsets into a single one, since the work is related. 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. Also, did the same kind of work on atomic.c. Note to Guo Ren: I did some further improvement after your previous reviews, so I ended up afraid including your Reviewed-by before cheching if the changes are ok for you. Please check it out again, I just removed some helper macros that were not being used elsewhere in the kernel. Thanks! Leo Changes since squashed cmpxchg: - Unified with atomic.c patchset - Rebased on top of torvalds/master (thanks Andrea Parri!) - Removed helper macros that were not being used elsewhere in the kernel. Changes since (cmpxchg) RFCv3: - Squashed the 6 original patches in 2: one for cmpxchg and one for xchg https://lore.kernel.org/all/20230404163741.2762165-1-leobras@redhat.com/ Changes since (cmpxchg) RFCv2: - Fixed macros that depend on having a local variable with a magic name - Previous cast to (long) is now only applied on 4-bytes cmpxchg https://lore.kernel.org/all/20230321074249.2221674-1-leobras@redhat.com/ Changes since (cmpxchg) RFCv1: - Fixed patch 4/6 suffix from 'w.aqrl' to '.w.aqrl', to avoid build error https://lore.kernel.org/all/20230318080059.1109286-1-leobras@redhat.com/ Leonardo Bras (3): riscv/cmpxchg: Deduplicate xchg() asm functions riscv/cmpxchg: Deduplicate cmpxchg() asm and macros riscv/atomic.h : Deduplicate arch_atomic.* arch/riscv/include/asm/atomic.h | 164 ++++++++-------- arch/riscv/include/asm/cmpxchg.h | 318 +++++-------------------------- 2 files changed, 123 insertions(+), 359 deletions(-) -- 2.41.0 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Leonardo Bras <leobras@redhat.com> To: Will Deacon <will@kernel.org>, Peter Zijlstra <peterz@infradead.org>, Boqun Feng <boqun.feng@gmail.com>, Mark Rutland <mark.rutland@arm.com>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Leonardo Bras <leobras@redhat.com>, Andrzej Hajda <andrzej.hajda@intel.com>, Arnd Bergmann <arnd@arndb.de>, Ingo Molnar <mingo@kernel.org>, Palmer Dabbelt <palmer@rivosinc.com>, Guo Ren <guoren@kernel.org> Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [RFC PATCH v2 0/3] Deduplicate RISCV cmpxchg.h and atomic.c macros Date: Thu, 3 Aug 2023 02:13:57 -0300 [thread overview] Message-ID: <20230803051401.710236-2-leobras@redhat.com> (raw) I unified previous patchsets into a single one, since the work is related. 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. Also, did the same kind of work on atomic.c. Note to Guo Ren: I did some further improvement after your previous reviews, so I ended up afraid including your Reviewed-by before cheching if the changes are ok for you. Please check it out again, I just removed some helper macros that were not being used elsewhere in the kernel. Thanks! Leo Changes since squashed cmpxchg: - Unified with atomic.c patchset - Rebased on top of torvalds/master (thanks Andrea Parri!) - Removed helper macros that were not being used elsewhere in the kernel. Changes since (cmpxchg) RFCv3: - Squashed the 6 original patches in 2: one for cmpxchg and one for xchg https://lore.kernel.org/all/20230404163741.2762165-1-leobras@redhat.com/ Changes since (cmpxchg) RFCv2: - Fixed macros that depend on having a local variable with a magic name - Previous cast to (long) is now only applied on 4-bytes cmpxchg https://lore.kernel.org/all/20230321074249.2221674-1-leobras@redhat.com/ Changes since (cmpxchg) RFCv1: - Fixed patch 4/6 suffix from 'w.aqrl' to '.w.aqrl', to avoid build error https://lore.kernel.org/all/20230318080059.1109286-1-leobras@redhat.com/ Leonardo Bras (3): riscv/cmpxchg: Deduplicate xchg() asm functions riscv/cmpxchg: Deduplicate cmpxchg() asm and macros riscv/atomic.h : Deduplicate arch_atomic.* arch/riscv/include/asm/atomic.h | 164 ++++++++-------- arch/riscv/include/asm/cmpxchg.h | 318 +++++-------------------------- 2 files changed, 123 insertions(+), 359 deletions(-) -- 2.41.0
next reply other threads:[~2023-08-03 5:14 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-08-03 5:13 Leonardo Bras [this message] 2023-08-03 5:13 ` [RFC PATCH v2 0/3] Deduplicate RISCV cmpxchg.h and atomic.c macros Leonardo Bras 2023-08-03 5:13 ` [RFC PATCH v2 1/3] riscv/cmpxchg: Deduplicate xchg() asm functions Leonardo Bras 2023-08-03 5:13 ` Leonardo Bras 2023-08-03 5:13 ` [RFC PATCH v2 2/3] riscv/cmpxchg: Deduplicate cmpxchg() asm and macros Leonardo Bras 2023-08-03 5:13 ` Leonardo Bras 2023-08-03 5:14 ` [RFC PATCH v2 3/3] riscv/atomic.h : Deduplicate arch_atomic.* Leonardo Bras 2023-08-03 5:14 ` Leonardo Bras 2023-08-03 7:33 ` Guo Ren 2023-08-03 7:33 ` Guo Ren 2023-08-03 13:53 ` [RFC PATCH v2 0/3] Deduplicate RISCV cmpxchg.h and atomic.c macros Andrea Parri 2023-08-03 13:53 ` Andrea Parri 2023-08-04 2:20 ` Leonardo Bras Soares Passos 2023-08-04 2:20 ` Leonardo Bras Soares Passos 2023-08-04 0:53 ` Guo Ren 2023-08-04 0:53 ` Guo Ren 2023-08-04 2:19 ` Leonardo Bras Soares Passos 2023-08-04 2:19 ` Leonardo Bras Soares Passos 2023-08-04 2:29 ` Guo Ren 2023-08-04 2:29 ` Guo Ren 2023-08-04 8:05 ` Leonardo Bras Soares Passos 2023-08-04 8:05 ` Leonardo Bras Soares Passos 2023-08-04 8:55 ` Leonardo Bras Soares Passos 2023-08-04 8:55 ` Leonardo Bras Soares Passos
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230803051401.710236-2-leobras@redhat.com \ --to=leobras@redhat.com \ --cc=andrzej.hajda@intel.com \ --cc=aou@eecs.berkeley.edu \ --cc=arnd@arndb.de \ --cc=boqun.feng@gmail.com \ --cc=guoren@kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-riscv@lists.infradead.org \ --cc=mark.rutland@arm.com \ --cc=mingo@kernel.org \ --cc=palmer@dabbelt.com \ --cc=palmer@rivosinc.com \ --cc=paul.walmsley@sifive.com \ --cc=peterz@infradead.org \ --cc=will@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.