Skip to contentSkip to conversation

tracing: Fix simple_ring_buffer symbol checking on parisc and sparc64

PATCH In review Vincent Donnefort 2 participants 7 messages Sep 23 – Sep 25 Tracing

lore
Share & tools
lore
#0 lore raw

cover tracing: Fix simple_ring_buffer symbol checking on parisc and sparc64

Here's a series of fixes following Guenter report [1] of build failures on parisc and sparc64 with allmodconfigs.

[1] https://lore.kernel.org/all/[email protected]/

Vincent Donnefort (3):
tracing: Fix empty symbol names in simple_ring_buffer undef check
tracing: Fix simple_ring_buffer undef check on parisc
tracing: Fix simple_ring_buffer undef check on sparc64

 kernel/trace/Makefile         | 5 +++--
 kernel/trace/undefsyms_base.c | 5 ++++-
 2 files changed, 7 insertions(+), 3 deletions(-)

base-commit: 93f51579e7df248780214094418f205253383cc5

Signature · 1 line
2.55.0.1082.g2b9226bbc0-goog
#1 lore raw

PATCH 1/3 tracing: Fix empty symbol names in simple_ring_buffer undef check

Sparc64 emits empty symmbol names. Skips them when establishing the allowlist and when extracing undefined symbols.

Fixes 1211907ac0b5 ("tracing: Generate undef symbols allowlist for simple_ring_buffer")
---
 kernel/trace/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/Makefile +2 -2
index f934ff586bd4..0e1846f7dda3 100644
@@ -146,11 +146,11 @@ KASAN_SANITIZE_undefsyms_base.o := y
 
 UNDEFINED_ALLOWLIST = __asan __gcov __kasan __kcsan __hwasan __sancov __sanitizer __tsan __ubsan __msan \
 		      __aeabi_unwind_cpp __s390_indirect_jump __x86_indirect_thunk simple_ring_buffer \
-		      $(shell $(NM) -u $(obj)/undefsyms_base.o 2>/dev/null | awk '{print $$2}')
+		      $(shell $(NM) -u $(obj)/undefsyms_base.o 2>/dev/null | awk '$$2 {print $$2}')
 
 quiet_cmd_check_undefined = NM      $<
       cmd_check_undefined = \
-          undefsyms=$$($(NM) -u $< | grep -v $(addprefix -e , $(UNDEFINED_ALLOWLIST)) || true); \
+          undefsyms=$$($(NM) -u $< | awk '$$2 {print $$2}' | grep -v $(addprefix -e , $(UNDEFINED_ALLOWLIST)) || true); \
           if [ -n "$$undefsyms" ]; then \
               echo "Unexpected symbols in $<:" >&2; \
               echo "$$undefsyms" >&2; \
Signature · 1 line
2.55.0.1082.g2b9226bbc0-goog
Tested-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] tracing: Fix empty symbol names in simple_ring_buffer undef check

Quoted 7 lines · Vincent Donnefort

Sparc64 emits empty symmbol names. Skips them when establishing the allowlist and when extracing undefined symbols.

Fixes 1211907ac0b5 ("tracing: Generate undef symbols allowlist for simple_ring_buffer")
Quoted 25 lines
---
 kernel/trace/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/Makefile +2 -2
index f934ff586bd4..0e1846f7dda3 100644
@@ -146,11 +146,11 @@ KASAN_SANITIZE_undefsyms_base.o := y
 
 UNDEFINED_ALLOWLIST = __asan __gcov __kasan __kcsan __hwasan __sancov __sanitizer __tsan __ubsan __msan \
 		      __aeabi_unwind_cpp __s390_indirect_jump __x86_indirect_thunk simple_ring_buffer \
-		      $(shell $(NM) -u $(obj)/undefsyms_base.o 2>/dev/null | awk '{print $$2}')
+		      $(shell $(NM) -u $(obj)/undefsyms_base.o 2>/dev/null | awk '$$2 {print $$2}')
 
 quiet_cmd_check_undefined = NM      $<
       cmd_check_undefined = \
-          undefsyms=$$($(NM) -u $< | grep -v $(addprefix -e , $(UNDEFINED_ALLOWLIST)) || true); \
+          undefsyms=$$($(NM) -u $< | awk '$$2 {print $$2}' | grep -v $(addprefix -e , $(UNDEFINED_ALLOWLIST)) || true); \
           if [ -n "$$undefsyms" ]; then \
               echo "Unexpected symbols in $<:" >&2; \
               echo "$$undefsyms" >&2; \
Signature · 1 line
2.55.0.1082.g2b9226bbc0-goog
#3 lore raw

PATCH 2/3 tracing: Fix simple_ring_buffer undef check on parisc

In reply to Vincent Donnefort

simple_ring_buffer uses local_set() and cmpxchg() on unsigned long. Add them to undefsyms_base.c to extend the allowlist for the parisc architecture.

Fixes 1211907ac0b5 ("tracing: Generate undef symbols allowlist for simple_ring_buffer")
---
 kernel/trace/undefsyms_base.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/trace/undefsyms_base.c +4 -1
index e65baf58e6ff..37310baf706b 100644
@@ -9,6 +9,7 @@
 
 #include <linux/atomic.h>
 #include <linux/string.h>
