Re: Kernel warning from latest 2.6.28-gitX

From: Bartlomiej Zolnierkiewicz
Date: Sun Jan 04 2009 - 10:15:21 EST


On Sunday 04 January 2009, Grissiom wrote:
> Yes, maybe I have the same problem, here is a snippet of dmesg:
>
> [ 0.728735] Probing IDE interface ide0...
> [ 1.430414] hda: HL-DT-ST DVD+/-RW GSA-T11N, ATAPI CD/DVD-ROM drive
> [ 1.760120] hda: host max PIO4 wanted PIO255(auto-tune) selected
> PIO4
> [ 1.760946] hda: UDMA/33 mode selected
> [ 1.773525] ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
> [ 1.789149] ide-cd driver 5.00
> [ 1.802700] ide-cd: hda: ATAPI 24X DVD-ROM DVD-R CD-R/RW drive,
> 2048kB Cache
> [ 1.814860] Uniform CD-ROM driver Revision: 3.20
> [ 1.828677] ------------[ cut here ]------------
> [ 1.831992] WARNING: at kernel/lockdep.c:2197
> trace_hardirqs_on_caller+0x134/0x1a0()
> [ 1.831992] Hardware name: Inspiron 1501
> [ 1.831992] Modules linked in:
> [ 1.831992] Pid: 0, comm: swapper Not tainted
> 2.6.28-g14-rfkill-nophy-ledon-05692-g7d3b56b #57
> [ 1.831992] Call Trace:
> [ 1.831992] [<c012a049>] warn_slowpath+0x99/0xc0
> [ 1.831992] [<c0140030>] posix_cpu_timer_set+0x3e0/0x410
> [ 1.831992] [<c0104f5a>] dump_trace+0x6a/0xb0
> [ 1.831992] [<c014e83a>] validate_chain+0x41a/0x11a0
> [ 1.831992] [<c014f853>] __lock_acquire+0x293/0xa20
> [ 1.831992] [<c014f853>] __lock_acquire+0x293/0xa20
> [ 1.831992] [<c014e83a>] validate_chain+0x41a/0x11a0
> [ 1.831992] [<c014e83a>] validate_chain+0x41a/0x11a0
> [ 1.831992] [<c04d7de0>] _spin_unlock_irq+0x20/0x40
> [ 1.831992] [<c014dc84>] trace_hardirqs_on_caller+0x134/0x1a0
> [ 1.831992] [<c04d7de0>] _spin_unlock_irq+0x20/0x40
> [ 1.831992] [<c0322280>] do_ide_request+0x40/0x570
> [ 1.831992] [<c014f853>] __lock_acquire+0x293/0xa20
> [ 1.831992] [<c04d7a4b>] _spin_lock_irqsave+0x4b/0x60
> [ 1.831992] [<c0254435>] blk_start_queueing+0x15/0x30
> [ 1.831992] [<c03219ea>] ide_do_drive_cmd+0x4a/0x70
> [ 1.831992] [<c032d4c6>] cdrom_decode_status+0x116/0x380
> [ 1.831992] [<c032dd40>] cdrom_newpc_intr+0x0/0x680
> [ 1.831992] [<c032dd83>] cdrom_newpc_intr+0x43/0x680
> [ 1.831992] [<c032dd40>] cdrom_newpc_intr+0x0/0x680
> [ 1.831992] [<c0321b94>] ide_intr+0x134/0x1b0
> [ 1.831992] [<c01696b0>] handle_IRQ_event+0x20/0x50
> [ 1.831992] [<c016b365>] handle_edge_irq+0xb5/0x120
> [ 1.831992] [<c0104dc8>] do_IRQ+0x48/0x90
> [ 1.831992] [<c02688a4>] trace_hardirqs_off_thunk+0xc/0x18
> [ 1.831992] [<c01039ac>] common_interrupt+0x2c/0x34
> [ 1.831992] [<c01091ed>] default_idle+0x3d/0x60
> [ 1.831992] [<c01093f3>] c1e_idle+0x93/0x110
> [ 1.831992] [<c0101c8b>] cpu_idle+0x6b/0xd0
> [ 1.831992] ---[ end trace 5a56406b278561cb ]---
> [ 2.204724] Driver 'sd' needs updating - please use bus_type methods

Thanks for catching it, please try the patch below:

From: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>
Subject: [PATCH] ide: fix LOCKDEP warning

commit 295f00042aaf6b553b5f37348f89bab463d4a469 ("ide: don't execute
the next queued command from the hard-IRQ context") overlooked that
ide_do_drive_cmd() (used for REQUEST SENSE command handling) may still
invoke do_ide_request() (->request_fn) in the hard-IRQ context through
blk_start_queueing(). This resulted in a LOCKDEP warning after commit
b599bc7a1199419e122cb2e9ec6b0fa2cfbbc17b ("ide: use per-device request
queue locks (v2)").

Since calling blk_start_queuing() in ide_do_drive_cmd() doesn't make
much sense as the port is already marked as busy (so the execution of
the new command will be deferred anyway) then just remove it fixing
LOCKDEP warning and saving some CPU cycles at the same time.

Reported-by: Larry Finger <Larry.Finger@xxxxxxxxxxxx>
Reported-by: Grissiom <chaos.proton@xxxxxxxxx>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>
---
drivers/ide/ide-io.c | 1 -
1 file changed, 1 deletion(-)

Index: b/drivers/ide/ide-io.c
===================================================================
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -1197,7 +1197,6 @@ void ide_do_drive_cmd(ide_drive_t *drive

spin_lock_irqsave(q->queue_lock, flags);
__elv_add_request(q, rq, ELEVATOR_INSERT_FRONT, 0);
- blk_start_queueing(q);
spin_unlock_irqrestore(q->queue_lock, flags);
}
EXPORT_SYMBOL(ide_do_drive_cmd);

¢éì®&Þ~º&¶¬–+-±éÝ¥Šw®žË±Êâmébžìdz¹Þ)í…æèw*jg¬±¨¶‰šŽŠÝj/êäz¹ÞŠà2ŠÞ¨è­Ú&¢)ß«a¶Úþø®G«éh®æj:+v‰¨Šwè†Ù>Wš±êÞiÛaxPjØm¶Ÿÿà -»+ƒùdš_