Skip to contentSkip to conversation

RISC-V: fix barrier() use in <vdso/processor.h>

PATCH Superseded Randy Dunlap 4 participants 6 messages Nov 17, 2020 – Nov 21, 2020 RISC-V

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RISC-V: fix barrier() use in <vdso/processor.h>

riscv's <vdso/processor.h> uses barrier() so it should #include <asm/barrier.h> to prevent build errors.

Fixes this build error:
CC [M] drivers/net/ethernet/emulex/benet/be_main.o
In file included from ./include/vdso/processor.h:10,

                 from ./arch/riscv/include/asm/processor.h:11,
                 from ./include/linux/prefetch.h:15,
                 from drivers/net/ethernet/emulex/benet/be_main.c:14:

./arch/riscv/include/asm/vdso/processor.h: In function 'cpu_relax':
./arch/riscv/include/asm/vdso/processor.h:14:2: error: implicit declaration of function 'barrier' [-Werror=implicit-function-declaration]
14 | barrier();

This happens with a total of 5 networking drivers -- they all use <linux/prefetch.h>.

rv64 allmodconfig now builds cleanly after this patch.

Fixes fallout from:
815f0ddb346c ("include/linux/compiler*.h: make compiler-*.h mutually exclusive")

Fixes ad5d1122b82f ("riscv: use vDSO common flow to reduce the latency of the time-related functions")
Cc Andrew Morton <[email protected]>
Cc Stephen Rothwell <[email protected]>
Cc Arvind Sankar <[email protected]>
Cc Nick Desaulniers <[email protected]>
Cc Nathan Chancellor <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Palmer Dabbelt <[email protected]>
Cc Albert Ou <[email protected]>
---
 arch/riscv/include/asm/vdso/processor.h |    2 ++
 1 file changed, 2 insertions(+)
arch/riscv/include/asm/vdso/processor.h +2 -0
@@ -4,6 +4,8 @@
 
 #ifndef __ASSEMBLY__
 