+#include <asm/local.h>
 #include <asm/page.h>
 
 void undefsyms_base(void *p, int n);
@@ -18,11 +19,13 @@ static char page[PAGE_SIZE] __aligned(PAGE_SIZE);
 void undefsyms_base(void *p, int n)
 {
 	char buffer[256] = { 0 };
-
 	u32 u = 0;
+
 	memset((char * volatile)page, 8, PAGE_SIZE);
 	memset((char * volatile)buffer, 8, sizeof(buffer));
 	memcpy((void * volatile)p, buffer, sizeof(buffer));
 	cmpxchg((u32 * volatile)&u, 0, 8);
+	cmpxchg((unsigned long *)p, 0, 8);
+	local_set((local_t *)p, 8);
 	WARN_ON(n == 0xdeadbeef);
 }
Signature · 1 line
2.55.0.1082.g2b9226bbc0-goog
Tested-by on v1 2/3
#4 lore raw

Re: [PATCH 2/3] tracing: Fix simple_ring_buffer undef check on parisc

Quoted 8 lines · Vincent Donnefort

simple_ring_buffer uses local_set() and cmpxchg() on unsigned long. Add them to undefsyms_base.c to extend the allowlist for the parisc architecture.

Fixes 1211907ac0b5 ("tracing: Generate undef symbols allowlist for simple_ring_buffer")
Quoted 34 lines
---
 kernel/trace/undefsyms_base.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/trace/undefsyms_base.c +4 -1
index e65baf58e6ff..37310baf706b 100644
@@ -9,6 +9,7 @@
 
 #include <linux/atomic.h>
 #include <linux/string.h>
+#include <asm/local.h>
 #include <asm/page.h>
 
 void undefsyms_base(void *p, int n);
@@ -18,11 +19,13 @@ static char page[PAGE_SIZE] __aligned(PAGE_SIZE);
 void undefsyms_base(void *p, int n)
 {
 	char buffer[256] = { 0 };
-
 	u32 u = 0;
+
 	memset((char * volatile)page, 8, PAGE_SIZE);
 	memset((char * volatile)buffer, 8, sizeof(buffer));
 	memcpy((void * volatile)p, buffer, sizeof(buffer));
 	cmpxchg((u32 * volatile)&u, 0, 8);
+	cmpxchg((unsigned long *)p, 0, 8);
+	local_set((local_t *)p, 8);
 	WARN_ON(n == 0xdeadbeef);
 }
Signature · 1 line
2.55.0.1082.g2b9226bbc0-goog
#5 lore raw

PATCH 3/3 tracing: Fix simple_ring_buffer undef check on sparc64

In reply to Vincent Donnefort

simple_ring_buffer relies on headers that end up including <asm/thread_info.h>. On sparc64, this emits the undefined symbol current_thread_info_reg. Allow this symbol.

Fixes 1211907ac0b5 ("tracing: Generate undef symbols allowlist for simple_ring_buffer")
---
 kernel/trace/Makefile | 1 +
 1 file changed, 1 insertion(+)
kernel/trace/Makefile +1 -0
index 0e1846f7dda3..3860bc53a4be 100644
@@ -146,6 +146,7 @@ KASAN_SANITIZE_undefsyms_base.o := y
 
 UNDEFINED_ALLOWLIST = __asan __gcov __kasan __kcsan __hwasan __sancov __sanitizer __tsan __ubsan __msan \
 		      __aeabi_unwind_cpp __s390_indirect_jump __x86_indirect_thunk simple_ring_buffer \
+		      current_thread_info_reg \
 		      $(shell $(NM) -u $(obj)/undefsyms_base.o 2>/dev/null | awk '$$2 {print $$2}')
 
 quiet_cmd_check_undefined = NM      $<
Signature · 1 line
2.55.0.1082.g2b9226bbc0-goog
Tested-by on v1 3/3
#6 lore raw

Re: [PATCH 3/3] tracing: Fix simple_ring_buffer undef check on sparc64

Quoted 8 lines · Vincent Donnefort

simple_ring_buffer relies on headers that end up including <asm/thread_info.h>. On sparc64, this emits the undefined symbol current_thread_info_reg. Allow this symbol.

Fixes 1211907ac0b5 ("tracing: Generate undef symbols allowlist for simple_ring_buffer")
Quoted 19 lines
---
 kernel/trace/Makefile | 1 +
 1 file changed, 1 insertion(+)
kernel/trace/Makefile +1 -0
index 0e1846f7dda3..3860bc53a4be 100644
@@ -146,6 +146,7 @@ KASAN_SANITIZE_undefsyms_base.o := y
 
 UNDEFINED_ALLOWLIST = __asan __gcov __kasan __kcsan __hwasan __sancov __sanitizer __tsan __ubsan __msan \
 		      __aeabi_unwind_cpp __s390_indirect_jump __x86_indirect_thunk simple_ring_buffer \
+		      current_thread_info_reg \
 		      $(shell $(NM) -u $(obj)/undefsyms_base.o 2>/dev/null | awk '$$2 {print $$2}')
 
 quiet_cmd_check_undefined = NM      $<
Signature · 1 line
2.55.0.1082.g2b9226bbc0-goog