From: Laurentiu-Cristian Duca <laurentiu.duca@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-rt-users@vger.kernel.org
Subject: Re: kernel panic in SPI rt driver interrupt
Date: Mon, 17 Feb 2020 20:15:43 +0200 [thread overview]
Message-ID: <CAPm8-H5uS-1TFPj_OZZe=tFuFya-RaW2_a_Ehfu4eFsd0D4xYw@mail.gmail.com> (raw)
In-Reply-To: <87pnednl5b.fsf@nanos.tec.linutronix.de>
Hi,
Please tell me
what alternatives exists to replace wake_up/wait_event ?
Thank you very much
On 2/17/20, Thomas Gleixner <tglx@linutronix.de> wrote:
> Laurentiu-Cristian Duca <laurentiu.duca@gmail.com> 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
>
next prev parent reply other threads:[~2020-02-17 18:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-17 16:24 kernel panic in SPI rt driver interrupt Laurentiu-Cristian Duca
2020-02-17 18:06 ` Thomas Gleixner
2020-02-17 18:15 ` Laurentiu-Cristian Duca [this message]
2020-02-17 18:33 ` Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPm8-H5uS-1TFPj_OZZe=tFuFya-RaW2_a_Ehfu4eFsd0D4xYw@mail.gmail.com' \
--to=laurentiu.duca@gmail.com \
--cc=linux-rt-users@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).