Commit 2c8c230e authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'riscv-for-linus-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux

Pull RISC-V fixes from Palmer Dabbelt:

 - A fix for the K210 sdcard defconfig, to avoid using a
   fixed delay for the root FS

 - A fix to make sure there's a proper call frame for
   trace_hardirqs_{on,off}().

* tag 'riscv-for-linus-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
  riscv: fix oops caused by irqsoff latency tracer
  riscv: fix nommu_k210_sdcard_defconfig
parents 3bd9dd81 22e2100b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ CONFIG_SLOB=y
CONFIG_SOC_CANAAN=y
CONFIG_SMP=y
CONFIG_NR_CPUS=2
CONFIG_CMDLINE="earlycon console=ttySIF0 rootdelay=2 root=/dev/mmcblk0p1 ro"
CONFIG_CMDLINE="earlycon console=ttySIF0 root=/dev/mmcblk0p1 rootwait ro"
CONFIG_CMDLINE_FORCE=y
# CONFIG_SECCOMP is not set
# CONFIG_STACKPROTECTOR is not set
+2 −0
Original line number Diff line number Diff line
@@ -51,6 +51,8 @@ obj-$(CONFIG_MODULE_SECTIONS) += module-sections.o
obj-$(CONFIG_FUNCTION_TRACER)	+= mcount.o ftrace.o
obj-$(CONFIG_DYNAMIC_FTRACE)	+= mcount-dyn.o

obj-$(CONFIG_TRACE_IRQFLAGS)	+= trace_irq.o

obj-$(CONFIG_RISCV_BASE_PMU)	+= perf_event.o
obj-$(CONFIG_PERF_EVENTS)	+= perf_callchain.o
obj-$(CONFIG_HAVE_PERF_REGS)	+= perf_regs.o
+5 −5
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ _save_context:
.option pop

#ifdef CONFIG_TRACE_IRQFLAGS
	call trace_hardirqs_off
	call __trace_hardirqs_off
#endif

#ifdef CONFIG_CONTEXT_TRACKING
@@ -143,7 +143,7 @@ skip_context_tracking:
	li t0, EXC_BREAKPOINT
	beq s4, t0, 1f
#ifdef CONFIG_TRACE_IRQFLAGS
	call trace_hardirqs_on
	call __trace_hardirqs_on
#endif
	csrs CSR_STATUS, SR_IE

@@ -234,7 +234,7 @@ ret_from_exception:
	REG_L s0, PT_STATUS(sp)
	csrc CSR_STATUS, SR_IE
#ifdef CONFIG_TRACE_IRQFLAGS
	call trace_hardirqs_off
	call __trace_hardirqs_off
#endif
#ifdef CONFIG_RISCV_M_MODE
	/* the MPP value is too large to be used as an immediate arg for addi */
@@ -270,10 +270,10 @@ restore_all:
	REG_L s1, PT_STATUS(sp)
	andi t0, s1, SR_PIE
	beqz t0, 1f
	call trace_hardirqs_on
	call __trace_hardirqs_on
	j 2f
1:
	call trace_hardirqs_off
	call __trace_hardirqs_off
2:
#endif
	REG_L a0, PT_STATUS(sp)
+27 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2022 Changbin Du <changbin.du@gmail.com>
 */

#include <linux/irqflags.h>
#include <linux/kprobes.h>
#include "trace_irq.h"

/*
 * trace_hardirqs_on/off require the caller to setup frame pointer properly.
 * Otherwise, CALLER_ADDR1 might trigger an pagging exception in kernel.
 * Here we add one extra level so they can be safely called by low
 * level entry code which $fp is used for other purpose.
 */

void __trace_hardirqs_on(void)
{
	trace_hardirqs_on();
}
NOKPROBE_SYMBOL(__trace_hardirqs_on);

void __trace_hardirqs_off(void)
{
	trace_hardirqs_off();
}
NOKPROBE_SYMBOL(__trace_hardirqs_off);
+11 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (C) 2022 Changbin Du <changbin.du@gmail.com>
 */
#ifndef __TRACE_IRQ_H
#define __TRACE_IRQ_H

void __trace_hardirqs_on(void);
void __trace_hardirqs_off(void);

#endif /* __TRACE_IRQ_H */