Skip to content

Commit 50f2b98

Browse files
FlyGoattsbogend
authored andcommitted
MIPS: cevt-r4k: Don't call get_c0_compare_int if timer irq is installed
This avoids warning: [ 0.118053] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:283 Caused by get_c0_compare_int on secondary CPU. We also skipped saving IRQ number to struct clock_event_device *cd as it's never used by clockevent core, as per comments it's only meant for "non CPU local devices". Reported-by: Serge Semin <[email protected]> Closes: https://lore.kernel.org/linux-mips/6szkkqxpsw26zajwysdrwplpjvhl5abpnmxgu2xuj3dkzjnvsf@4daqrz4mf44k/ Signed-off-by: Jiaxun Yang <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Serge Semin <[email protected]> Tested-by: Serge Semin <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent 1cb6ab4 commit 50f2b98

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

arch/mips/kernel/cevt-r4k.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -303,13 +303,6 @@ int r4k_clockevent_init(void)
303303
if (!c0_compare_int_usable())
304304
return -ENXIO;
305305

306-
/*
307-
* With vectored interrupts things are getting platform specific.
308-
* get_c0_compare_int is a hook to allow a platform to return the
309-
* interrupt number of its liking.
310-
*/
311-
irq = get_c0_compare_int();
312-
313306
cd = &per_cpu(mips_clockevent_device, cpu);
314307

315308
cd->name = "MIPS";
@@ -320,7 +313,6 @@ int r4k_clockevent_init(void)
320313
min_delta = calculate_min_delta();
321314

322315
cd->rating = 300;
323-
cd->irq = irq;
324316
cd->cpumask = cpumask_of(cpu);
325317
cd->set_next_event = mips_next_event;
326318
cd->event_handler = mips_event_handler;
@@ -332,6 +324,13 @@ int r4k_clockevent_init(void)
332324

333325
cp0_timer_irq_installed = 1;
334326

327+
/*
328+
* With vectored interrupts things are getting platform specific.
329+
* get_c0_compare_int is a hook to allow a platform to return the
330+
* interrupt number of its liking.
331+
*/
332+
irq = get_c0_compare_int();
333+
335334
if (request_irq(irq, c0_compare_interrupt, flags, "timer",
336335
c0_compare_interrupt))
337336
pr_err("Failed to request irq %d (timer)\n", irq);

0 commit comments

Comments
 (0)