2002-12-15 01:11:28

by Mikael Pettersson

[permalink] [raw]
Subject: 2.4.21-pre1 broke the ide-tape driver

Kernel 2.4.21-pre1 broke the ide-tape driver: the driver
now hangs during initialisation. 2.2 kernels (with Andre's
IDE patch) and 2.4 up to 2.4.20 do not have this problem.

My box has a Seagate STT8000A ATAPI tape drive as hdd;
hdc is a Philips CD-RW, and the controller is ICH2 (i850 chipset).

dmesg log from inserting ide-tape as a module:

ide-tape: Dumping ATAPI Identify Device tape parameters
ide-tape: Protocol Type: <6>ATAPI
ide-tape: Device Type: 1 - <6>Streaming Tape Device
ide-tape: Removable: Yes
ide-tape: Command Packet DRQ Type: <6>Accelerated DRQ
ide-tape: Command Packet Size: <6>12 bytes
ide-tape: Model: Seagate STT8000A
ide-tape: Firmware Revision: 5.51
ide-tape: Serial Number:
ide-tape: Write buffer size: 372736 bytes
ide-tape: DMA: Yes
ide-tape: LBA: Yes
ide-tape: IORDY can be disabled: Yes
ide-tape: IORDY supported: Yes
ide-tape: ATAPI overlap supported: No
ide-tape: PIO Cycle Timing Category: 2
ide-tape: DMA Cycle Timing Category: 2
ide-tape: Single Word DMA supported modes: <6>0 <6>1 <6>2 <6>
ide-tape: Multi Word DMA supported modes: <6>0 <6>1 <6>2 <6>(active) <6>
ide-tape: Enhanced PIO Modes: Mode 3
ide-tape: Minimum Multi-word DMA cycle per word: <6>120 ns
ide-tape: Manufacturer's Recommended Multi-word cycle: <6>120 ns
ide-tape: Minimum PIO cycle without IORDY: <6>120 ns
ide-tape: Minimum PIO cycle with IORDY: <6>120 ns
ide-tape: hdd <-> ht0: Seagate STT8000A rev 5.51
--- long delay here, about a minute or so
hdd: irq timeout: status=0xd0 { Busy }
hdd: DMA disabled
hdd: ATAPI reset complete
--- long delay here, about a minute or so
hdd: irq timeout: status=0xd0 { Busy }
hdd: ATAPI reset complete
--- long delay here, about a minute or so
hdd: irq timeout: status=0xd0 { Busy }
hdd: ATAPI reset complete
--- at this point I'm tired of waiting and reboot the machine

/Mikael


2002-12-15 01:15:59

by Marc-Christian Petersen

[permalink] [raw]
Subject: Re: 2.4.21-pre1 broke the ide-tape driver

On Sunday 15 December 2002 02:19, Mikael Pettersson wrote:

Hi Mikael,

> Kernel 2.4.21-pre1 broke the ide-tape driver: the driver
> now hangs during initialisation. 2.2 kernels (with Andre's
> IDE patch) and 2.4 up to 2.4.20 do not have this problem.
> My box has a Seagate STT8000A ATAPI tape drive as hdd;
> hdc is a Philips CD-RW, and the controller is ICH2 (i850 chipset).
http://linux.bkbits.net:8080/linux-2.4/[email protected]?nav=index.html|ChangeSet@-7d|[email protected]

ciao, Marc

2002-12-15 15:29:14

by Mikael Pettersson

[permalink] [raw]
Subject: Re: 2.4.21-pre1 broke the ide-tape driver

On Sun, 15 Dec 2002 02:23:34 +0100, Marc-Christian Petersen wrote:
>> Kernel 2.4.21-pre1 broke the ide-tape driver: the driver
>> now hangs during initialisation. 2.2 kernels (with Andre's
>> IDE patch) and 2.4 up to 2.4.20 do not have this problem.
>> My box has a Seagate STT8000A ATAPI tape drive as hdd;
>> hdc is a Philips CD-RW, and the controller is ICH2 (i850 chipset).
>http://linux.bkbits.net:8080/linux-2.4/[email protected]?nav=index.html|ChangeSet@-7d|[email protected]

That fixed it. Thanks.

/Mikael

2002-12-15 23:34:14

by Mikael Pettersson

[permalink] [raw]
Subject: Re: 2.4.21-pre1 broke the ide-tape driver


On Sun, 15 Dec 2002 02:23:34 +0100, Marc-Christian Petersen wrote:
>> Kernel 2.4.21-pre1 broke the ide-tape driver: the driver
>> now hangs during initialisation. 2.2 kernels (with Andre's
>> IDE patch) and 2.4 up to 2.4.20 do not have this problem.
>> My box has a Seagate STT8000A ATAPI tape drive as hdd;
>> hdc is a Philips CD-RW, and the controller is ICH2 (i850 chipset).
>http://linux.bkbits.net:8080/linux-2.4/[email protected]?nav=index.html|ChangeSet@-7d|[email protected]

Addendum: this patch fixes the init-time hang, and ide-tape does
seem to work fine, but 'rmmod ide-tape' oopses -- 2.4.20-ac2 also
oopses on 'rmmod ide-tape'.

/Mikael

Unable to handle kernel NULL pointer dereference at virtual address 000000c4
d08a8048
*pde = 00000000
Oops: 0000
CPU: 0
EIP: 0010:[<d08a8048>] Not tainted
Using defaults from ksymoops -t elf32-i386 -a i386
EFLAGS: 00010202
eax: 00000000 ebx: 00000000 ecx: c0241ea0 edx: 00000128
esi: 00000014 edi: d08aa9c0 ebp: bfffeb08 esp: ce825f88
ds: 0018 es: 0018 ss: 0018
Process rmmod.old (pid: 614, stackpage=ce825000)
Stack: d08a1000 fffffff0 d08a1000 c0116a53 d08a1000 fffffff0 ce7d5000 bfffeb08
c0115ef7 d08a1000 00000000 ce824000 bffffc85 00000001 c0106c17 bffffc85
08060ac8 00000100 bffffc85 00000001 bfffeb08 00000081 0000002b 0000002b
Call Trace: [<c0116a53>] [<c0115ef7>] [<c0106c17>]
Code: 8b 83 c4 00 00 00 85 c0 74 0e 68 a4 a8 8a d0 50 e8 1f ce 8d


>>EIP; d08a8048 <END_OF_CODE+8be8/????> <=====

>>ecx; c0241ea0 <chrdevs+0/7f8>
>>edi; d08aa9c0 <END_OF_CODE+b560/????>
>>ebp; bfffeb08 Before first symbol
>>esp; ce825f88 <_end+e5c4db8/10620e90>

Trace; c0116a53 <free_module+17/98>
Trace; c0115ef7 <sys_delete_module+f3/1b0>
Trace; c0106c17 <system_call+33/38>

Code; d08a8048 <END_OF_CODE+8be8/????>
00000000 <_EIP>:
Code; d08a8048 <END_OF_CODE+8be8/????> <=====
0: 8b 83 c4 00 00 00 mov 0xc4(%ebx),%eax <=====
Code; d08a804e <END_OF_CODE+8bee/????>
6: 85 c0 test %eax,%eax
Code; d08a8050 <END_OF_CODE+8bf0/????>
8: 74 0e je 18 <_EIP+0x18>
Code; d08a8052 <END_OF_CODE+8bf2/????>
a: 68 a4 a8 8a d0 push $0xd08aa8a4
Code; d08a8057 <END_OF_CODE+8bf7/????>
f: 50 push %eax
Code; d08a8058 <END_OF_CODE+8bf8/????>
10: e8 1f ce 8d 00 call 8dce34 <_EIP+0x8dce34>

2002-12-16 14:06:24

by Alan

[permalink] [raw]
Subject: Re: 2.4.21-pre1 broke the ide-tape driver

On Sun, 2002-12-15 at 23:38, Mikael Pettersson wrote:
>
> On Sun, 15 Dec 2002 02:23:34 +0100, Marc-Christian Petersen wrote:
> >> Kernel 2.4.21-pre1 broke the ide-tape driver: the driver
> >> now hangs during initialisation. 2.2 kernels (with Andre's
> >> IDE patch) and 2.4 up to 2.4.20 do not have this problem.
> >> My box has a Seagate STT8000A ATAPI tape drive as hdd;
> >> hdc is a Philips CD-RW, and the controller is ICH2 (i850 chipset).
> >http://linux.bkbits.net:8080/linux-2.4/[email protected]?nav=index.html|ChangeSet@-7d|[email protected]
>
> Addendum: this patch fixes the init-time hang, and ide-tape does
> seem to work fine, but 'rmmod ide-tape' oopses -- 2.4.20-ac2 also
> oopses on 'rmmod ide-tape'.

I don't unfortunately have any ide-tape devices. I'll take a look though

2002-12-16 22:14:53

by Mikael Pettersson

[permalink] [raw]
Subject: Re: 2.4.21-pre1 broke the ide-tape driver

On 16 Dec 2002 14:53:33 +0000, Alan Cox wrote:
>On Sun, 2002-12-15 at 23:38, Mikael Pettersson wrote:
>>
>> On Sun, 15 Dec 2002 02:23:34 +0100, Marc-Christian Petersen wrote:
>> >> Kernel 2.4.21-pre1 broke the ide-tape driver: the driver
>> >> now hangs during initialisation. 2.2 kernels (with Andre's
>> >> IDE patch) and 2.4 up to 2.4.20 do not have this problem.
>> >> My box has a Seagate STT8000A ATAPI tape drive as hdd;
>> >> hdc is a Philips CD-RW, and the controller is ICH2 (i850 chipset).
>> >http://linux.bkbits.net:8080/linux-2.4/[email protected]?nav=index.html|ChangeSet@-7d|[email protected]
>>
>> Addendum: this patch fixes the init-time hang, and ide-tape does
>> seem to work fine, but 'rmmod ide-tape' oopses -- 2.4.20-ac2 also
>> oopses on 'rmmod ide-tape'.
>
>I don't unfortunately have any ide-tape devices. I'll take a look though

I can trigger the oops by a simple 'modprobe ide-tape; rmmod ide-tape'
even on boxes without ide-tape devices.

2002-12-16 23:23:01

by Mikael Pettersson

[permalink] [raw]
Subject: Re: 2.4.21-pre1 broke the ide-tape driver

I wrote:
>On Sun, 15 Dec 2002 02:23:34 +0100, Marc-Christian Petersen wrote:
>>> Kernel 2.4.21-pre1 broke the ide-tape driver: the driver
>>> now hangs during initialisation. 2.2 kernels (with Andre's
>>> IDE patch) and 2.4 up to 2.4.20 do not have this problem.
>>> My box has a Seagate STT8000A ATAPI tape drive as hdd;
>>> hdc is a Philips CD-RW, and the controller is ICH2 (i850 chipset).
>>http://linux.bkbits.net:8080/linux-2.4/[email protected]?nav=index.html|ChangeSet@-7d|[email protected]
>
>Addendum: this patch fixes the init-time hang, and ide-tape does
>seem to work fine, but 'rmmod ide-tape' oopses -- 2.4.20-ac2 also
>oopses on 'rmmod ide-tape'.

Solved, I think. Observe ide-tape's module_exit() procedure idetape_exit():

>static void __exit idetape_exit (void)
>{
> ide_drive_t *drive;
> int minor;
>
> for (minor = 0; minor < MAX_HWIFS * MAX_DRIVES; minor++) {
> drive = idetape_chrdevs[minor].drive;
> if (drive != NULL && idetape_cleanup(drive))
> printk(KERN_ERR "ide-tape: %s: cleanup_module() "
> "called while still busy\n", drive->name);
> }
>#ifdef CONFIG_PROC_FS
> if (drive->proc)
> ide_remove_proc_entries(drive->proc, idetape_proc);
>#endif
>
> ide_unregister_module(&idetape_module);
>}

In the "if (drive->proc)" line, drive==NULL when I rmmod ide-tape,
causing the oops.

I'm not sure if ide_remove_proc_entries() is needed or not,
but the current code is obviously broken.

- ide_unregister_module() removes ide-tape's proc entry
(/proc/ide/ideX/hdY/name) for us, at least that's what happens
on my box after I commented out the entire "if (drive->proc) ..."
statement to prevent the oops. So possibly the call should be deleted.

- ide-disk/ide-floppy do the test&call inside the loop rather than after,
so possibly the call should be moved into the loop, and augmented
to be "if (drive && drive->proc) ide_remove_proc_entries(...)".

/Mikael

2002-12-19 22:58:08

by Marcelo Tosatti

[permalink] [raw]
Subject: Re: 2.4.21-pre1 broke the ide-tape driver



On Tue, 17 Dec 2002, Mikael Pettersson wrote:

> I wrote:
> >On Sun, 15 Dec 2002 02:23:34 +0100, Marc-Christian Petersen wrote:
> >>> Kernel 2.4.21-pre1 broke the ide-tape driver: the driver
> >>> now hangs during initialisation. 2.2 kernels (with Andre's
> >>> IDE patch) and 2.4 up to 2.4.20 do not have this problem.
> >>> My box has a Seagate STT8000A ATAPI tape drive as hdd;
> >>> hdc is a Philips CD-RW, and the controller is ICH2 (i850 chipset).
> >>http://linux.bkbits.net:8080/linux-2.4/[email protected]?nav=index.html|ChangeSet@-7d|[email protected]
> >
> >Addendum: this patch fixes the init-time hang, and ide-tape does
> >seem to work fine, but 'rmmod ide-tape' oopses -- 2.4.20-ac2 also
> >oopses on 'rmmod ide-tape'.
>
> Solved, I think. Observe ide-tape's module_exit() procedure idetape_exit():
>
> >static void __exit idetape_exit (void)
> >{
> > ide_drive_t *drive;
> > int minor;
> >
> > for (minor = 0; minor < MAX_HWIFS * MAX_DRIVES; minor++) {
> > drive = idetape_chrdevs[minor].drive;
> > if (drive != NULL && idetape_cleanup(drive))
> > printk(KERN_ERR "ide-tape: %s: cleanup_module() "
> > "called while still busy\n", drive->name);
> > }
> >#ifdef CONFIG_PROC_FS
> > if (drive->proc)
> > ide_remove_proc_entries(drive->proc, idetape_proc);
> >#endif
> >
> > ide_unregister_module(&idetape_module);
> >}
>
> In the "if (drive->proc)" line, drive==NULL when I rmmod ide-tape,
> causing the oops.
>
> I'm not sure if ide_remove_proc_entries() is needed or not,
> but the current code is obviously broken.
>
> - ide_unregister_module() removes ide-tape's proc entry
> (/proc/ide/ideX/hdY/name) for us, at least that's what happens
> on my box after I commented out the entire "if (drive->proc) ..."
> statement to prevent the oops. So possibly the call should be deleted.
>
> - ide-disk/ide-floppy do the test&call inside the loop rather than after,
> so possibly the call should be moved into the loop, and augmented
> to be "if (drive && drive->proc) ide_remove_proc_entries(...)".

Yes... here is a patch which moves the ide_remove_proc_entries inside the
detection loop. Without ide_remove_proc_entries inside the loop we would
also not unregister more than one device /proc entries, too.

Please test it, works for me.

--- linux-bk/drivers/ide/ide-tape.c 2002-12-19 18:05:07.000000000 -0200
+++ linux-2.4.21/drivers/ide/ide-tape.c 2002-12-19 17:59:39.000000000 -0200
@@ -6597,14 +6597,16 @@

for (minor = 0; minor < MAX_HWIFS * MAX_DRIVES; minor++) {
drive = idetape_chrdevs[minor].drive;
- if (drive != NULL && idetape_cleanup(drive))
- printk(KERN_ERR "ide-tape: %s: cleanup_module() "
- "called while still busy\n", drive->name);
- }
+ if (drive) {
+ if (idetape_cleanup(drive))
+ printk(KERN_ERR "ide-tape: %s: cleanup_module() "
+ "called while still busy\n", drive->name);
#ifdef CONFIG_PROC_FS
- if (drive->proc)
- ide_remove_proc_entries(drive->proc, idetape_proc);
+ if (drive->proc)
+ ide_remove_proc_entries(drive->proc, idetape_proc);
#endif
+ }
+ }

ide_unregister_module(&idetape_module);
}

2002-12-20 17:56:04

by Mikael Pettersson

[permalink] [raw]
Subject: Re: 2.4.21-pre1 broke the ide-tape driver

On Thu, 19 Dec 2002 18:08:15 -0200 (BRST), Marcelo Tosatti wrote:
>> - ide-disk/ide-floppy do the test&call inside the loop rather than after,
>> so possibly the call should be moved into the loop, and augmented
>> to be "if (drive && drive->proc) ide_remove_proc_entries(...)".
>
>Yes... here is a patch which moves the ide_remove_proc_entries inside the
>detection loop. Without ide_remove_proc_entries inside the loop we would
>also not unregister more than one device /proc entries, too.
>
>Please test it, works for me.

Tested. Works for me too.

/Mikael

>
>--- linux-bk/drivers/ide/ide-tape.c 2002-12-19 18:05:07.000000000 -0200
>+++ linux-2.4.21/drivers/ide/ide-tape.c 2002-12-19 17:59:39.000000000 -0200
>@@ -6597,14 +6597,16 @@
>
> for (minor = 0; minor < MAX_HWIFS * MAX_DRIVES; minor++) {
> drive = idetape_chrdevs[minor].drive;
>- if (drive != NULL && idetape_cleanup(drive))
>- printk(KERN_ERR "ide-tape: %s: cleanup_module() "
>- "called while still busy\n", drive->name);
>- }
>+ if (drive) {
>+ if (idetape_cleanup(drive))
>+ printk(KERN_ERR "ide-tape: %s: cleanup_module() "
>+ "called while still busy\n", drive->name);
> #ifdef CONFIG_PROC_FS
>- if (drive->proc)
>- ide_remove_proc_entries(drive->proc, idetape_proc);
>+ if (drive->proc)
>+ ide_remove_proc_entries(drive->proc, idetape_proc);
> #endif
>+ }
>+ }
>
> ide_unregister_module(&idetape_module);
> }
>