2002-02-01 14:34:19

by Axel H. Siebenwirth

[permalink] [raw]
Subject: 2.5.3 - (IDE) hda: drive not ready for command errors

Hallo,

I get these warnings/errors from my kernel. For my feeling it does
not really seem to slow down things a lot but maybe it helps for fixing
errors.

Feb 1 10:16:48 prester kernel: hda: status error: status=0x58 { DriveReady Seek
Feb 1 10:16:48 prester kernel: hda: drive not ready for command
Feb 1 10:16:48 prester kernel: task_out_intr: should not trigger
Feb 1 10:16:48 prester kernel: task_out_intr: should not trigger

and

Feb 1 15:13:55 prester kernel: hda: status timeout: status=0xd0 { Busy }
Feb 1 15:13:55 prester kernel: hda: drive not ready for command
Feb 1 15:13:55 prester kernel: ide0: reset: success

Just now I have experience some new errors, which do not directly seem to be
related to ide but seem strange to me as well. Hope it gives you some clue.

Feb 1 15:22:28 prester kernel: <ry sread (sector 0x5b1bea88) failed
Feb 1 15:22:28 prester kernel: attempt to access beyond end of device
Feb 1 15:22:28 prester kernel: 03:04: rw=0, want=764278084, limit=8377897
Feb 1 15:22:28 prester kernel: Directory sread (sector 0x5b1bea88) failed
Feb 1 15:22:28 prester kernel: attempt to access beyond end of device
Feb 1 15:22:28 prester kernel: 03:04: rw=0, want=764278084, limit=8377897
...
Feb 1 15:22:29 prester kernel: Directory sread (sector 0x7007faf) failed
Feb 1 15:22:29 prester last message repeated 15 times


Axel Siebenwirth

with the following setup:

* kernel 2.5.3

# ATA/IDE/MFM/RLL support
CONFIG_IDE=y
# IDE, ATA and ATAPI Block devices
CONFIG_BLK_DEV_IDE=y
CONFIG_BLK_DEV_IDEDISK=y
CONFIG_BLK_DEV_IDECD=m
CONFIG_IDE_TASK_IOCTL=y
# IDE chipset support/bugfixes
CONFIG_BLK_DEV_IDEPCI=y
CONFIG_IDEPCI_SHARE_IRQ=y
CONFIG_BLK_DEV_IDEDMA_PCI=y
CONFIG_IDEDMA_PCI_AUTO=y
CONFIG_BLK_DEV_IDEDMA=y
CONFIG_IDEDMA_AUTO=y
CONFIG_BLK_DEV_IDE_MODES=y

name value min max mode
---- ----- --- --- ----
acoustic 0 0 254 rw
address 0 0 2 rw
bios_cyl 1826 0 65535 rw
bios_head 255 0 255 rw
bios_sect 63 0 63 rw
breada_readahead 8 0 255 rw
bswap 0 0 1 r
current_speed 0 0 69 rw
failures 0 0 65535 rw
file_readahead 124 0 16384 rw
ide_scsi 0 0 1 rw
init_speed 0 0 69 rw
io_32bit 0 0 3 rw
keepsettings 0 0 1 rw
lun 0 0 7 rw
max_failures 1 0 65535 rw
multcount 0 0 16 rw
nice1 1 0 1 rw
nowerr 0 0 1 rw
number 0 0 3 rw
pio_mode write-only 0 255 w
slow 0 0 1 rw
unmaskirq 0 0 1 rw
using_dma 0 0 1 rw
wcache 0 0 1 rw

ide-disk version 1.13
physical 29104/16/63
logical 1826/255/63
QUANTUM FIREBALLlct10 15

00:1f.1 IDE interface: Intel Corporation 82801AA IDE (rev 02) (prog-if 80
[Master])
Subsystem: Intel Corporation 82801AA IDE
Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B-
Status: Cap- 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort-
<TAbort- <MAbort- >SERR- <PERR-
Latency: 0
Region 4: I/O ports at f000 [size=16]


2002-02-01 16:04:23

by Anton Altaparmakov

[permalink] [raw]
Subject: Re: 2.5.3 - (IDE) hda: drive not ready for command errors

Hi,

I started getting the same errors as you show below about a month or more
ago now. They became more and more frequent to the point of starting to
kill the whole IDE controller (other channel was killed too) and killing
the system within 5-30 minutes of starting up.

I was about to send the drive (IBM 7200rpm 41GiB) back for replacement when
I as last resort tried to upgrade the firmware of the drive.

After the upgrade the drive started working again, fully passed the Drive
Fitness Test (IBM utility) and it has been working for a few weeks non-stop
in my file server RAID-1 array since then.

I know your problems might have nothing to do with mine especially as the
drives are from different manufacturers but it may be an idea to ask for a
firmware upgrade. You never know...

Best regards,

Anton

At 14:33 01/02/02, [email protected] wrote:
>Hallo,
>
>I get these warnings/errors from my kernel. For my feeling it does
>not really seem to slow down things a lot but maybe it helps for fixing
>errors.
>
>Feb 1 10:16:48 prester kernel: hda: status error: status=0x58 {
>DriveReady Seek
>Feb 1 10:16:48 prester kernel: hda: drive not ready for command
>Feb 1 10:16:48 prester kernel: task_out_intr: should not trigger
>Feb 1 10:16:48 prester kernel: task_out_intr: should not trigger
>
>and
>
>Feb 1 15:13:55 prester kernel: hda: status timeout: status=0xd0 { Busy }
>Feb 1 15:13:55 prester kernel: hda: drive not ready for command
>Feb 1 15:13:55 prester kernel: ide0: reset: success
>
>Just now I have experience some new errors, which do not directly seem to be
>related to ide but seem strange to me as well. Hope it gives you some clue.
>
>Feb 1 15:22:28 prester kernel: <ry sread (sector 0x5b1bea88) failed
>Feb 1 15:22:28 prester kernel: attempt to access beyond end of device
>Feb 1 15:22:28 prester kernel: 03:04: rw=0, want=764278084, limit=8377897
>Feb 1 15:22:28 prester kernel: Directory sread (sector 0x5b1bea88) failed
>Feb 1 15:22:28 prester kernel: attempt to access beyond end of device
>Feb 1 15:22:28 prester kernel: 03:04: rw=0, want=764278084, limit=8377897
>...
>Feb 1 15:22:29 prester kernel: Directory sread (sector 0x7007faf) failed
>Feb 1 15:22:29 prester last message repeated 15 times
>
>
>Axel Siebenwirth
>
>with the following setup:
>
>* kernel 2.5.3
>
># ATA/IDE/MFM/RLL support
>CONFIG_IDE=y
># IDE, ATA and ATAPI Block devices
>CONFIG_BLK_DEV_IDE=y
>CONFIG_BLK_DEV_IDEDISK=y
>CONFIG_BLK_DEV_IDECD=m
>CONFIG_IDE_TASK_IOCTL=y
># IDE chipset support/bugfixes
>CONFIG_BLK_DEV_IDEPCI=y
>CONFIG_IDEPCI_SHARE_IRQ=y
>CONFIG_BLK_DEV_IDEDMA_PCI=y
>CONFIG_IDEDMA_PCI_AUTO=y
>CONFIG_BLK_DEV_IDEDMA=y
>CONFIG_IDEDMA_AUTO=y
>CONFIG_BLK_DEV_IDE_MODES=y
>
>name value min max mode
>---- ----- --- --- ----
>acoustic 0 0 254 rw
>address 0 0 2 rw
>bios_cyl 1826 0 65535 rw
>bios_head 255 0 255 rw
>bios_sect 63 0 63 rw
>breada_readahead 8 0 255 rw
>bswap 0 0 1 r
>current_speed 0 0 69 rw
>failures 0 0 65535 rw
>file_readahead 124 0 16384 rw
>ide_scsi 0 0 1 rw
>init_speed 0 0 69 rw
>io_32bit 0 0 3 rw
>keepsettings 0 0 1 rw
>lun 0 0 7 rw
>max_failures 1 0 65535 rw
>multcount 0 0 16 rw
>nice1 1 0 1 rw
>nowerr 0 0 1 rw
>number 0 0 3 rw
>pio_mode write-only 0 255 w
>slow 0 0 1 rw
>unmaskirq 0 0 1 rw
>using_dma 0 0 1 rw
>wcache 0 0 1 rw
>
>ide-disk version 1.13
>physical 29104/16/63
>logical 1826/255/63
>QUANTUM FIREBALLlct10 15
>
>00:1f.1 IDE interface: Intel Corporation 82801AA IDE (rev 02) (prog-if 80
>[Master])
> Subsystem: Intel Corporation 82801AA IDE
> Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
>Stepping- SERR- FastB2B-
> Status: Cap- 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort-
><TAbort- <MAbort- >SERR- <PERR-
> Latency: 0
> Region 4: I/O ports at f000 [size=16]
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to [email protected]
>More majordomo info at http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at http://www.tux.org/lkml/

--
"I've not lost my mind. It's backed up on tape somewhere." - Unknown
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Linux NTFS Maintainer / WWW: http://linux-ntfs.sf.net/
ICQ: 8561279 / WWW: http://www-stu.christs.cam.ac.uk/~aia21/

2002-02-01 16:48:55

by Axel H. Siebenwirth

[permalink] [raw]
Subject: Re: 2.5.3 - (IDE) hda: drive not ready for command errors

Hi Anton!

On Fri, 01 Feb 2002, Anton Altaparmakov wrote:

> I was about to send the drive (IBM 7200rpm 41GiB) back for replacement when
> I as last resort tried to upgrade the firmware of the drive.
>
> After the upgrade the drive started working again, fully passed the Drive
> Fitness Test (IBM utility) and it has been working for a few weeks non-stop
> in my file server RAID-1 array since then.

The thing is that they come up now, just since I installed 2.5.3. Might
there be a hope that it is a kernel-related issue (new IDE driver...). Drive
has been working fine ever since till now.

Best regards,
Axel Siebenwirth


P.S.: Would like to write to my WinXP NTFS Partition, is there some hope MS
will ever give out exact specs (they don't, do they?) to have write
funtionality properly implemented? Is there some other way to contribute?

2002-02-01 17:53:47

by Andreas Dilger

[permalink] [raw]
Subject: Re: 2.5.3 - (IDE) hda: drive not ready for command errors

On Feb 01, 2002 17:48 +0100, Axel H. Siebenwirth wrote:
> P.S.: Would like to write to my WinXP NTFS Partition, is there some hope MS
> will ever give out exact specs (they don't, do they?) to have write
> funtionality properly implemented? Is there some other way to contribute?

Try out the ntfs-tng driver at sourceforge.net. It is your best bet.

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/

2002-02-02 02:44:42

by Anton Altaparmakov

[permalink] [raw]
Subject: Re: 2.5.3 - (IDE) hda: drive not ready for command errors

At 17:52 01/02/02, Andreas Dilger wrote:
>On Feb 01, 2002 17:48 +0100, Axel H. Siebenwirth wrote:
> > P.S.: Would like to write to my WinXP NTFS Partition, is there some hope MS
> > will ever give out exact specs (they don't, do they?)

No.

> > to have write
> > funtionality properly implemented? Is there some other way to contribute?
>
>Try out the ntfs-tng driver at sourceforge.net. It is your best bet.

Yes, ntfs-tng currently is read-only pending completion soon-ish. Once it
is complete and in the kernel write support development will start immediately.

If you (or anyone else) would like to contribute, please download the
latest ntfs-driver-tng module from the linux-ntfs cvs (see
http://linux-ntfs.sf.net/) and have a look at the code. You can direct any
questions/comments/etc about the code to the mailing list:
[email protected]

Best regards,

Anton


--
"I've not lost my mind. It's backed up on tape somewhere." - Unknown
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Linux NTFS Maintainer / WWW: http://linux-ntfs.sf.net/
ICQ: 8561279 / WWW: http://www-stu.christs.cam.ac.uk/~aia21/

2002-02-02 09:27:40

by Jens Axboe

[permalink] [raw]
Subject: Re: 2.5.3 - (IDE) hda: drive not ready for command errors

On Fri, Feb 01 2002, Axel H. Siebenwirth wrote:
> Hi Anton!
>
> On Fri, 01 Feb 2002, Anton Altaparmakov wrote:
>
> > I was about to send the drive (IBM 7200rpm 41GiB) back for replacement when
> > I as last resort tried to upgrade the firmware of the drive.
> >
> > After the upgrade the drive started working again, fully passed the Drive
> > Fitness Test (IBM utility) and it has been working for a few weeks non-stop
> > in my file server RAID-1 array since then.
>
> The thing is that they come up now, just since I installed 2.5.3. Might
> there be a hope that it is a kernel-related issue (new IDE driver...). Drive
> has been working fine ever since till now.

Please try with this patch -- it's against 2.5.3-pre3, but I think it
should apply to 2.5.3 final as well.

diff -ur /ata/linux-2.5.3-pre3/drivers/ide/ide-disk.c drivers/ide/ide-disk.c
--- /ata/linux-2.5.3-pre3/drivers/ide/ide-disk.c Fri Jan 25 05:05:06 2002
+++ drivers/ide/ide-disk.c Fri Jan 25 02:53:03 2002
@@ -192,11 +192,6 @@
sectors = rq->nr_sectors;
if (sectors == 256)
sectors = 0;
- if (command == WIN_MULTWRITE_EXT || command == WIN_MULTWRITE) {
- sectors = drive->mult_count;
- if (sectors > rq->current_nr_sectors)
- sectors = rq->current_nr_sectors;
- }

taskfile.sector_count = sectors;
taskfile.sector_number = sect;
@@ -241,11 +236,6 @@
sectors = rq->nr_sectors;
if (sectors == 256)
sectors = 0;
- if (command == WIN_MULTWRITE_EXT || command == WIN_MULTWRITE) {
- sectors = drive->mult_count;
- if (sectors > rq->current_nr_sectors)
- sectors = rq->current_nr_sectors;
- }

memset(&taskfile, 0, sizeof(task_struct_t));
memset(&hobfile, 0, sizeof(hob_struct_t));
@@ -300,13 +290,8 @@
memset(&hobfile, 0, sizeof(hob_struct_t));

sectors = rq->nr_sectors;
- if (sectors == 256)
+ if (sectors == 65536)
sectors = 0;
- if (command == WIN_MULTWRITE_EXT || command == WIN_MULTWRITE) {
- sectors = drive->mult_count;
- if (sectors > rq->current_nr_sectors)
- sectors = rq->current_nr_sectors;
- }

taskfile.sector_count = sectors;
hobfile.sector_count = sectors >> 8;
diff -ur /ata/linux-2.5.3-pre3/drivers/ide/ide-probe.c drivers/ide/ide-probe.c
--- /ata/linux-2.5.3-pre3/drivers/ide/ide-probe.c Fri Jan 25 05:05:06 2002
+++ drivers/ide/ide-probe.c Fri Jan 25 04:46:26 2002
@@ -625,7 +625,7 @@
blk_queue_segment_boundary(q, 0xffff);

/* IDE can do up to 128K per request, pdc4030 needs smaller limit */
- max_sectors = (is_pdc4030_chipset ? 127 : 255);
+ max_sectors = (is_pdc4030_chipset ? 127 : 256);
blk_queue_max_sectors(q, max_sectors);

/* IDE DMA can do PRD_ENTRIES number of segments. */
diff -ur /ata/linux-2.5.3-pre3/drivers/ide/ide-taskfile.c drivers/ide/ide-taskfile.c
--- /ata/linux-2.5.3-pre3/drivers/ide/ide-taskfile.c Fri Jan 25 05:05:06 2002
+++ drivers/ide/ide-taskfile.c Fri Jan 25 04:45:48 2002
@@ -255,6 +255,7 @@
return 1; /* drive ready: *might* be interrupting */
}

+ide_startstop_t bio_mulout_intr (ide_drive_t *drive);
ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
{
task_struct_t *taskfile = (task_struct_t *) task->tfRegister;
@@ -263,7 +264,7 @@
byte HIHI = (drive->addressing) ? 0xE0 : 0xEF;

/* (ks/hs): Moved to start, do not use for multiple out commands */
- if (task->handler != task_mulout_intr) {
+ if (task->handler != task_mulout_intr && task->handler != bio_mulout_intr) {
if (IDE_CONTROL_REG)
OUT_BYTE(drive->ctl, IDE_CONTROL_REG); /* clear nIEN */
SELECT_MASK(HWIF(drive), drive, 0);
@@ -313,7 +314,7 @@
byte HIHI = (drive->addressing) ? 0xE0 : 0xEF;

/* (ks/hs): Moved to start, do not use for multiple out commands */
- if (*handler != task_mulout_intr) {
+ if (*handler != task_mulout_intr && handler != bio_mulout_intr) {
if (IDE_CONTROL_REG)
OUT_BYTE(drive->ctl, IDE_CONTROL_REG); /* clear nIEN */
SELECT_MASK(HWIF(drive), drive, 0);
@@ -936,15 +937,12 @@
char *pBuf = NULL;
unsigned long flags;

- if (!rq->current_nr_sectors) {
- printk("task_out_intr: should not trigger\n");
- ide_end_request(1, HWGROUP(drive));
- return ide_stopped;
- }
-
- if (!OK_STAT(stat,DRIVE_READY,drive->bad_wstat)) {
+ if (!OK_STAT(stat,DRIVE_READY,drive->bad_wstat))
return ide_error(drive, "task_out_intr", stat);
- }
+
+ if (!rq->current_nr_sectors)
+ if (!ide_end_request(1, HWGROUP(drive)))
+ return ide_stopped;

if ((rq->current_nr_sectors==1) ^ (stat & DRQ_STAT)) {
rq = HWGROUP(drive)->rq;
@@ -958,16 +956,8 @@
rq->current_nr_sectors--;
}

- if (rq->current_nr_sectors <= 0) {
- if (ide_end_request(1, HWGROUP(drive))) {
- ide_set_handler(drive, &task_out_intr, WAIT_CMD, NULL);
- return ide_started;
- }
- } else {
- ide_set_handler(drive, &task_out_intr, WAIT_CMD, NULL);
- return ide_started;
- }
- return ide_stopped;
+ ide_set_handler(drive, task_out_intr, WAIT_CMD, NULL);
+ return ide_started;
}

/*
@@ -1061,14 +1051,132 @@
return ide_started;
}

+ide_startstop_t pre_bio_out_intr (ide_drive_t *drive, struct request *rq)
+{
+ ide_task_t *args = rq->special;
+ ide_startstop_t startstop;
+
+ /*
+ * assign private copy for multi-write
+ */
+ memcpy(&HWGROUP(drive)->wrq, rq, sizeof(struct request));
+
+ if (ide_wait_stat(&startstop, drive, DATA_READY, drive->bad_wstat, WAIT_DRQ))
+ return startstop;
+
+ /*
+ * (ks/hs): Stuff the first sector(s)
+ * by implicitly calling the handler
+ */
+ if (!(drive_is_ready(drive))) {
+ int i;
+ /*
+ * (ks/hs): FIXME: Replace hard-coded
+ * 100, error handling?
+ */
+ for (i=0; i<100; i++) {
+ if (drive_is_ready(drive))
+ break;
+ }
+ }
+
+ return args->handler(drive);
+}
+
+
+ide_startstop_t bio_mulout_intr (ide_drive_t *drive)
+{
+#ifdef ALTSTAT_SCREW_UP
+ byte stat = altstat_multi_busy(drive, GET_ALTSTAT(), "write");
+#else
+ byte stat = GET_STAT();
+#endif /* ALTSTAT_SCREW_UP */
+
+ byte io_32bit = drive->io_32bit;
+ struct request *rq = &HWGROUP(drive)->wrq;
+ ide_hwgroup_t *hwgroup = HWGROUP(drive);
+ int mcount = drive->mult_count;
+ ide_startstop_t startstop;
+
+ /*
+ * (ks/hs): Handle last IRQ on multi-sector transfer,
+ * occurs after all data was sent in this chunk
+ */
+ if (!rq->nr_sectors) {
+ if (stat & (ERR_STAT|DRQ_STAT)) {
+ startstop = ide_error(drive, "bio_mulout_intr", stat);
+ memcpy(rq, HWGROUP(drive)->rq, sizeof(struct request));
+ return startstop;
+ }
+
+ __ide_end_request(HWGROUP(drive), 1, rq->hard_nr_sectors);
+ HWGROUP(drive)->wrq.bio = NULL;
+ return ide_stopped;
+ }
+
+ if (!OK_STAT(stat, DATA_READY, BAD_R_STAT)) {
+ if (stat & (ERR_STAT | DRQ_STAT)) {
+ startstop = ide_error(drive, "bio_mulout_intr", stat);
+ memcpy(rq, HWGROUP(drive)->rq, sizeof(struct request));
+ return startstop;
+ }
+
+ /* no data yet, so wait for another interrupt */
+ if (hwgroup->handler == NULL)
+ ide_set_handler(drive, bio_mulout_intr, WAIT_CMD, NULL);
+
+ return ide_started;
+ }
+
+ do {
+ char *buffer;
+ int nsect = rq->current_nr_sectors;
+ unsigned long flags;
+
+ if (nsect > mcount)
+ nsect = mcount;
+ mcount -= nsect;
+
+ buffer = ide_map_buffer(rq, &flags);
+ rq->sector += nsect;
+ rq->nr_sectors -= nsect;
+ rq->current_nr_sectors -= nsect;
+
+ /* Do we move to the next bio after this? */
+ if (!rq->current_nr_sectors) {
+ /* remember to fix this up /jens */
+ struct bio *bio = rq->bio->bi_next;
+
+ /* end early early we ran out of requests */
+ if (!bio) {
+ mcount = 0;
+ } else {
+ rq->bio = bio;
+ rq->current_nr_sectors = bio_iovec(bio)->bv_len >> 9;
+ }
+ }
+
+ /*
+ * Ok, we're all setup for the interrupt
+ * re-entering us on the last transfer.
+ */
+ taskfile_output_data(drive, buffer, nsect * SECTOR_WORDS);
+ ide_unmap_buffer(buffer, &flags);
+ } while (mcount);
+
+ drive->io_32bit = io_32bit;
+ rq->errors = 0;
+ if (hwgroup->handler == NULL)
+ ide_set_handler(drive, bio_mulout_intr, WAIT_CMD, NULL);
+
+ return ide_started;
+}
+
/* Called by internal to feature out type of command being called */
ide_pre_handler_t * ide_pre_handler_parser (struct hd_drive_task_hdr *taskfile, struct hd_drive_hob_hdr *hobfile)
{
switch(taskfile->command) {
/* IDE_DRIVE_TASK_RAW_WRITE */
- case CFA_WRITE_MULTI_WO_ERASE:
- case WIN_MULTWRITE:
- case WIN_MULTWRITE_EXT:
/* IDE_DRIVE_TASK_OUT */
case WIN_WRITE:
case WIN_WRITE_EXT:
@@ -1077,7 +1185,10 @@
case CFA_WRITE_SECT_WO_ERASE:
case WIN_DOWNLOAD_MICROCODE:
return &pre_task_out_intr;
- /* IDE_DRIVE_TASK_OUT */
+ case CFA_WRITE_MULTI_WO_ERASE:
+ case WIN_MULTWRITE:
+ case WIN_MULTWRITE_EXT:
+ return &pre_bio_out_intr;
case WIN_SMART:
if (taskfile->feature == SMART_WRITE_LOG_SECTOR)
return &pre_task_out_intr;
@@ -1120,7 +1231,7 @@
case CFA_WRITE_MULTI_WO_ERASE:
case WIN_MULTWRITE:
case WIN_MULTWRITE_EXT:
- return &task_mulout_intr;
+ return &bio_mulout_intr;
case WIN_SMART:
switch(taskfile->feature) {
case SMART_READ_VALUES:

--
Jens Axboe

2002-02-02 19:11:03

by Axel H. Siebenwirth

[permalink] [raw]
Subject: Re: 2.5.3 - (IDE) hda: drive not ready for command errors

Jens Axboe schrieb am Samstag, den 02. Februar 2002:

> Please try with this patch -- it's against 2.5.3-pre3, but I think it
> should apply to 2.5.3 final as well.

Yes, it did apply against 2.5.3 without a problem and it fixed my errors
which came up in a row in 10sec intervals. Now it seems faster again as
well, so there must have been some slowdown caused by them.

Thanks a lot and best regards,
Axel Siebenwirth

2002-02-02 21:57:09

by Andre Hedrick

[permalink] [raw]
Subject: Re: 2.5.3 - (IDE) hda: drive not ready for command errors


Jens,

You and I know Linus will go ballistic over the reintroduction of a
working copy model using rq scratch pad. We can go with this return to
what we are trying to get away from but we really need a way to stream the
pointers to the data register cleanly. Otherwise the benefits of the zero
copy in block go away.

Cheers,

Andre Hedrick
Linux Disk Certification Project Linux ATA Development

On Sat, 2 Feb 2002, Jens Axboe wrote:

> On Fri, Feb 01 2002, Axel H. Siebenwirth wrote:
> > Hi Anton!
> >
> > On Fri, 01 Feb 2002, Anton Altaparmakov wrote:
> >
> > > I was about to send the drive (IBM 7200rpm 41GiB) back for replacement when
> > > I as last resort tried to upgrade the firmware of the drive.
> > >
> > > After the upgrade the drive started working again, fully passed the Drive
> > > Fitness Test (IBM utility) and it has been working for a few weeks non-stop
> > > in my file server RAID-1 array since then.
> >
> > The thing is that they come up now, just since I installed 2.5.3. Might
> > there be a hope that it is a kernel-related issue (new IDE driver...). Drive
> > has been working fine ever since till now.
>
> Please try with this patch -- it's against 2.5.3-pre3, but I think it
> should apply to 2.5.3 final as well.
>
> diff -ur /ata/linux-2.5.3-pre3/drivers/ide/ide-disk.c drivers/ide/ide-disk.c
> --- /ata/linux-2.5.3-pre3/drivers/ide/ide-disk.c Fri Jan 25 05:05:06 2002
> +++ drivers/ide/ide-disk.c Fri Jan 25 02:53:03 2002
> @@ -192,11 +192,6 @@
> sectors = rq->nr_sectors;
> if (sectors == 256)
> sectors = 0;
> - if (command == WIN_MULTWRITE_EXT || command == WIN_MULTWRITE) {
> - sectors = drive->mult_count;
> - if (sectors > rq->current_nr_sectors)
> - sectors = rq->current_nr_sectors;
> - }
>
> taskfile.sector_count = sectors;
> taskfile.sector_number = sect;
> @@ -241,11 +236,6 @@
> sectors = rq->nr_sectors;
> if (sectors == 256)
> sectors = 0;
> - if (command == WIN_MULTWRITE_EXT || command == WIN_MULTWRITE) {
> - sectors = drive->mult_count;
> - if (sectors > rq->current_nr_sectors)
> - sectors = rq->current_nr_sectors;
> - }
>
> memset(&taskfile, 0, sizeof(task_struct_t));
> memset(&hobfile, 0, sizeof(hob_struct_t));
> @@ -300,13 +290,8 @@
> memset(&hobfile, 0, sizeof(hob_struct_t));
>
> sectors = rq->nr_sectors;
> - if (sectors == 256)
> + if (sectors == 65536)
> sectors = 0;
> - if (command == WIN_MULTWRITE_EXT || command == WIN_MULTWRITE) {
> - sectors = drive->mult_count;
> - if (sectors > rq->current_nr_sectors)
> - sectors = rq->current_nr_sectors;
> - }
>
> taskfile.sector_count = sectors;
> hobfile.sector_count = sectors >> 8;
> diff -ur /ata/linux-2.5.3-pre3/drivers/ide/ide-probe.c drivers/ide/ide-probe.c
> --- /ata/linux-2.5.3-pre3/drivers/ide/ide-probe.c Fri Jan 25 05:05:06 2002
> +++ drivers/ide/ide-probe.c Fri Jan 25 04:46:26 2002
> @@ -625,7 +625,7 @@
> blk_queue_segment_boundary(q, 0xffff);
>
> /* IDE can do up to 128K per request, pdc4030 needs smaller limit */
> - max_sectors = (is_pdc4030_chipset ? 127 : 255);
> + max_sectors = (is_pdc4030_chipset ? 127 : 256);
> blk_queue_max_sectors(q, max_sectors);
>
> /* IDE DMA can do PRD_ENTRIES number of segments. */
> diff -ur /ata/linux-2.5.3-pre3/drivers/ide/ide-taskfile.c drivers/ide/ide-taskfile.c
> --- /ata/linux-2.5.3-pre3/drivers/ide/ide-taskfile.c Fri Jan 25 05:05:06 2002
> +++ drivers/ide/ide-taskfile.c Fri Jan 25 04:45:48 2002
> @@ -255,6 +255,7 @@
> return 1; /* drive ready: *might* be interrupting */
> }
>
> +ide_startstop_t bio_mulout_intr (ide_drive_t *drive);
> ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
> {
> task_struct_t *taskfile = (task_struct_t *) task->tfRegister;
> @@ -263,7 +264,7 @@
> byte HIHI = (drive->addressing) ? 0xE0 : 0xEF;
>
> /* (ks/hs): Moved to start, do not use for multiple out commands */
> - if (task->handler != task_mulout_intr) {
> + if (task->handler != task_mulout_intr && task->handler != bio_mulout_intr) {
> if (IDE_CONTROL_REG)
> OUT_BYTE(drive->ctl, IDE_CONTROL_REG); /* clear nIEN */
> SELECT_MASK(HWIF(drive), drive, 0);
> @@ -313,7 +314,7 @@
> byte HIHI = (drive->addressing) ? 0xE0 : 0xEF;
>
> /* (ks/hs): Moved to start, do not use for multiple out commands */
> - if (*handler != task_mulout_intr) {
> + if (*handler != task_mulout_intr && handler != bio_mulout_intr) {
> if (IDE_CONTROL_REG)
> OUT_BYTE(drive->ctl, IDE_CONTROL_REG); /* clear nIEN */
> SELECT_MASK(HWIF(drive), drive, 0);
> @@ -936,15 +937,12 @@
> char *pBuf = NULL;
> unsigned long flags;
>
> - if (!rq->current_nr_sectors) {
> - printk("task_out_intr: should not trigger\n");
> - ide_end_request(1, HWGROUP(drive));
> - return ide_stopped;
> - }
> -
> - if (!OK_STAT(stat,DRIVE_READY,drive->bad_wstat)) {
> + if (!OK_STAT(stat,DRIVE_READY,drive->bad_wstat))
> return ide_error(drive, "task_out_intr", stat);
> - }
> +
> + if (!rq->current_nr_sectors)
> + if (!ide_end_request(1, HWGROUP(drive)))
> + return ide_stopped;
>
> if ((rq->current_nr_sectors==1) ^ (stat & DRQ_STAT)) {
> rq = HWGROUP(drive)->rq;
> @@ -958,16 +956,8 @@
> rq->current_nr_sectors--;
> }
>
> - if (rq->current_nr_sectors <= 0) {
> - if (ide_end_request(1, HWGROUP(drive))) {
> - ide_set_handler(drive, &task_out_intr, WAIT_CMD, NULL);
> - return ide_started;
> - }
> - } else {
> - ide_set_handler(drive, &task_out_intr, WAIT_CMD, NULL);
> - return ide_started;
> - }
> - return ide_stopped;
> + ide_set_handler(drive, task_out_intr, WAIT_CMD, NULL);
> + return ide_started;
> }
>
> /*
> @@ -1061,14 +1051,132 @@
> return ide_started;
> }
>
> +ide_startstop_t pre_bio_out_intr (ide_drive_t *drive, struct request *rq)
> +{
> + ide_task_t *args = rq->special;
> + ide_startstop_t startstop;
> +
> + /*
> + * assign private copy for multi-write
> + */
> + memcpy(&HWGROUP(drive)->wrq, rq, sizeof(struct request));
> +
> + if (ide_wait_stat(&startstop, drive, DATA_READY, drive->bad_wstat, WAIT_DRQ))
> + return startstop;
> +
> + /*
> + * (ks/hs): Stuff the first sector(s)
> + * by implicitly calling the handler
> + */
> + if (!(drive_is_ready(drive))) {
> + int i;
> + /*
> + * (ks/hs): FIXME: Replace hard-coded
> + * 100, error handling?
> + */
> + for (i=0; i<100; i++) {
> + if (drive_is_ready(drive))
> + break;
> + }
> + }
> +
> + return args->handler(drive);
> +}
> +
> +
> +ide_startstop_t bio_mulout_intr (ide_drive_t *drive)
> +{
> +#ifdef ALTSTAT_SCREW_UP
> + byte stat = altstat_multi_busy(drive, GET_ALTSTAT(), "write");
> +#else
> + byte stat = GET_STAT();
> +#endif /* ALTSTAT_SCREW_UP */
> +
> + byte io_32bit = drive->io_32bit;
> + struct request *rq = &HWGROUP(drive)->wrq;
> + ide_hwgroup_t *hwgroup = HWGROUP(drive);
> + int mcount = drive->mult_count;
> + ide_startstop_t startstop;
> +
> + /*
> + * (ks/hs): Handle last IRQ on multi-sector transfer,
> + * occurs after all data was sent in this chunk
> + */
> + if (!rq->nr_sectors) {
> + if (stat & (ERR_STAT|DRQ_STAT)) {
> + startstop = ide_error(drive, "bio_mulout_intr", stat);
> + memcpy(rq, HWGROUP(drive)->rq, sizeof(struct request));
> + return startstop;
> + }
> +
> + __ide_end_request(HWGROUP(drive), 1, rq->hard_nr_sectors);
> + HWGROUP(drive)->wrq.bio = NULL;
> + return ide_stopped;
> + }
> +
> + if (!OK_STAT(stat, DATA_READY, BAD_R_STAT)) {
> + if (stat & (ERR_STAT | DRQ_STAT)) {
> + startstop = ide_error(drive, "bio_mulout_intr", stat);
> + memcpy(rq, HWGROUP(drive)->rq, sizeof(struct request));
> + return startstop;
> + }
> +
> + /* no data yet, so wait for another interrupt */
> + if (hwgroup->handler == NULL)
> + ide_set_handler(drive, bio_mulout_intr, WAIT_CMD, NULL);
> +
> + return ide_started;
> + }
> +
> + do {
> + char *buffer;
> + int nsect = rq->current_nr_sectors;
> + unsigned long flags;
> +
> + if (nsect > mcount)
> + nsect = mcount;
> + mcount -= nsect;
> +
> + buffer = ide_map_buffer(rq, &flags);
> + rq->sector += nsect;
> + rq->nr_sectors -= nsect;
> + rq->current_nr_sectors -= nsect;
> +
> + /* Do we move to the next bio after this? */
> + if (!rq->current_nr_sectors) {
> + /* remember to fix this up /jens */
> + struct bio *bio = rq->bio->bi_next;
> +
> + /* end early early we ran out of requests */
> + if (!bio) {
> + mcount = 0;
> + } else {
> + rq->bio = bio;
> + rq->current_nr_sectors = bio_iovec(bio)->bv_len >> 9;
> + }
> + }
> +
> + /*
> + * Ok, we're all setup for the interrupt
> + * re-entering us on the last transfer.
> + */
> + taskfile_output_data(drive, buffer, nsect * SECTOR_WORDS);
> + ide_unmap_buffer(buffer, &flags);
> + } while (mcount);
> +
> + drive->io_32bit = io_32bit;
> + rq->errors = 0;
> + if (hwgroup->handler == NULL)
> + ide_set_handler(drive, bio_mulout_intr, WAIT_CMD, NULL);
> +
> + return ide_started;
> +}
> +
> /* Called by internal to feature out type of command being called */
> ide_pre_handler_t * ide_pre_handler_parser (struct hd_drive_task_hdr *taskfile, struct hd_drive_hob_hdr *hobfile)
> {
> switch(taskfile->command) {
> /* IDE_DRIVE_TASK_RAW_WRITE */
> - case CFA_WRITE_MULTI_WO_ERASE:
> - case WIN_MULTWRITE:
> - case WIN_MULTWRITE_EXT:
> /* IDE_DRIVE_TASK_OUT */
> case WIN_WRITE:
> case WIN_WRITE_EXT:
> @@ -1077,7 +1185,10 @@
> case CFA_WRITE_SECT_WO_ERASE:
> case WIN_DOWNLOAD_MICROCODE:
> return &pre_task_out_intr;
> - /* IDE_DRIVE_TASK_OUT */
> + case CFA_WRITE_MULTI_WO_ERASE:
> + case WIN_MULTWRITE:
> + case WIN_MULTWRITE_EXT:
> + return &pre_bio_out_intr;
> case WIN_SMART:
> if (taskfile->feature == SMART_WRITE_LOG_SECTOR)
> return &pre_task_out_intr;
> @@ -1120,7 +1231,7 @@
> case CFA_WRITE_MULTI_WO_ERASE:
> case WIN_MULTWRITE:
> case WIN_MULTWRITE_EXT:
> - return &task_mulout_intr;
> + return &bio_mulout_intr;
> case WIN_SMART:
> switch(taskfile->feature) {
> case SMART_READ_VALUES:
>
> --
> Jens Axboe
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>

2002-02-02 23:29:32

by Jens Axboe

[permalink] [raw]
Subject: Re: 2.5.3 - (IDE) hda: drive not ready for command errors

On Sat, Feb 02 2002, Andre Hedrick wrote:
>
> Jens,
>
> You and I know Linus will go ballistic over the reintroduction of a
> working copy model using rq scratch pad. We can go with this return to

No I don't think so, I'd be surprised if Linus cared about that at all.

> what we are trying to get away from but we really need a way to stream the
> pointers to the data register cleanly. Otherwise the benefits of the zero
> copy in block go away.

?? Your point is not clear. zero copy what, request struct?! That would
be way below measurable.

--
Jens Axboe

2002-02-02 23:58:49

by Jens Axboe

[permalink] [raw]
Subject: Re: 2.5.3 - (IDE) hda: drive not ready for command errors

On Sun, Feb 03 2002, Jens Axboe wrote:
> > what we are trying to get away from but we really need a way to stream the
> > pointers to the data register cleanly. Otherwise the benefits of the zero
> > copy in block go away.
>
> ?? Your point is not clear. zero copy what, request struct?! That would
> be way below measurable.

Sorry, I see what you mean, was a bit too quick. To me the current code
looks ok in this regard, I don't see any problems with that. If you have
noticed a problem please out line it and I'll take a look tomorrow. Now,
bed time.

--
Jens Axboe

2002-02-05 15:32:48

by Holger Lubitz

[permalink] [raw]
Subject: Re: 2.5.3 - (IDE) hda: drive not ready for command errors

(Tried posting this before, but apparently it didn't get through.
Apologies if it did.)

Anton Altaparmakov proclaimed:
> I was about to send the drive (IBM 7200rpm 41GiB) back for replacement when
> I as last resort tried to upgrade the firmware of the drive.

Just out of curiosity - where do you get firmware updates for hard
drives? I know that most can be flashed with newer firmware, yet i never
saw an actual update available.

I have two IBM DTLA that sometimes make the "funny IBM noises",
occasionally accompanied by ide resets. They haven't hung the bus, yet,
but I'd like to be on the safe side.

Holger

2002-02-05 16:07:49

by Anton Altaparmakov

[permalink] [raw]
Subject: Re: 2.5.3 - (IDE) hda: drive not ready for command errors

At 15:32 05/02/02, Holger Lubitz wrote:
>(Tried posting this before, but apparently it didn't get through.
>Apologies if it did.)
>
>Anton Altaparmakov proclaimed:
> > I was about to send the drive (IBM 7200rpm 41GiB) back for replacement when
> > I as last resort tried to upgrade the firmware of the drive.
>
>Just out of curiosity - where do you get firmware updates for hard
>drives? I know that most can be flashed with newer firmware, yet i never
>saw an actual update available.
>
>I have two IBM DTLA that sometimes make the "funny IBM noises",
>occasionally accompanied by ide resets. They haven't hung the bus, yet,
>but I'd like to be on the safe side.

I got mine from the company I bought the drive from. They are official IBM
dealers (or something). The url for the firmware they offer is:

http://www.scan.co.uk/ibmhddtest.htm

They also have the DTLA firmware so you can grab it from there. Note that
you need a computer running windows in order to create the floppy with the
firmware. - Once you have the floppy boot the computer containing the hd
you want to upgrade with the floppy and follow the onscreen instructions.

btw. During the upgrade the drives make strange noises and that had me
worried the first time round but it seems to always happen during upgrades
so is probably normal. I upgraded both DTLA and GXP drives and both work fine.

Anton


--
"I've not lost my mind. It's backed up on tape somewhere." - Unknown
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Linux NTFS Maintainer / WWW: http://linux-ntfs.sf.net/
ICQ: 8561279 / WWW: http://www-stu.christs.cam.ac.uk/~aia21/

2002-02-05 16:58:16

by Holger Lubitz

[permalink] [raw]
Subject: Re: 2.5.3 - (IDE) hda: drive not ready for command errors

Anton Altaparmakov proclaimed:

> I got mine from the company I bought the drive from. They are official IBM
> dealers (or something). The url for the firmware they offer is:
>
> http://www.scan.co.uk/ibmhddtest.htm

Thanks a lot. This page seems totally unfindable by any other means. I
tried searching for dtla firmware updates with google and did not find
anything. Even IBMs own site does not find any firmware updates for
their ATA drives. Just some updates for other systems and components.

> They also have the DTLA firmware so you can grab it from there. Note that
> you need a computer running windows in order to create the floppy with the
> firmware.

Yeah. Stupid. At least the "normal" drive fitness test and the feature
tool are available as an disk image at IBM.

Holger