|
@@ -22,22 +22,24 @@
|
|
|
#include <linux/interrupt.h>
|
|
|
#include <linux/smp.h>
|
|
|
#include <linux/sched.h>
|
|
|
+#include <linux/seq_file.h>
|
|
|
|
|
|
#include <asm/sbi.h>
|
|
|
#include <asm/tlbflush.h>
|
|
|
#include <asm/cacheflush.h>
|
|
|
|
|
|
-/* A collection of single bit ipi messages. */
|
|
|
-static struct {
|
|
|
- unsigned long bits ____cacheline_aligned;
|
|
|
-} ipi_data[NR_CPUS] __cacheline_aligned;
|
|
|
-
|
|
|
enum ipi_message_type {
|
|
|
IPI_RESCHEDULE,
|
|
|
IPI_CALL_FUNC,
|
|
|
IPI_MAX
|
|
|
};
|
|
|
|
|
|
+/* A collection of single bit ipi messages. */
|
|
|
+static struct {
|
|
|
+ unsigned long stats[IPI_MAX] ____cacheline_aligned;
|
|
|
+ unsigned long bits ____cacheline_aligned;
|
|
|
+} ipi_data[NR_CPUS] __cacheline_aligned;
|
|
|
+
|
|
|
int riscv_hartid_to_cpuid(int hartid)
|
|
|
{
|
|
|
int i = -1;
|
|
@@ -67,6 +69,7 @@ int setup_profiling_timer(unsigned int multiplier)
|
|
|
void riscv_software_interrupt(void)
|
|
|
{
|
|
|
unsigned long *pending_ipis = &ipi_data[smp_processor_id()].bits;
|
|
|
+ unsigned long *stats = ipi_data[smp_processor_id()].stats;
|
|
|
|
|
|
/* Clear pending IPI */
|
|
|
csr_clear(sip, SIE_SSIE);
|
|
@@ -81,11 +84,15 @@ void riscv_software_interrupt(void)
|
|
|
if (ops == 0)
|
|
|
return;
|
|
|
|
|
|
- if (ops & (1 << IPI_RESCHEDULE))
|
|
|
+ if (ops & (1 << IPI_RESCHEDULE)) {
|
|
|
+ stats[IPI_RESCHEDULE]++;
|
|
|
scheduler_ipi();
|
|
|
+ }
|
|
|
|
|
|
- if (ops & (1 << IPI_CALL_FUNC))
|
|
|
+ if (ops & (1 << IPI_CALL_FUNC)) {
|
|
|
+ stats[IPI_CALL_FUNC]++;
|
|
|
generic_smp_call_function_interrupt();
|
|
|
+ }
|
|
|
|
|
|
BUG_ON((ops >> IPI_MAX) != 0);
|
|
|
|
|
@@ -111,6 +118,24 @@ send_ipi_message(const struct cpumask *to_whom, enum ipi_message_type operation)
|
|
|
sbi_send_ipi(cpumask_bits(&hartid_mask));
|
|
|
}
|
|
|
|
|
|
+static const char * const ipi_names[] = {
|
|
|
+ [IPI_RESCHEDULE] = "Rescheduling interrupts",
|
|
|
+ [IPI_CALL_FUNC] = "Function call interrupts",
|
|
|
+};
|
|
|
+
|
|
|
+void show_ipi_stats(struct seq_file *p, int prec)
|
|
|
+{
|
|
|
+ unsigned int cpu, i;
|
|
|
+
|
|
|
+ for (i = 0; i < IPI_MAX; i++) {
|
|
|
+ seq_printf(p, "%*s%u:%s", prec - 1, "IPI", i,
|
|
|
+ prec >= 4 ? " " : "");
|
|
|
+ for_each_online_cpu(cpu)
|
|
|
+ seq_printf(p, "%10lu ", ipi_data[cpu].stats[i]);
|
|
|
+ seq_printf(p, " %s\n", ipi_names[i]);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
void arch_send_call_function_ipi_mask(struct cpumask *mask)
|
|
|
{
|
|
|
send_ipi_message(mask, IPI_CALL_FUNC);
|