kernel_optimize_test/drivers/ide
Ingo Molnar 3d1c1cc962 [PATCH] fix IDE deadlock in error reporting code
Michal Piotrowski reported the following validator assert:

 hdd: set_drive_speed_status: status=0x51 { DriveReady SeekComplete Error }
 hdd: set_drive_speed_status: error=0xb4 { AbortedCommand LastFailedSense=0x0b }

 ============================
 [ BUG: illegal lock usage! ]
 ----------------------------
 illegal {in-hardirq-W} -> {hardirq-on-W} usage.
 hdparm/1821 [HC0[0]:SC0[0]:HE1:SE1] takes:
  (ide_lock){++..}, at: [<c0268388>] ide_dump_opcode+0x13/0x9b

 [...]

 stack backtrace:
  [<c0104513>] show_trace+0x1b/0x20
  [<c01045f1>] dump_stack+0x1f/0x24
  [<c013976c>] print_usage_bug+0x1a5/0x1b1
  [<c0139e90>] mark_lock+0x2ca/0x4f7
  [<c013aa96>] __lockdep_acquire+0x47e/0xaa4
  [<c013b536>] lockdep_acquire+0x67/0x7f
  [<c030552d>] _spin_lock+0x24/0x32
  [<c0268388>] ide_dump_opcode+0x13/0x9b
  [<c02688b6>] ide_dump_status+0x4a6/0x4cc
  [<c0267ae6>] ide_config_drive_speed+0x32a/0x33a
  [<c0262dc5>] piix_tune_chipset+0x2ed/0x2f8
  [<c0262e31>] piix_config_drive_xfer_rate+0x61/0xb5
  [<c0263a82>] set_using_dma+0x2f/0x60
  [<c0263bee>] ide_write_setting+0x4a/0xc3
  [<c02647ca>] generic_ide_ioctl+0x8a/0x47f
  [<f886003a>] idecd_ioctl+0xfd/0x133 [ide_cd]
  [<c01f1fff>] blkdev_driver_ioctl+0x4b/0x5f
  [<c01f2783>] blkdev_ioctl+0x770/0x7bd
  [<c017dc0d>] block_ioctl+0x1f/0x21
  [<c0189353>] do_ioctl+0x27/0x6e
  [<c0189604>] vfs_ioctl+0x26a/0x280
  [<c0189667>] sys_ioctl+0x4d/0x7e
  [<c0305ed2>] sysenter_past_esp+0x63/0xa1

in ide_dump_opcode() takes the ide_lock in an irq-unsafe manner, i.e.  this
function expects to be called with irqs disabled.  But
ide_dump_ata[pi]_status() doesnt do that - it enables interrupts specifically.
 That is a no-no - what guarantees that another IDE port couldnt generate an
IDE interrupt while we are dumping this error?  The fix is to turn the
irq-enabling in these functions into irq-disabling.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Michal Piotrowski <michal.k.k.piotrowski@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-26 09:58:28 -07:00
..
arm
cris
h8300
legacy [PATCH] m68k: completely initialize hw_regs_t in ide_setup_ports 2006-06-23 07:43:00 -07:00
mips
pci [PATCH] ide: pdc202xx_old: remove the obsolete busproc 2006-06-26 09:58:28 -07:00
ppc [PATCH] powerpc: Fix ide-pmac sysfs entry 2006-05-21 12:59:16 -07:00
ide-cd.c [PATCH] IDE CD end-of media error fix 2006-06-25 10:01:06 -07:00
ide-cd.h
ide-disk.c [PATCH] LED: Add IDE disk activity LED trigger 2006-03-31 12:18:57 -08:00
ide-dma.c [PATCH] More BUG_ON conversion 2006-06-23 07:43:08 -07:00
ide-floppy.c [PATCH] ide-floppy: fix debug-only syntax error 2006-06-25 10:01:20 -07:00
ide-generic.c
ide-io.c [PATCH] ide-io: increase timeout value to allow for slave wakeup 2006-06-26 09:58:27 -07:00
ide-iops.c [PATCH] More BUG_ON conversion 2006-06-23 07:43:08 -07:00
ide-lib.c [PATCH] fix IDE deadlock in error reporting code 2006-06-26 09:58:28 -07:00
ide-pnp.c
ide-probe.c [SPARC]: Kill __irq_itoa(). 2006-06-20 01:21:29 -07:00
ide-proc.c
ide-tape.c [PATCH] idetape gcc 4.1 warning fix 2006-06-25 10:01:05 -07:00
ide-taskfile.c [PATCH] More BUG_ON conversion 2006-06-23 07:43:08 -07:00
ide-timing.h [PATCH] ide: actually honor drive's minimum PIO/DMA cycle times 2006-06-26 09:58:27 -07:00
ide.c [PATCH] Get rid of struct request request_pm_state member 2006-06-23 17:10:39 +02:00
Kconfig
Makefile
setup-pci.c [SPARC]: Kill __irq_itoa(). 2006-06-20 01:21:29 -07:00