Re: v5.19-rc2-rt3: nouveau might sleep splat

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

 



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@xxxxxx>
> ---
>  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



[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