+#include <asm/barrier.h>
+
 static inline void cpu_relax(void)
 {
 #ifdef __riscv_muldiv

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#1 lore raw
Quoted 17 lines · Randy Dunlap

riscv's <vdso/processor.h> uses barrier() so it should #include <asm/barrier.h> to prevent build errors.

Fixes this build error:
CC [M] drivers/net/ethernet/emulex/benet/be_main.o
In file included from ./include/vdso/processor.h:10,

                 from ./arch/riscv/include/asm/processor.h:11,
                 from ./include/linux/prefetch.h:15,
                 from drivers/net/ethernet/emulex/benet/be_main.c:14:

./arch/riscv/include/asm/vdso/processor.h: In function 'cpu_relax':
./arch/riscv/include/asm/vdso/processor.h:14:2: error: implicit declaration of function 'barrier' [-Werror=implicit-function-declaration]
14 | barrier();

This happens with a total of 5 networking drivers -- they all use <linux/prefetch.h>.

Quoted 6 lines

rv64 allmodconfig now builds cleanly after this patch.

Fixes fallout from:
815f0ddb346c ("include/linux/compiler*.h: make compiler-*.h mutually exclusive")

Fixes ad5d1122b82f ("riscv: use vDSO common flow to reduce the latency of the time-related functions")

Hi Randy,
Thanks for the patch, it looks good to me. I only had a question on the commit message.

Is this also related to:
commit 3347acc6fcd4 ("compiler.h: fix barrier_data() on clang")

I plan to backport 3347acc6fcd4, so it would be good if all of the follow ups are all tagged accordingly with fixes tags, so that I don't break anything backporting 3347acc6fcd4 because I forgot or missed any follow ups that also needed to be backported.

Quoted 27 lines
Cc Andrew Morton <[email protected]>
Cc Stephen Rothwell <[email protected]>
Cc Arvind Sankar <[email protected]>
Cc Nick Desaulniers <[email protected]>
Cc Nathan Chancellor <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Palmer Dabbelt <[email protected]>
Cc Albert Ou <[email protected]>
---
 arch/riscv/include/asm/vdso/processor.h |    2 ++
 1 file changed, 2 insertions(+)
arch/riscv/include/asm/vdso/processor.h +2 -0
@@ -4,6 +4,8 @@
 
 #ifndef __ASSEMBLY__
 
+#include <asm/barrier.h>
+
 static inline void cpu_relax(void)
 {
 #ifdef __riscv_muldiv
Signature · 7 lines
Thanks,
~Nick Desaulniers

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#2 lore raw
Quoted 23 lines · Nick Desaulniers
Quoted 22 lines · Randy Dunlap

riscv's <vdso/processor.h> uses barrier() so it should #include <asm/barrier.h> to prevent build errors.

Fixes this build error:
CC [M] drivers/net/ethernet/emulex/benet/be_main.o
In file included from ./include/vdso/processor.h:10,

                 from ./arch/riscv/include/asm/processor.h:11,
                 from ./include/linux/prefetch.h:15,
                 from drivers/net/ethernet/emulex/benet/be_main.c:14:

./arch/riscv/include/asm/vdso/processor.h: In function 'cpu_relax':
./arch/riscv/include/asm/vdso/processor.h:14:2: error: implicit declaration of function 'barrier' [-Werror=implicit-function-declaration]
14 | barrier();

This happens with a total of 5 networking drivers -- they all use <linux/prefetch.h>.

rv64 allmodconfig now builds cleanly after this patch.

Fixes fallout from:
815f0ddb346c ("include/linux/compiler*.h: make compiler-*.h mutually exclusive")

Quoted 8 lines
Quoted 1 line
Fixes ad5d1122b82f ("riscv: use vDSO common flow to reduce the latency of the time-related functions")

Hi Randy,
Thanks for the patch, it looks good to me. I only had a question on the commit message.

Is this also related to:
commit 3347acc6fcd4 ("compiler.h: fix barrier_data() on clang")

Hi Nick,
Yes, it looks like I tagged the wrong commit in Fixes:
Thanks for noticing that.

Quoted 35 lines

I plan to backport 3347acc6fcd4, so it would be good if all of the follow ups are all tagged accordingly with fixes tags, so that I don't break anything backporting 3347acc6fcd4 because I forgot or missed any follow ups that also needed to be backported.

Quoted 27 lines
Cc Andrew Morton <[email protected]>
Cc Stephen Rothwell <[email protected]>
Cc Arvind Sankar <[email protected]>
Cc Nick Desaulniers <[email protected]>
Cc Nathan Chancellor <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Palmer Dabbelt <[email protected]>
Cc Albert Ou <[email protected]>
---
 arch/riscv/include/asm/vdso/processor.h |    2 ++
 1 file changed, 2 insertions(+)
arch/riscv/include/asm/vdso/processor.h +2 -0
@@ -4,6 +4,8 @@
 
 #ifndef __ASSEMBLY__
 
+#include <asm/barrier.h>
+
 static inline void cpu_relax(void)
 {
 #ifdef __riscv_muldiv
Signature · 7 lines
~Randy


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#3 lore raw
Quoted 30 lines · Randy Dunlap
Quoted 29 lines · Nick Desaulniers
Quoted 17 lines · Randy Dunlap

riscv's <vdso/processor.h> uses barrier() so it should #include <asm/barrier.h> to prevent build errors.

Fixes this build error:
CC [M] drivers/net/ethernet/emulex/benet/be_main.o
In file included from ./include/vdso/processor.h:10,

                 from ./arch/riscv/include/asm/processor.h:11,
                 from ./include/linux/prefetch.h:15,
                 from drivers/net/ethernet/emulex/benet/be_main.c:14:

./arch/riscv/include/asm/vdso/processor.h: In function 'cpu_relax':
./arch/riscv/include/asm/vdso/processor.h:14:2: error: implicit declaration of function 'barrier' [-Werror=implicit-function-declaration]
14 | barrier();

This happens with a total of 5 networking drivers -- they all use <linux/prefetch.h>.

Quoted 6 lines

rv64 allmodconfig now builds cleanly after this patch.

Fixes fallout from:
815f0ddb346c ("include/linux/compiler*.h: make compiler-*.h mutually exclusive")

Fixes ad5d1122b82f ("riscv: use vDSO common flow to reduce the latency of the time-related functions")

Hi Randy,
Thanks for the patch, it looks good to me. I only had a question on the commit message.

Quoted 7 lines
Quoted 2 lines

Is this also related to:
commit 3347acc6fcd4 ("compiler.h: fix barrier_data() on clang")

Hi Nick,
Yes, it looks like I tagged the wrong commit in Fixes:
Thanks for noticing that.

I'll send a v2 with corrections.

Quoted 33 lines
Quoted 33 lines

I plan to backport 3347acc6fcd4, so it would be good if all of the follow ups are all tagged accordingly with fixes tags, so that I don't break anything backporting 3347acc6fcd4 because I forgot or missed any follow ups that also needed to be backported.

Quoted 27 lines
Cc Andrew Morton <[email protected]>
Cc Stephen Rothwell <[email protected]>
Cc Arvind Sankar <[email protected]>
Cc Nick Desaulniers <[email protected]>
Cc Nathan Chancellor <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Palmer Dabbelt <[email protected]>
Cc Albert Ou <[email protected]>
---
 arch/riscv/include/asm/vdso/processor.h |    2 ++
 1 file changed, 2 insertions(+)
arch/riscv/include/asm/vdso/processor.h +2 -0
@@ -4,6 +4,8 @@
 
 #ifndef __ASSEMBLY__
 
+#include <asm/barrier.h>
+
 static inline void cpu_relax(void)
 {
 #ifdef __riscv_muldiv
Signature · 7 lines
~Randy


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Acked-by
#4 lore raw
In reply to Randy Dunlap
Quoted 30 lines · Randy Dunlap
Quoted 29 lines · Nick Desaulniers
Quoted 17 lines · Randy Dunlap

riscv's <vdso/processor.h> uses barrier() so it should #include <asm/barrier.h> to prevent build errors.

Fixes this build error:
CC [M] drivers/net/ethernet/emulex/benet/be_main.o
In file included from ./include/vdso/processor.h:10,

                 from ./arch/riscv/include/asm/processor.h:11,
                 from ./include/linux/prefetch.h:15,
                 from drivers/net/ethernet/emulex/benet/be_main.c:14:

./arch/riscv/include/asm/vdso/processor.h: In function 'cpu_relax':
./arch/riscv/include/asm/vdso/processor.h:14:2: error: implicit declaration of function 'barrier' [-Werror=implicit-function-declaration]
14 | barrier();

This happens with a total of 5 networking drivers -- they all use <linux/prefetch.h>.

Quoted 6 lines

rv64 allmodconfig now builds cleanly after this patch.

Fixes fallout from:
815f0ddb346c ("include/linux/compiler*.h: make compiler-*.h mutually exclusive")

Fixes ad5d1122b82f ("riscv: use vDSO common flow to reduce the latency of the time-related functions")

Hi Randy,
Thanks for the patch, it looks good to me. I only had a question on the commit message.

Quoted 7 lines
Quoted 2 lines

Is this also related to:
commit 3347acc6fcd4 ("compiler.h: fix barrier_data() on clang")

Hi Nick,
Yes, it looks like I tagged the wrong commit in Fixes:
Thanks for noticing that.

Thanks for the patch!

Generally speaking, should compiler_types.h be considered "internal"? i.e. everyone should include compiler.h, not compiler_types.h directly?

Eg for another potential case that might bite is that RELOC_HIDE is defined in compiler_types.h, except for clang, which will only have a definition if compiler.h is included.

maintainer
#5 lore raw
In reply to Randy Dunlap
Quoted 41 lines · On Mon, 16 Nov 2020 17:39:51 PST (-0800), [email protected] wrote:

riscv's <vdso/processor.h> uses barrier() so it should #include <asm/barrier.h> to prevent build errors.

Fixes this build error:
CC [M] drivers/net/ethernet/emulex/benet/be_main.o
In file included from ./include/vdso/processor.h:10,

                 from ./arch/riscv/include/asm/processor.h:11,
                 from ./include/linux/prefetch.h:15,
                 from drivers/net/ethernet/emulex/benet/be_main.c:14:

./arch/riscv/include/asm/vdso/processor.h: In function 'cpu_relax':
./arch/riscv/include/asm/vdso/processor.h:14:2: error: implicit declaration of function 'barrier' [-Werror=implicit-function-declaration]
14 | barrier();

This happens with a total of 5 networking drivers -- they all use <linux/prefetch.h>.

rv64 allmodconfig now builds cleanly after this patch.

Fixes fallout from:
815f0ddb346c ("include/linux/compiler*.h: make compiler-*.h mutually exclusive")

Fixes ad5d1122b82f ("riscv: use vDSO common flow to reduce the latency of the time-related functions")
Cc Andrew Morton <[email protected]>
Cc Stephen Rothwell <[email protected]>
Cc Arvind Sankar <[email protected]>
Cc Nick Desaulniers <[email protected]>
Cc Nathan Chancellor <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Palmer Dabbelt <[email protected]>
Cc Albert Ou <[email protected]>
---
 arch/riscv/include/asm/vdso/processor.h |    2 ++
 1 file changed, 2 insertions(+)

arch/riscv/include/asm/vdso/processor.h line 11

Quoted 8 lines
arch/riscv/include/asm/vdso/processor.h +2 -0
@@ -4,6 +4,8 @@
 
 #ifndef __ASSEMBLY__
 
+#include <asm/barrier.h>
+
 static inline void cpu_relax(void)
 {
 #ifdef __riscv_muldiv

Thanks, this is on fixes.

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv