From: guoren@kernel.org To: tj@kernel.org, cl@linux.com, palmer@dabbelt.com, will@kernel.org, catalin.marinas@arm.com, peterz@infradead.org, arnd@arndb.de Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Guo Ren <guoren@linux.alibaba.com>, Guo Ren <guoren@kernel.org> Subject: [RFC PATCH 2/4] arm64: percpu: Use generic PERCPU_RW_OPS Date: Mon, 8 Aug 2022 04:05:58 -0400 [thread overview] Message-ID: <20220808080600.3346843-3-guoren@kernel.org> (raw) In-Reply-To: <20220808080600.3346843-1-guoren@kernel.org> From: Guo Ren <guoren@linux.alibaba.com> The generic percpu implementation also using READ_ONCE()/WRITE_ONCE(). And the generic even give a better __native_word() check. Signed-off-by: Guo Ren <guoren@linux.alibaba.com> Signed-off-by: Guo Ren <guoren@kernel.org> --- arch/arm64/include/asm/percpu.h | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/arch/arm64/include/asm/percpu.h b/arch/arm64/include/asm/percpu.h index b9ba19dbdb69..a58de20d742a 100644 --- a/arch/arm64/include/asm/percpu.h +++ b/arch/arm64/include/asm/percpu.h @@ -52,17 +52,6 @@ static inline unsigned long __kern_my_cpu_offset(void) #define __my_cpu_offset __kern_my_cpu_offset() #endif -#define PERCPU_RW_OPS(sz) \ -static inline unsigned long __percpu_read_##sz(void *ptr) \ -{ \ - return READ_ONCE(*(u##sz *)ptr); \ -} \ - \ -static inline void __percpu_write_##sz(void *ptr, unsigned long val) \ -{ \ - WRITE_ONCE(*(u##sz *)ptr, (u##sz)val); \ -} - #define __PERCPU_OP_CASE(w, sfx, name, sz, op_llsc, op_lse) \ static inline void \ __percpu_##name##_case_##sz(void *ptr, unsigned long val) \ @@ -120,10 +109,6 @@ __percpu_##name##_return_case_##sz(void *ptr, unsigned long val) \ __PERCPU_RET_OP_CASE(w, , name, 32, op_llsc, op_lse) \ __PERCPU_RET_OP_CASE( , , name, 64, op_llsc, op_lse) -PERCPU_RW_OPS(8) -PERCPU_RW_OPS(16) -PERCPU_RW_OPS(32) -PERCPU_RW_OPS(64) PERCPU_OP(add, add, stadd) PERCPU_OP(andnot, bic, stclr) PERCPU_OP(or, orr, stset) @@ -168,24 +153,6 @@ PERCPU_RET_OP(add, add, ldadd) __retval; \ }) -#define this_cpu_read_1(pcp) \ - _pcp_protect_return(__percpu_read_8, pcp) -#define this_cpu_read_2(pcp) \ - _pcp_protect_return(__percpu_read_16, pcp) -#define this_cpu_read_4(pcp) \ - _pcp_protect_return(__percpu_read_32, pcp) -#define this_cpu_read_8(pcp) \ - _pcp_protect_return(__percpu_read_64, pcp) - -#define this_cpu_write_1(pcp, val) \ - _pcp_protect(__percpu_write_8, pcp, (unsigned long)val) -#define this_cpu_write_2(pcp, val) \ - _pcp_protect(__percpu_write_16, pcp, (unsigned long)val) -#define this_cpu_write_4(pcp, val) \ - _pcp_protect(__percpu_write_32, pcp, (unsigned long)val) -#define this_cpu_write_8(pcp, val) \ - _pcp_protect(__percpu_write_64, pcp, (unsigned long)val) - #define this_cpu_add_1(pcp, val) \ _pcp_protect(__percpu_add_case_8, pcp, val) #define this_cpu_add_2(pcp, val) \ -- 2.36.1
WARNING: multiple messages have this Message-ID (diff)
From: guoren@kernel.org To: tj@kernel.org, cl@linux.com, palmer@dabbelt.com, will@kernel.org, catalin.marinas@arm.com, peterz@infradead.org, arnd@arndb.de Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Guo Ren <guoren@linux.alibaba.com>, Guo Ren <guoren@kernel.org> Subject: [RFC PATCH 2/4] arm64: percpu: Use generic PERCPU_RW_OPS Date: Mon, 8 Aug 2022 04:05:58 -0400 [thread overview] Message-ID: <20220808080600.3346843-3-guoren@kernel.org> (raw) In-Reply-To: <20220808080600.3346843-1-guoren@kernel.org> From: Guo Ren <guoren@linux.alibaba.com> The generic percpu implementation also using READ_ONCE()/WRITE_ONCE(). And the generic even give a better __native_word() check. Signed-off-by: Guo Ren <guoren@linux.alibaba.com> Signed-off-by: Guo Ren <guoren@kernel.org> --- arch/arm64/include/asm/percpu.h | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/arch/arm64/include/asm/percpu.h b/arch/arm64/include/asm/percpu.h index b9ba19dbdb69..a58de20d742a 100644 --- a/arch/arm64/include/asm/percpu.h +++ b/arch/arm64/include/asm/percpu.h @@ -52,17 +52,6 @@ static inline unsigned long __kern_my_cpu_offset(void) #define __my_cpu_offset __kern_my_cpu_offset() #endif -#define PERCPU_RW_OPS(sz) \ -static inline unsigned long __percpu_read_##sz(void *ptr) \ -{ \ - return READ_ONCE(*(u##sz *)ptr); \ -} \ - \ -static inline void __percpu_write_##sz(void *ptr, unsigned long val) \ -{ \ - WRITE_ONCE(*(u##sz *)ptr, (u##sz)val); \ -} - #define __PERCPU_OP_CASE(w, sfx, name, sz, op_llsc, op_lse) \ static inline void \ __percpu_##name##_case_##sz(void *ptr, unsigned long val) \ @@ -120,10 +109,6 @@ __percpu_##name##_return_case_##sz(void *ptr, unsigned long val) \ __PERCPU_RET_OP_CASE(w, , name, 32, op_llsc, op_lse) \ __PERCPU_RET_OP_CASE( , , name, 64, op_llsc, op_lse) -PERCPU_RW_OPS(8) -PERCPU_RW_OPS(16) -PERCPU_RW_OPS(32) -PERCPU_RW_OPS(64) PERCPU_OP(add, add, stadd) PERCPU_OP(andnot, bic, stclr) PERCPU_OP(or, orr, stset) @@ -168,24 +153,6 @@ PERCPU_RET_OP(add, add, ldadd) __retval; \ }) -#define this_cpu_read_1(pcp) \ - _pcp_protect_return(__percpu_read_8, pcp) -#define this_cpu_read_2(pcp) \ - _pcp_protect_return(__percpu_read_16, pcp) -#define this_cpu_read_4(pcp) \ - _pcp_protect_return(__percpu_read_32, pcp) -#define this_cpu_read_8(pcp) \ - _pcp_protect_return(__percpu_read_64, pcp) - -#define this_cpu_write_1(pcp, val) \ - _pcp_protect(__percpu_write_8, pcp, (unsigned long)val) -#define this_cpu_write_2(pcp, val) \ - _pcp_protect(__percpu_write_16, pcp, (unsigned long)val) -#define this_cpu_write_4(pcp, val) \ - _pcp_protect(__percpu_write_32, pcp, (unsigned long)val) -#define this_cpu_write_8(pcp, val) \ - _pcp_protect(__percpu_write_64, pcp, (unsigned long)val) - #define this_cpu_add_1(pcp, val) \ _pcp_protect(__percpu_add_case_8, pcp, val) #define this_cpu_add_2(pcp, val) \ -- 2.36.1 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2022-08-08 8:06 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-08-08 8:05 [RFC PATCH 0/4] riscv: Add basic percpu operations guoren 2022-08-08 8:05 ` guoren 2022-08-08 8:05 ` [RFC PATCH 1/4] vmstat: percpu: Rename HAVE_CMPXCHG_LOCAL to HAVE_CMPXCHG_PERCPU_BYTE guoren 2022-08-08 8:05 ` guoren 2022-08-08 9:31 ` Christoph Lameter 2022-08-08 9:31 ` Christoph Lameter 2022-08-09 2:58 ` Guo Ren 2022-08-09 2:58 ` Guo Ren 2022-08-08 8:05 ` guoren [this message] 2022-08-08 8:05 ` [RFC PATCH 2/4] arm64: percpu: Use generic PERCPU_RW_OPS guoren 2022-08-08 8:05 ` [RFC PATCH 3/4] riscv: percpu: Implement this_cpu operations guoren 2022-08-08 8:05 ` guoren 2022-08-08 8:06 ` [RFC PATCH 4/4] riscv: cmpxchg: Remove unused cmpxchg(64)_local guoren 2022-08-08 8:06 ` guoren
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=20220808080600.3346843-3-guoren@kernel.org \ --to=guoren@kernel.org \ --cc=arnd@arndb.de \ --cc=catalin.marinas@arm.com \ --cc=cl@linux.com \ --cc=guoren@linux.alibaba.com \ --cc=linux-arch@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-riscv@lists.infradead.org \ --cc=palmer@dabbelt.com \ --cc=peterz@infradead.org \ --cc=tj@kernel.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.