From 776ca1543b5fe673aaf1beb244fcc2429d378083 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Wed, 17 Oct 2018 21:28:01 -0700 Subject: [PATCH 1/3] sparc: Fix syscall fallback bugs in VDSO. First, the trap number for 32-bit syscalls is 0x10. Also, only negate the return value when syscall error is indicated by the carry bit being set. Signed-off-by: David S. Miller --- arch/sparc/vdso/vclock_gettime.c | 12 +++++++++++- tools/perf/util/event.c | 5 +++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/sparc/vdso/vclock_gettime.c b/arch/sparc/vdso/vclock_gettime.c index 3feb3d960ca5..75dca9aab737 100644 --- a/arch/sparc/vdso/vclock_gettime.c +++ b/arch/sparc/vdso/vclock_gettime.c @@ -33,9 +33,19 @@ #define TICK_PRIV_BIT (1ULL << 63) #endif +#ifdef CONFIG_SPARC64 #define SYSCALL_STRING \ "ta 0x6d;" \ - "sub %%g0, %%o0, %%o0;" \ + "bcs,a 1f;" \ + " sub %%g0, %%o0, %%o0;" \ + "1:" +#else +#define SYSCALL_STRING \ + "ta 0x10;" \ + "bcs,a 1f;" \ + " sub %%g0, %%o0, %%o0;" \ + "1:" +#endif #define SYSCALL_CLOBBERS \ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 0cd42150f712..651cd6f6762c 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -1081,6 +1081,7 @@ void *cpu_map_data__alloc(struct cpu_map *map, size_t *size, u16 *type, int *max } *size += sizeof(struct cpu_map_data); + *size = PERF_ALIGN(*size, sizeof(u64)); return zalloc(*size); } @@ -1560,7 +1561,9 @@ struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr, return NULL; } +#if 0 try_again: +#endif al->map = map_groups__find(mg, al->addr); if (al->map == NULL) { /* @@ -1572,6 +1575,7 @@ struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr, * "[vdso]" dso, but for now lets use the old trick of looking * in the whole kernel symbol list. */ +#if 0 if (cpumode == PERF_RECORD_MISC_USER && machine && mg != &machine->kmaps && machine__kernel_ip(machine, al->addr)) { @@ -1579,6 +1583,7 @@ struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr, load_map = true; goto try_again; } +#endif } else { /* * Kernel maps might be changed when loading symbols so loading From 62d6f3b7b85e9ba79c96bfd36f501f180908e623 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Sat, 13 Oct 2018 13:26:53 +0300 Subject: [PATCH 2/3] sparc: vDSO: Silence an uninitialized variable warning Smatch complains that "val" would be uninitialized if kstrtoul() fails. Fixes: 9a08862a5d2e ("vDSO for sparc") Signed-off-by: Dan Carpenter Signed-off-by: David S. Miller --- arch/sparc/vdso/vma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/sparc/vdso/vma.c b/arch/sparc/vdso/vma.c index f51595f861b8..5eaff3c1aa0c 100644 --- a/arch/sparc/vdso/vma.c +++ b/arch/sparc/vdso/vma.c @@ -262,7 +262,9 @@ static __init int vdso_setup(char *s) unsigned long val; err = kstrtoul(s, 10, &val); + if (err) + return err; vdso_enabled = val; - return err; + return 0; } __setup("vdso=", vdso_setup); From 27faeebd00813cd52a140e8944b6b32729b50e61 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Thu, 18 Oct 2018 11:32:29 -0700 Subject: [PATCH 3/3] sparc: Revert unintended perf changes. Some local debugging hacks accidently slipped into the VDSO commit. Sorry! Signed-off-by: David S. Miller --- tools/perf/util/event.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 651cd6f6762c..0cd42150f712 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -1081,7 +1081,6 @@ void *cpu_map_data__alloc(struct cpu_map *map, size_t *size, u16 *type, int *max } *size += sizeof(struct cpu_map_data); - *size = PERF_ALIGN(*size, sizeof(u64)); return zalloc(*size); } @@ -1561,9 +1560,7 @@ struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr, return NULL; } -#if 0 try_again: -#endif al->map = map_groups__find(mg, al->addr); if (al->map == NULL) { /* @@ -1575,7 +1572,6 @@ struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr, * "[vdso]" dso, but for now lets use the old trick of looking * in the whole kernel symbol list. */ -#if 0 if (cpumode == PERF_RECORD_MISC_USER && machine && mg != &machine->kmaps && machine__kernel_ip(machine, al->addr)) { @@ -1583,7 +1579,6 @@ struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr, load_map = true; goto try_again; } -#endif } else { /* * Kernel maps might be changed when loading symbols so loading