Re: kernel panic in SPI rt driver interrupt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Laurentiu-Cristian Duca <laurentiu.duca@xxxxxxxxx> writes:
>   I am an open source enthusiast and
>   I have written a driver for Texas Instruments omap4 mcspi
>   beaglebone black open source board, linux preempt_rt kernel 5.4.5-rt3.
>   I have the following problem (if you want all the code
>   I will post it, it is gpl open source):
>
> - in the interrupt I do
> 	mcspi->interrupt_done = 1;
> 	wake_up_interruptible(&mcspi->wq);
>
> - in the transfer function I do
> 	/* Enable interrupts last. */
> 	mcspi->interrupt_done = 0;
> 	l = OMAP2_MCSPI_IRQENABLE_TX0_EMPTY |
> 			OMAP2_MCSPI_IRQENABLE_RX0_FULL;
> 	mcspi_write_reg(mcspi->master, OMAP2_MCSPI_IRQENABLE, l);
>
> 	/* TX_EMPTY will be raised only after SPI data is sent */
> 	mcspi_wr_fifo(mcspi);
>
> 	/* wait for transfer completion */
> 	wait_event_interruptible(mcspi->wq, (mcspi->interrupt_done > 0));
>
> - I try to make one million small SPI transfers (8 bytes per transfer),
> but after about 10000 transfers I get kernel oops and then panic

Not a surprise.

> [  166.994607] 000: PC is at rt_spin_lock_slowlock_locked+0x268/0x304
> [  167.391044] 000: [<c0909e40>] (rt_spin_lock_slowlock_locked) from [<c0909f30>] (rt_spin_lock_slowlock+0x54/0x7c)
> [  167.401265] 000: [<c0909f30>] (rt_spin_lock_slowlock) from [<c01891bc>] (__wake_up_common_lock+0x58/0xa8)
> [  167.410882] 000: [<c01891bc>] (__wake_up_common_lock) from [<c0189220>] (__wake_up+0x14/0x1c)
> [  167.419445] 000: [<c0189220>] (__wake_up) from [<bf00056c>] (omap2_mcspi_irq_handler_rt+0xa4/0x118 [spi_omap2_mcspi])
> [  167.430114] 000: [<bf00056c>] (omap2_mcspi_irq_handler_rt [spi_omap2_mcspi]) from [<c019dfa0>]
> (__handle_irq_event_percpu+0x50/0x2c4) [  167.442181] 000: [<c019dfa0>] (__handle_irq_event_percpu) from
> [<c019e280>] (handle_irq_event_percpu+0x6c/0xc4) [  167.452315] 000: [<c019e280>] (handle_irq_event_percpu) from
> [<c019e344>] (handle_irq_event+0x6c/0xb0) [  167.461663] 000: [<c019e344>] (handle_irq_event) from [<c01a28b0>]
> (handle_level_irq+0xdc/0x1bc) [  167.470491] 000: [<c01a28b0>] (handle_level_irq) from [<c019d0dc>]
> (generic_handle_irq+0x20/0x34) [  167.479403] 000: [<c019d0dc>] (generic_handle_irq) from

You're using a interrupt with IRQF_NO_THREAD and call into a function
which is not safe to use from hard interrupt context on RT
i.e. wake_up(). Remove IRQF_NO_THREAD and your problem goes away.

Thanks,

        tglx



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux