On 2024-06-05 10:47:16 [+0800], miaon wrote: > Hello linux-rt, Hi, > This has a null pointer bug. … > > Can you help confirm the reason? > Thanks! no, but we could start with |[ 1.884903] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:974 |[ 1.884907] in_atomic(): 1, irqs_disabled(): 128, pid: 1, name: swapper/0 |[ 1.884911] 6 locks held by swapper/0/1: |[ 1.884914] #0: (&dev->mutex){....}, at: [< (ptrval)>] __driver_attach+0x64/0x118 |[ 1.884940] #1: (&dev->mutex){....}, at: [< (ptrval)>] __driver_attach+0x70/0x118 |[ 1.884955] #2: (&desc->request_mutex){+.+.}, at: [< (ptrval)>] __setup_irq+0xdc/0x7f8 |[ 1.884974] #3: (&irq_desc_lock_class){....}, at: [< (ptrval)>] __setup_irq+0x100/0x7f8 |[ 1.884988] #4: (rcu_read_lock){....}, at: [< (ptrval)>] rt_spin_lock+0x0/0xf0 |[ 1.885005] #5: (&picinfo->lock){....}, at: [< (ptrval)>] tcc_pic_set_polarity+0x8c/0x158 |[ 1.885023] irq event stamp: 288040 |[ 1.885028] hardirqs last enabled at (288039): [< (ptrval)>] _raw_spin_unlock_irqrestore+0x5c/0x98 |[ 1.885033] hardirqs last disabled at (288040): [< (ptrval)>] _raw_spin_lock_irqsave+0x24/0xb0 |[ 1.885040] softirqs last enabled at (0): [< (ptrval)>] copy_process.isra.9.part.10+0x430/0x1978 |[ 1.885044] softirqs last disabled at (0): [< (null)>] (null) |[ 1.885046] Preemption disabled at: |[ 1.885052] [< (ptrval)>] __setup_irq+0x100/0x7f8 |[ 1.885061] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.14.202-tcc #1 |[ 1.885064] Hardware name: Telechips TCC8031 Evaluation Board (DT) |[ 1.885067] Call trace: |[ 1.885073] dump_backtrace+0x0/0x1d8 |[ 1.885078] show_stack+0x14/0x20 |[ 1.885084] dump_stack+0xb8/0xf0 |[ 1.885089] ___might_sleep+0x178/0x210 |[ 1.885093] rt_spin_lock+0xa4/0xf0 |[ 1.885098] tcc_pic_set_polarity+0x8c/0x158 |[ 1.885103] tcc_irq_set_polarity+0x20/0x30 |[ 1.885112] gic_set_type+0x84/0x98 |[ 1.885117] __irq_set_trigger+0x5c/0x1e0 this is out-of-tree. The lock used in tcc_pic_set_polarity() should be raw_spinlock_t. This makes the warning go away. Sebastian