History

Merge tag 'mips_fixes_5.5_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux

Pull MIPS fixes from Paul Burton: "A collection of MIPS fixes: - Fill the struct cacheinfo shared_cpu_map field with sensible values, notably avoiding issues with perf which was unhappy in the absence of these values. - A boot fix for Loongson 2E & 2F machines which was fallout from some refactoring performed this cycle. - A Kconfig dependency fix for the Loongson CPU HWMon driver. - A couple of VDSO fixes, ensuring gettimeofday() behaves appropriately for kernel configurations that don't include support for a clocksource the VDSO can use & fixing the calling convention for the n32 & n64 VDSOs which would previously clobber the $gp/$28 register. - A build fix for vmlinuz compressed images which were inappropriately building with -fsanitize-coverage despite not being part of the kernel proper, then failing to link due to the missing __sanitizer_cov_trace_pc() function. - A couple of eBPF JIT fixes, including disabling it for MIPS32 due to a large number of issues with the code generated there & reflecting ISA dependencies in Kconfig to enforce that systems which don't support the JIT must include the interpreter" * tag 'mips_fixes_5.5_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: MIPS: Avoid VDSO ABI breakage due to global register variable MIPS: BPF: eBPF JIT: check for MIPS ISA compliance in Kconfig MIPS: BPF: Disable MIPS32 eBPF JIT MIPS: Prevent link failure with kcov instrumentation MIPS: Kconfig: Use correct form for 'depends on' mips: Fix gettimeofday() in the vdso library MIPS: Fix boot on Fuloong2 systems mips: cacheinfo: report shared CPU map

Linus Torvalds committed 6 years ago

Commit c420ddd2 parents 5613970 bbcc5679 files · +73 −19Browse files

Unified · Split

9 files
  1. arch/mips/Kconfig +1 −1
  2. arch/mips/boot/compressed/Makefile +3 −0
  3. arch/mips/include/asm/cpu-type.h +2 −1
  4. arch/mips/include/asm/thread_info.h +19 −1
  5. arch/mips/include/asm/vdso/gettimeofday.h +0 −13
  6. arch/mips/kernel/cacheinfo.c +26 −1
  7. arch/mips/net/ebpf_jit.c +1 −1
  8. arch/mips/vdso/vgettimeofday.c +20 −0
  9. drivers/platform/mips/Kconfig +1 −1
