Re: [PATCH v6.4-rc5-rt4] rt: vmd: make cfg_lock a raw spinlock

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

 



On Thu, 8 Jun 2023 21:20:04 -0300
"Luis Claudio R. Goncalves" <lgoncalv@xxxxxxxxxx> wrote:

> Sebastian, Steven,
> 
> I don't know if this is the best solution for the problem, but surely the
> simplest one. If this patch makes sense, it could probably go upstream as
> the changes only affect RT.
> 
> -------
> 
> rt: vmd: make cfg_lock a raw spinlock
> 
> This call sequence triggers the backtrace listed below:
> 
>     pci_user_read_config_dword()  --->  vmd_pci_read()

Since pci_user_read_config_dword() (and all other sizes) uses
raw_spin_lock(), I guess there's really no other choice than to have
vmd_pci_read() do the same.

-- Steve


> 
> The first function, pci_user_read_config_dword(), takes a raw_spin_lock
> (a classic spin lock) and disables preemption and interrupts. Then
> vmd_pci_read() takes a RT spinlock (a rtmutex), which can sleep, hence
> the complaint about a sleeping function being called from atomic context.
> 
> 
> [  168.466387] LTP: starting read_all_proc (read_all -d /proc -q -r 3)
> [  168.614389] BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
> [  168.614393] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 10268, name: read_all
> [  168.614395] preempt_count: 1, expected: 0
> [  168.614396] RCU nest depth: 0, expected: 0
> [  168.614397] INFO: lockdep is turned off.
> [  168.614398] irq event stamp: 0
> [  168.614398] hardirqs last  enabled at (0): [<0000000000000000>] 0x0
> [  168.614402] hardirqs last disabled at (0): [<ffffffffa4b0f3bf>] copy_process+0x80f/0x1990
> [  168.614411] softirqs last  enabled at (0): [<ffffffffa4b0f3bf>] copy_process+0x80f/0x1990
> [  168.614414] softirqs last disabled at (0): [<0000000000000000>] 0x0
> [  168.614415] Preemption disabled at:
> [  168.614416] [<0000000000000000>] 0x0
> [  168.614418] CPU: 19 PID: 10268 Comm: read_all Tainted: G        W          6.4.0-rc5-rt4 #2
> [  168.614421] Hardware name: Dell Inc. Precision 7820 Tower/0804P1, BIOS 2.6.3 05/04/2020
> [  168.614422] Call Trace:
> [  168.614424]  <TASK>
> [  168.614425]  dump_stack_lvl+0x47/0x80
> [  168.614433]  __might_resched+0x19b/0x250
> [  168.614441]  rt_spin_lock+0x4c/0x100
> [  168.614446]  ? vmd_pci_read+0x85/0xf0
> [  168.614453]  vmd_pci_read+0x85/0xf0
> [  168.614456]  pci_user_read_config_dword+0x78/0x100



[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