Skip to contentSkip to conversation

Fix percpu interrupt allocation in mmtimer code

PATCH In review Dimitri Sivanich 3 participants 4 messages Mar 15, 2006 – Mar 16, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix percpu interrupt allocation in mmtimer code

The timer interrupt in the mmtimer code needs to be allocated as a percpu interrupt for acceptable performance on larger systems.

The code needs to be updated to set this up properly, as the SA_PERCPU_IRQ flag to request_interrupt is not supported.

Index: linux/arch/ia64/kernel/irq_ia64.c
=================================--- linux.orig/arch/ia64/kernel/irq_ia64.c 2006-03-14 14:52:39.735003644 -0600
+++ linux/arch/ia64/kernel/irq_ia64.c 2006-03-14 14:53:20.219310264 -0600
@@ -239,6 +239,7 @@ register_percpu_irq (ia64_vector vec, st
setup_irq(irq, action);
}
}
+EXPORT_SYMBOL(register_percpu_irq);

void __init
init_IRQ (void)
Index: linux/drivers/char/mmtimer.c
=================================--- linux.orig/drivers/char/mmtimer.c 2006-03-14 14:52:39.736956577 -0600
+++ linux/drivers/char/mmtimer.c 2006-03-14 15:59:04.662279315 -0600
@@ -59,6 +59,8 @@ static int mmtimer_ioctl(struct inode *i
unsigned int cmd, unsigned long arg);
static int mmtimer_mmap(struct file *file, struct vm_area_struct *vma);

+static irqreturn_t mmtimer_interrupt(int irq, void *dev_id, struct pt_regs *regs); +
/*
* Period in femtoseconds (10^-15 s)
*/
@@ -70,6 +72,12 @@ static struct file_operations mmtimer_fo
.ioctl = mmtimer_ioctl,
};

+static struct irqaction mmt_irqaction = {
+ .handler = mmtimer_interrupt,
+ .flags = SA_INTERRUPT,
+ .name = MMTIMER_NAME
+};
+
/*
* We only have comparison registers RTC1-4 currently available per
* node. RTC0 is used by SAL.
@@ -689,11 +697,7 @@ static int __init mmtimer_init(void)
mmtimer_femtoperiod = ((unsigned long)1E15 + sn_rtc_cycles_per_second /
2) / sn_rtc_cycles_per_second;

- if (request_irq(SGI_MMTIMER_VECTOR, mmtimer_interrupt, SA_PERCPU_IRQ, MMTIMER_NAME, NULL)) {
- printk(KERN_WARNING "%s: unable to allocate interrupt.",
- MMTIMER_NAME);
- return -1;
- }
+ register_percpu_irq(SGI_MMTIMER_VECTOR, &mmt_irqaction);

strcpy(mmtimer_miscdev.devfs_name, MMTIMER_NAME); if (misc_register(&mmtimer_miscdev)) {

#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Dimitri" = Dimitri Sivanich <[email protected]> writes:

Dimitri> The timer interrupt in the mmtimer code needs to be allocated Dimitri> as a percpu interrupt for acceptable performance on larger Dimitri> systems.

Dimitri> The code needs to be updated to set this up properly, as the Dimitri> SA_PERCPU_IRQ flag to request_interrupt is not supported.

Dimitri> +EXPORT_SYMBOL(register_percpu_irq);

Hi Dimitri,

EXPORT_SYMBOL_GPL() please.

Dimitri> +static irqreturn_t mmtimer_interrupt(int irq, void *dev_id, struct pt_regs *regs); Dimitri> +

The prototype needs to go into a header file, it shouldn't be declared in mmtimer.c. Also please make sure it doesn't exceed the 80 column limit.

Cheers,
Jes

#2 lore raw
In reply to Dimitri Sivanich
Quoted 5 lines · Dimitri Sivanich

The timer interrupt in the mmtimer code needs to be allocated as a percpu interrupt for acceptable performance on larger systems.

The code needs to be updated to set this up properly, as the SA_PERCPU_IRQ flag to request_interrupt is not supported.

Rather than letting the driver poke into irq code internals I'd suggest you fux the request_irq code to properly support SA_PERCPU_IRQ.

#3 lore raw
In reply to Dimitri Sivanich
Quoted 2 lines · Christoph Hellwig

Rather than letting the driver poke into irq code internals I'd suggest you fux the request_irq code to properly support SA_PERCPU_IRQ.

Good suggestion. I'll make the appropriate changes.