arch/mips/Kconfig+1−1
@@ -47,7 +47,7 @@ config MIPS · 46 unmodified lines
4747 select HAVE_ARCH_TRACEHOOK
4848 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES
4949 select HAVE_ASM_MODVERSIONS
50− select HAVE_EBPF_JIT if (!CPU_MICROMIPS)
50+ select HAVE_EBPF_JIT if 64BIT && !CPU_MICROMIPS && TARGET_ISA_REV >= 2
5151 select HAVE_CONTEXT_TRACKING
5252 select HAVE_COPY_THREAD_TLS
5353 select HAVE_C_RECORDMCOUNT
arch/mips/boot/compressed/Makefile+3−0
@@ -29,6 +29,9 @@ KBUILD_AFLAGS := $(KBUILD_AFLAGS) -D__ASSEMBLY__ \ · 28 unmodified lines
2929 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \
3030 -DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS)
3131
32+# Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
33+KCOV_INSTRUMENT := n
34+
3235 # decompressor objects (linked with vmlinuz)
3336 vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o
3437
arch/mips/include/asm/cpu-type.h+2−1
@@ -15,7 +15,8 @@ · 14 unmodified lines
1515 static inline int __pure __get_cpu_type(const int cpu_type)
1616 {
1717 switch (cpu_type) {
18−#if defined(CONFIG_SYS_HAS_CPU_LOONGSON2EF)
18+#if defined(CONFIG_SYS_HAS_CPU_LOONGSON2E) || \
19+ defined(CONFIG_SYS_HAS_CPU_LOONGSON2F)
1920 case CPU_LOONGSON2EF:
2021 #endif
2122
arch/mips/include/asm/thread_info.h+19−1
@@ -49,8 +49,26 @@ struct thread_info { · 48 unmodified lines
4949 .addr_limit = KERNEL_DS, \
5050 }
5151
52−/* How to get the thread information struct from C. */
52+/*
53+ * A pointer to the struct thread_info for the currently executing thread is
54+ * held in register $28/$gp.
55+ *
56+ * We declare __current_thread_info as a global register variable rather than a
57+ * local register variable within current_thread_info() because clang doesn't
58+ * support explicit local register variables.
59+ *
60+ * When building the VDSO we take care not to declare the global register
61+ * variable because this causes GCC to not preserve the value of $28/$gp in
62+ * functions that change its value (which is common in the PIC VDSO when
63+ * accessing the GOT). Since the VDSO shouldn't be accessing
64+ * __current_thread_info anyway we declare it extern in order to cause a link
65+ * failure if it's referenced.
66+ */
67+#ifdef __VDSO__
68+extern struct thread_info *__current_thread_info;
69+#else
5370 register struct thread_info *__current_thread_info __asm__("$28");
71+#endif
5472
5573 static inline struct thread_info *current_thread_info(void)
5674 {
arch/mips/include/asm/vdso/gettimeofday.h+0−13
@@ -26,8 +26,6 @@ · 25 unmodified lines
2626
2727 #define __VDSO_USE_SYSCALL ULLONG_MAX
2828
29−#ifdef CONFIG_MIPS_CLOCK_VSYSCALL
30−
3129 static __always_inline long gettimeofday_fallback(
3230 struct __kernel_old_timeval *_tv,
3331 struct timezone *_tz)
@@ -48,17 +46,6 @@ static __always_inline long gettimeofday_fallback( · 14 unmodified lines
4846 return error ? -ret : ret;
4947 }
5048
51−#else
52−
53−static __always_inline long gettimeofday_fallback(
54− struct __kernel_old_timeval *_tv,
55− struct timezone *_tz)
56−{
57− return -1;
58−}
59−
60−#endif
61−
6249 static __always_inline long clock_gettime_fallback(
6350 clockid_t _clkid,
6451 struct __kernel_timespec *_ts)
arch/mips/kernel/cacheinfo.c+26−1
@@ -50,6 +50,25 @@ static int __init_cache_level(unsigned int cpu) · 49 unmodified lines
5050 return 0;
5151 }
5252
53+static void fill_cpumask_siblings(int cpu, cpumask_t *cpu_map)
54+{
55+ int cpu1;
56+
57+ for_each_possible_cpu(cpu1)
58+ if (cpus_are_siblings(cpu, cpu1))
59+ cpumask_set_cpu(cpu1, cpu_map);
60+}
61+
62+static void fill_cpumask_cluster(int cpu, cpumask_t *cpu_map)
63+{
64+ int cpu1;
65+ int cluster = cpu_cluster(&cpu_data[cpu]);
66+
67+ for_each_possible_cpu(cpu1)
68+ if (cpu_cluster(&cpu_data[cpu1]) == cluster)
69+ cpumask_set_cpu(cpu1, cpu_map);
70+}
71+
5372 static int __populate_cache_leaves(unsigned int cpu)
5473 {
5574 struct cpuinfo_mips *c = &current_cpu_data;
@@ -57,14 +76,20 @@ static int __populate_cache_leaves(unsigned int cpu) · 1 unmodified line
5776 struct cacheinfo *this_leaf = this_cpu_ci->info_list;
5877
5978 if (c->icache.waysize) {
79+ /* L1 caches are per core */
80+ fill_cpumask_siblings(cpu, &this_leaf->shared_cpu_map);
6081 populate_cache(dcache, this_leaf, 1, CACHE_TYPE_DATA);
82+ fill_cpumask_siblings(cpu, &this_leaf->shared_cpu_map);
6183 populate_cache(icache, this_leaf, 1, CACHE_TYPE_INST);
6284 } else {
6385 populate_cache(dcache, this_leaf, 1, CACHE_TYPE_UNIFIED);
6486 }
6587
66− if (c->scache.waysize)
88+ if (c->scache.waysize) {
89+ /* L2 cache is per cluster */
90+ fill_cpumask_cluster(cpu, &this_leaf->shared_cpu_map);
6791 populate_cache(scache, this_leaf, 2, CACHE_TYPE_UNIFIED);
92+ }
6893
6994 if (c->tcache.waysize)
7095 populate_cache(tcache, this_leaf, 3, CACHE_TYPE_UNIFIED);
arch/mips/net/ebpf_jit.c+1−1
@@ -1804,7 +1804,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) · 1803 unmodified lines
18041804 unsigned int image_size;
18051805 u8 *image_ptr;
18061806
1807− if (!prog->jit_requested || MIPS_ISA_REV < 2)
1807+ if (!prog->jit_requested)
18081808 return prog;
18091809
18101810 tmp = bpf_jit_blind_constants(prog);
arch/mips/vdso/vgettimeofday.c+20−0
@@ -17,12 +17,22 @@ int __vdso_clock_gettime(clockid_t clock, · 16 unmodified lines
1717 return __cvdso_clock_gettime32(clock, ts);
1818 }
1919
20+#ifdef CONFIG_MIPS_CLOCK_VSYSCALL
21+
22+/*
23+ * This is behind the ifdef so that we don't provide the symbol when there's no
24+ * possibility of there being a usable clocksource, because there's nothing we
25+ * can do without it. When libc fails the symbol lookup it should fall back on
26+ * the standard syscall path.
27+ */
2028 int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
2129 struct timezone *tz)
2230 {
2331 return __cvdso_gettimeofday(tv, tz);
2432 }
2533
34+#endif /* CONFIG_MIPS_CLOCK_VSYSCALL */
35+
2636 int __vdso_clock_getres(clockid_t clock_id,
2737 struct old_timespec32 *res)
2838 {
@@ -43,12 +53,22 @@ int __vdso_clock_gettime(clockid_t clock, · 14 unmodified lines
4353 return __cvdso_clock_gettime(clock, ts);
4454 }
4555
56+#ifdef CONFIG_MIPS_CLOCK_VSYSCALL
57+
58+/*
59+ * This is behind the ifdef so that we don't provide the symbol when there's no
60+ * possibility of there being a usable clocksource, because there's nothing we
61+ * can do without it. When libc fails the symbol lookup it should fall back on
62+ * the standard syscall path.
63+ */
4664 int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
4765 struct timezone *tz)
4866 {
4967 return __cvdso_gettimeofday(tv, tz);
5068 }
5169
70+#endif /* CONFIG_MIPS_CLOCK_VSYSCALL */
71+
5272 int __vdso_clock_getres(clockid_t clock_id,
5373 struct __kernel_timespec *res)
5474 {
drivers/platform/mips/Kconfig+1−1
@@ -18,7 +18,7 @@ if MIPS_PLATFORM_DEVICES · 17 unmodified lines
1818
1919 config CPU_HWMON
2020 tristate "Loongson-3 CPU HWMon Driver"
21− depends on CONFIG_MACH_LOONGSON64
21+ depends on MACH_LOONGSON64
2222 select HWMON
2323 default y
2424 help

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t