* [PATCH] ARC: remove redundant READ_ONCE() in cmpxchg loop
@ 2022-03-19 2:03 ` Bang Li
0 siblings, 0 replies; 4+ messages in thread
From: Bang Li @ 2022-03-19 2:03 UTC (permalink / raw)
To: vgupta
Cc: peterz, mingo, valentin.schneider, linux-snps-arc, linux-kernel, Bang Li
This patch reverts commit 7082a29c22ac ("ARC: use ACCESS_ONCE in cmpxchg
loop").
It is not necessary to use READ_ONCE() because cmpxchg contains barrier. We
can get it from commit d57f727264f1 ("ARC: add compiler barrier to LLSC
based cmpxchg").
Signed-off-by: Bang Li <libang.linuxer@gmail.com>
---
arch/arc/kernel/smp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arc/kernel/smp.c b/arch/arc/kernel/smp.c
index 78e6d069b1c1..56c23f3e1309 100644
--- a/arch/arc/kernel/smp.c
+++ b/arch/arc/kernel/smp.c
@@ -274,7 +274,7 @@ static void ipi_send_msg_one(int cpu, enum ipi_msg_type msg)
* and read back old value
*/
do {
- new = old = READ_ONCE(*ipi_data_ptr);
+ new = old = *ipi_data_ptr;
new |= 1U << msg;
} while (cmpxchg(ipi_data_ptr, old, new) != old);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] ARC: remove redundant READ_ONCE() in cmpxchg loop
@ 2022-03-19 2:03 ` Bang Li
0 siblings, 0 replies; 4+ messages in thread
From: Bang Li @ 2022-03-19 2:03 UTC (permalink / raw)
To: vgupta
Cc: peterz, mingo, valentin.schneider, linux-snps-arc, linux-kernel, Bang Li
This patch reverts commit 7082a29c22ac ("ARC: use ACCESS_ONCE in cmpxchg
loop").
It is not necessary to use READ_ONCE() because cmpxchg contains barrier. We
can get it from commit d57f727264f1 ("ARC: add compiler barrier to LLSC
based cmpxchg").
Signed-off-by: Bang Li <libang.linuxer@gmail.com>
---
arch/arc/kernel/smp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arc/kernel/smp.c b/arch/arc/kernel/smp.c
index 78e6d069b1c1..56c23f3e1309 100644
--- a/arch/arc/kernel/smp.c
+++ b/arch/arc/kernel/smp.c
@@ -274,7 +274,7 @@ static void ipi_send_msg_one(int cpu, enum ipi_msg_type msg)
* and read back old value
*/
do {
- new = old = READ_ONCE(*ipi_data_ptr);
+ new = old = *ipi_data_ptr;
new |= 1U << msg;
} while (cmpxchg(ipi_data_ptr, old, new) != old);
--
2.25.1
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ARC: remove redundant READ_ONCE() in cmpxchg loop
2022-03-19 2:03 ` Bang Li
@ 2022-04-18 19:19 ` Vineet Gupta
-1 siblings, 0 replies; 4+ messages in thread
From: Vineet Gupta @ 2022-04-18 19:19 UTC (permalink / raw)
To: Bang Li, vgupta
Cc: peterz, mingo, valentin.schneider, linux-snps-arc, linux-kernel
On 3/18/22 19:03, Bang Li wrote:
> This patch reverts commit 7082a29c22ac ("ARC: use ACCESS_ONCE in cmpxchg
> loop").
>
> It is not necessary to use READ_ONCE() because cmpxchg contains barrier. We
> can get it from commit d57f727264f1 ("ARC: add compiler barrier to LLSC
> based cmpxchg").
>
> Signed-off-by: Bang Li <libang.linuxer@gmail.com>
Indeed this is not needed. However have you checked the code with and/wo
this change to see if it builds the same.
-Vineet
> ---
> arch/arc/kernel/smp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arc/kernel/smp.c b/arch/arc/kernel/smp.c
> index 78e6d069b1c1..56c23f3e1309 100644
> --- a/arch/arc/kernel/smp.c
> +++ b/arch/arc/kernel/smp.c
> @@ -274,7 +274,7 @@ static void ipi_send_msg_one(int cpu, enum ipi_msg_type msg)
> * and read back old value
> */
> do {
> - new = old = READ_ONCE(*ipi_data_ptr);
> + new = old = *ipi_data_ptr;
> new |= 1U << msg;
> } while (cmpxchg(ipi_data_ptr, old, new) != old);
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ARC: remove redundant READ_ONCE() in cmpxchg loop
@ 2022-04-18 19:19 ` Vineet Gupta
0 siblings, 0 replies; 4+ messages in thread
From: Vineet Gupta @ 2022-04-18 19:19 UTC (permalink / raw)
To: Bang Li, vgupta
Cc: peterz, mingo, valentin.schneider, linux-snps-arc, linux-kernel
On 3/18/22 19:03, Bang Li wrote:
> This patch reverts commit 7082a29c22ac ("ARC: use ACCESS_ONCE in cmpxchg
> loop").
>
> It is not necessary to use READ_ONCE() because cmpxchg contains barrier. We
> can get it from commit d57f727264f1 ("ARC: add compiler barrier to LLSC
> based cmpxchg").
>
> Signed-off-by: Bang Li <libang.linuxer@gmail.com>
Indeed this is not needed. However have you checked the code with and/wo
this change to see if it builds the same.
-Vineet
> ---
> arch/arc/kernel/smp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arc/kernel/smp.c b/arch/arc/kernel/smp.c
> index 78e6d069b1c1..56c23f3e1309 100644
> --- a/arch/arc/kernel/smp.c
> +++ b/arch/arc/kernel/smp.c
> @@ -274,7 +274,7 @@ static void ipi_send_msg_one(int cpu, enum ipi_msg_type msg)
> * and read back old value
> */
> do {
> - new = old = READ_ONCE(*ipi_data_ptr);
> + new = old = *ipi_data_ptr;
> new |= 1U << msg;
> } while (cmpxchg(ipi_data_ptr, old, new) != old);
>
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-04-18 19:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-19 2:03 [PATCH] ARC: remove redundant READ_ONCE() in cmpxchg loop Bang Li
2022-03-19 2:03 ` Bang Li
2022-04-18 19:19 ` Vineet Gupta
2022-04-18 19:19 ` Vineet Gupta
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.