2020-06-23 13:33:46

by Greentime Hu

[permalink] [raw]
Subject: [PATCH 0/2] riscv: Add context tracker support

This patchset adds support for irq_work via self IPI and context tracking.
It is tested in qemu-system-riscv64 and SiFive HiFive Unleashed board based
on v5.8-rc2.

Greentime Hu (2):
riscv: Support irq_work via self IPIs
riscv: Enable context tracking

arch/riscv/Kconfig | 1 +
arch/riscv/include/asm/irq_work.h | 10 ++++++++++
arch/riscv/kernel/entry.S | 23 +++++++++++++++++++++++
arch/riscv/kernel/smp.c | 15 +++++++++++++++
4 files changed, 49 insertions(+)
create mode 100644 arch/riscv/include/asm/irq_work.h

--
2.27.0


2020-06-23 13:33:50

by Greentime Hu

[permalink] [raw]
Subject: [PATCH 1/2] riscv: Support irq_work via self IPIs

Support for arch_irq_work_raise() and arch_irq_work_has_interrupt() was
missing from riscv (a prerequisite for FULL_NOHZ).

Signed-off-by: Greentime Hu <[email protected]>
---
arch/riscv/include/asm/irq_work.h | 10 ++++++++++
arch/riscv/kernel/smp.c | 15 +++++++++++++++
2 files changed, 25 insertions(+)
create mode 100644 arch/riscv/include/asm/irq_work.h

diff --git a/arch/riscv/include/asm/irq_work.h b/arch/riscv/include/asm/irq_work.h
new file mode 100644
index 000000000000..eb9f3d9b15ed
--- /dev/null
+++ b/arch/riscv/include/asm/irq_work.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_RISCV_IRQ_WORK_H
+#define _ASM_RISCV_IRQ_WORK_H
+
+static inline bool arch_irq_work_has_interrupt(void)
+{
+ return true;
+}
+
+#endif /* _ASM_RISCV_IRQ_WORK_H */
diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c
index b1d4f452f843..554b0fb47060 100644
--- a/arch/riscv/kernel/smp.c
+++ b/arch/riscv/kernel/smp.c
@@ -16,6 +16,7 @@
#include <linux/sched.h>
#include <linux/seq_file.h>
#include <linux/delay.h>
+#include <linux/irq_work.h>

#include <asm/clint.h>
#include <asm/sbi.h>
@@ -26,6 +27,7 @@ enum ipi_message_type {
IPI_RESCHEDULE,
IPI_CALL_FUNC,
IPI_CPU_STOP,
+ IPI_IRQ_WORK,
IPI_MAX
};

@@ -123,6 +125,13 @@ static inline void clear_ipi(void)
clint_clear_ipi(cpuid_to_hartid_map(smp_processor_id()));
}

+#ifdef CONFIG_IRQ_WORK
+void arch_irq_work_raise(void)
+{
+ send_ipi_single(smp_processor_id(), IPI_IRQ_WORK);
+}
+#endif
+
void handle_IPI(struct pt_regs *regs)
{
struct pt_regs *old_regs = set_irq_regs(regs);
@@ -158,6 +167,11 @@ void handle_IPI(struct pt_regs *regs)
ipi_stop();
}

+ if (ops & (1 << IPI_IRQ_WORK)) {
+ stats[IPI_IRQ_WORK]++;
+ irq_work_run();
+ }
+
BUG_ON((ops >> IPI_MAX) != 0);

/* Order data access and bit testing. */
@@ -173,6 +187,7 @@ static const char * const ipi_names[] = {
[IPI_RESCHEDULE] = "Rescheduling interrupts",
[IPI_CALL_FUNC] = "Function call interrupts",
[IPI_CPU_STOP] = "CPU stop interrupts",
+ [IPI_IRQ_WORK] = "IRQ work interrupts",
};

void show_ipi_stats(struct seq_file *p, int prec)
--
2.27.0

2020-06-23 16:28:48

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 1/2] riscv: Support irq_work via self IPIs

Hi Greentime,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.8-rc2 next-20200623]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Greentime-Hu/riscv-Add-context-tracker-support/20200623-213029
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git dd0d718152e4c65b173070d48ea9dfc06894c3e5
config: riscv-allyesconfig (attached as .config)
compiler: riscv64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=riscv

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

>> arch/riscv/kernel/smp.c:129:6: warning: no previous prototype for 'arch_irq_work_raise' [-Wmissing-prototypes]
129 | void arch_irq_work_raise(void)
| ^~~~~~~~~~~~~~~~~~~

vim +/arch_irq_work_raise +129 arch/riscv/kernel/smp.c

127
128 #ifdef CONFIG_IRQ_WORK
> 129 void arch_irq_work_raise(void)
130 {
131 send_ipi_single(smp_processor_id(), IPI_IRQ_WORK);
132 }
133 #endif
134

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (1.66 kB)
.config.gz (63.57 kB)
Download all attachments