Hardware - Raspberry pi 4 Model B 8GB OS - Raspberry pi OS Buster(10)(2020-05-27-raspios-buster-full-armhf.img)(linux kerenl 4.19.y)
I added rpi_get_interrupt_info() and modified show_interrupts() in proc.c
Full code for rpi_get_interrupt_info() and show_interrupts()
void rpi_get_interrupt_info(struct irqaction *action_p)
{
unsigned int irq_num = action_p->irq;
void *irq_handler = NULL;
if (action_p->handler) {
irq_handler = (void*)action_p->handler;
}
if (irq_handler) {
trace_printk("[%s] %d: %s, irq_handler: %pS \n",
current->comm, irq_num, action_p->name, irq_handler);
}
}
int show_interrupts(struct seq_file *p, void *v)
{
static int prec;
unsigned long flags, any_count = 0;
int i = *(loff_t *) v, j;
struct irqaction *action;
struct irq_desc *desc;
if (i > ACTUAL_NR_IRQS)
return 0;
if (i == ACTUAL_NR_IRQS)
return arch_show_interrupts(p, prec);
/* print header and calculate the width of the first column */
if (i == 0) {
for (prec = 3, j = 1000; prec < 10 && j <= nr_irqs; ++prec)
j *= 10;
seq_printf(p, "%*s", prec + 8, "");
for_each_online_cpu(j)
seq_printf(p, "CPU%-8d", j);
seq_putc(p, '\n');
}
rcu_read_lock();
desc = irq_to_desc(i);
if (!desc)
goto outsparse;
if (desc->kstat_irqs)
for_each_online_cpu(j)
any_count |= *per_cpu_ptr(desc->kstat_irqs, j);
if ((!desc->action || irq_desc_is_chained(desc)) && !any_count)
goto outsparse;
seq_printf(p, "%*d: ", prec, i);
for_each_online_cpu(j)
seq_printf(p, "%10u ", desc->kstat_irqs ?
*per_cpu_ptr(desc->kstat_irqs, j) : 0);
raw_spin_lock_irqsave(&desc->lock, flags);
if (desc->irq_data.chip) {
if (desc->irq_data.chip->irq_print_chip)
desc->irq_data.chip->irq_print_chip(&desc->irq_data, p);
else if (desc->irq_data.chip->name)
seq_printf(p, " %8s", desc->irq_data.chip->name);
else
seq_printf(p, " %8s", "-");
} else {
seq_printf(p, " %8s", "None");
}
if (desc->irq_data.domain)
seq_printf(p, " %*d", prec, (int) desc->irq_data.hwirq);
else
seq_printf(p, " %*s", prec, "");
#ifdef CONFIG_GENERIC_IRQ_SHOW_LEVEL
seq_printf(p, " %-8s", irqd_is_level_type(&desc->irq_data) ? "Level" : "Edge");
#endif
if (desc->name)
seq_printf(p, "-%-8s", desc->name);
action = desc->action;
if (action)
rpi_get_interrupt_info(action);
if (action) {
seq_printf(p, " %s", action->name);
while ((action = action->next) != NULL)
seq_printf(p, ", %s", action->name);
}
seq_putc(p, '\n');
raw_spin_unlock_irqrestore(&desc->lock, flags);
outsparse:
rcu_read_unlock();
return 0;
}
#endif
Code that I changed
void rpi_get_interrupt_info(struct irqaction *action_p)
{
unsigned int irq_num = action_p->irq;
void *irq_handler = NULL;
if (action_p->handler) {
irq_handler = (void*)action_p->handler;
}
if (irq_handler) {
trace_printk("[%s] %d: %s, irq_handler: %pS \n",
current->comm, irq_num, action_p->name, irq_handler);
}
}
....
if (action)
rpi_get_interrupt_info(action);
When I try
echo rpi_get_interrupt_info > /sys/kernel/debug/tracing/set_ftrace_filter
,
an error occurs:
echo: write error: Invalid argument
So I looked /sys/kernel/debug/tracing/available_filter_functions, and there's no rpi_get_interrupt_info
I tried noinline void rpi_get_interrupt_info(struct irqaction *action_p)
, but it doesn't work.
Sorry, I was making some mistakes in configureing bcm2711_defconfig file. Thanks for everyone for trying to help me:)