- 论坛徽章:
- 3
|
回复 10# blake326
blake326兄,感谢你一直帮我分析问题,我昨天到现在拷机重现问题了,发现真的是死锁的问题
before lock disk:sda
===>appand sda[256] to list
before get_disk_name hostno:258
sdd: sdd1 sdd2 sdd3 sdd4
INFO: rcu_sched_state detected stalls on CPUs/tasks: { 1} (detected by 0, t=6002 jiffies)
Backtrace for cpu 0 (current):
Backtrace:
我之前说漏点东西 我在ata_scsi_rw_xlat函数里也有使用scsi_head_lock这个spin_lock
printk(KERN_NOTICE "before lock disk:%s\n",stmp->diskname);
spin_lock(&scsi_head_lock);
appand_to_list(SN_DISK_MAP, &scsi_disk_head, stmp);
printk(KERN_NOTICE "===>appand %s[%d] to list\n", stmp->diskname, stmp->portnum);
spin_unlock(&scsi_head_lock);
printk(KERN_NOTICE "after lock disk:%s\n",stmp->diskname);
只打印了before lock disk没有after lock disk 然后是在ata_scsi_rw_xlat函数里发现锁没有解开就死锁了
分析了一下printk发现他在开始的时候
preempt_disable();
/* This stops the holder of console_sem just where we want him */
raw_local_irq_save(flags);
结束的时候
raw_local_irq_restore(flags);
preempt_enable();
有关中断 禁止抢占 然后再开启中断、抢占
可是spin_lock已经禁止抢占了 就算printk先preempt_disable(),再preempt_enable();应该也是在禁止抢占的状态。难道真的是中断引起了调度
我看了一下ata_scsi_rw_xlat这个函数,真没发现有在中断上下文中调用
|
|