From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Mike Galbraith <efault@gmx.de>
Cc: John Ogness <john.ogness@linutronix.de>,
RT <linux-rt-users@vger.kernel.org>
Subject: Re: v5.19-rc2-rt3: nouveau might sleep splat
Date: Mon, 25 Jul 2022 10:15:09 +0200 [thread overview]
Message-ID: <Yt5RDajSVTPqahV4@linutronix.de> (raw)
In-Reply-To: <daf9b4678af9a121ba85f30b04f1335b44639433.camel@gmx.de>
On 2022-07-21 15:06:45 [+0200], Mike Galbraith wrote:
> That's in tip, but pulling my bandaid off...
>
> [ 3.903338] BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:46
> [ 3.903340] in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 389, name: systemd-udevd
> [ 3.903340] preempt_count: 0, expected: 0
> [ 3.903341] RCU nest depth: 1, expected: 1
> [ 3.903342] CPU: 0 PID: 389 Comm: systemd-udevd Tainted: G E 5.19.0.g96ff3a1-tip-rt #8 3a0ec7519629dbce1c881d809a8600cfad8358ca
> [ 3.903344] Hardware name: MEDION MS-7848/MS-7848, BIOS M7848W08.20C 09/23/2013
> [ 3.903345] Call Trace:
> [ 3.903346] <TASK>
> [ 3.903347] dump_stack_lvl+0x44/0x5c
> [ 3.903352] ? migrate_disable+0x37/0xa0
> [ 3.903354] __might_resched+0x171/0x1c0
> [ 3.903357] rt_spin_lock+0x2d/0x70
> [ 3.903361] crng_make_state+0x80/0x1d0
> [ 3.903364] _get_random_bytes.part.15+0x4e/0x120
> [ 3.903366] ? nvkm_vmm_iter.constprop.11+0x311/0x860 [nouveau 9c7d46b64ad6b15f254390d4ef3bd03268a3030d]
> [ 3.903449] ? nvkm_vmm_sparse_unref_ptes+0x80/0x80 [nouveau 9c7d46b64ad6b15f254390d4ef3bd03268a3030d]
> [ 3.903518] ? gf100_vmm_pgt_sgl+0x230/0x230 [nouveau 9c7d46b64ad6b15f254390d4ef3bd03268a3030d]
> [ 3.903588] default_pointer+0x2a0/0x2d0
> [ 3.903591] vsnprintf+0x35e/0x4c0
> [ 3.903593] ? gf100_gr_object_new+0x2b/0x70 [nouveau 9c7d46b64ad6b15f254390d4ef3bd03268a3030d]
> [ 3.903669] va_format.isra.16+0x6e/0xa0
> [ 3.903670] vsnprintf+0x35e/0x4c0
> [ 3.903673] vprintk_store+0x140/0x540
I remember asking why it is needed to disable interrupts across
vsnprintf(). John, can I take this as-it or are you sending a new batch?
> Bandaid:
>
> printk: fix RT vprintk_store() might sleep splat
>
> RT can't call vsnprintf() with IRQs disabled, so disable migration
> and move the printk_enter_irqsave() call down to where it's needed.
>
> Signed-off-by: Mike Galbraith <efault@gmx.de>
> ---
> kernel/printk/printk.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -2277,8 +2277,7 @@ int vprintk_store(int facility, int leve
> int ret = 0;
> u64 ts_nsec;
>
> - if (!printk_enter_irqsave(recursion_ptr, irqflags))
> - return 0;
> + migrate_disable();
>
> /*
> * Since the duration of printk() can vary depending on the message
> @@ -2313,6 +2312,11 @@ int vprintk_store(int facility, int leve
> if (dev_info)
> flags |= LOG_NEWLINE;
>
> + if (!printk_enter_irqsave(recursion_ptr, irqflags)) {
> + migrate_enable();
> + return 0;
> + }
> +
> if (flags & LOG_CONT) {
> prb_rec_init_wr(&r, reserve_size);
> if (prb_reserve_in_last(&e, prb, &r, caller_id, LOG_LINE_MAX)) {
> @@ -2369,6 +2373,7 @@ int vprintk_store(int facility, int leve
> ret = text_len + trunc_msg_len;
> out:
> printk_exit_irqrestore(recursion_ptr, irqflags);
> + migrate_enable();
> return ret;
> }
>
Sebastian
next prev parent reply other threads:[~2022-07-25 8:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-18 9:25 v5.19-rc2-rt3: nouveau might sleep splat Mike Galbraith
2022-06-24 8:42 ` Sebastian Andrzej Siewior
2022-06-24 9:52 ` Mike Galbraith
2022-06-24 10:18 ` Sebastian Andrzej Siewior
2022-06-24 10:19 ` Sebastian Andrzej Siewior
2022-06-24 14:30 ` John Ogness
2022-06-24 14:31 ` John Ogness
2022-06-24 14:39 ` Sebastian Andrzej Siewior
2022-06-25 3:26 ` Mike Galbraith
2022-07-21 13:06 ` Mike Galbraith
2022-07-25 8:15 ` Sebastian Andrzej Siewior [this message]
2022-07-25 9:58 ` John Ogness
2022-07-25 13:26 ` Mike Galbraith
2022-08-03 16:10 ` Petr Mladek
2022-08-05 14:23 ` John Ogness
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=Yt5RDajSVTPqahV4@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=efault@gmx.de \
--cc=john.ogness@linutronix.de \
--cc=linux-rt-users@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.