2005-04-28 16:45:35

by Alan

[permalink] [raw]
Subject: IDE problems with rmmod ide-cd

If you rmmod ide-cd in 2.6.12rc3 it issues a cache flush command to the
drive. Thankfully the bogus command this time is an ATAPI cache flush
not an ATA one so won't do any major harm but its still wrong as the
device is not a writer or packet mode capable (its a random DVD reader
holding a music CD)

Alan


2005-04-28 17:25:50

by Jens Axboe

[permalink] [raw]
Subject: Re: IDE problems with rmmod ide-cd

On Thu, Apr 28 2005, Alan Cox wrote:
> If you rmmod ide-cd in 2.6.12rc3 it issues a cache flush command to the
> drive. Thankfully the bogus command this time is an ATAPI cache flush
> not an ATA one so won't do any major harm but its still wrong as the
> device is not a writer or packet mode capable (its a random DVD reader
> holding a music CD)

The problem you are thinking of was also an ATAPI cache flush command,
so I'm not so sure I would call it harmless... I haven't changed
anything in there recently, Bart?

--
Jens Axboe

Subject: Re: IDE problems with rmmod ide-cd

On 4/28/05, Jens Axboe <[email protected]> wrote:
> On Thu, Apr 28 2005, Alan Cox wrote:
> > If you rmmod ide-cd in 2.6.12rc3 it issues a cache flush command to the
> > drive. Thankfully the bogus command this time is an ATAPI cache flush
> > not an ATA one so won't do any major harm but its still wrong as the
> > device is not a writer or packet mode capable (its a random DVD reader
> > holding a music CD)
>
> The problem you are thinking of was also an ATAPI cache flush command,
> so I'm not so sure I would call it harmless... I haven't changed
> anything in there recently, Bart?

I don't remember changing anything there recently.
Alan, please give more details of the issue.

Bartlomiej

2005-04-28 21:52:43

by Alan

[permalink] [raw]
Subject: Re: IDE problems with rmmod ide-cd

On Iau, 2005-04-28 at 21:46, Bartlomiej Zolnierkiewicz wrote:
> > The problem you are thinking of was also an ATAPI cache flush command,
> > so I'm not so sure I would call it harmless... I haven't changed
> > anything in there recently, Bart?
>
> I don't remember changing anything there recently.
> Alan, please give more details of the issue.

Torvalds tree - head

Hardware is as follows
Promise IDE controller on ide0/1 - no drives
VIA IDE controller on ide2/3 - hdd is a DVD-ROM
and hdg is a disk.

hdd: TOSHIBA DVD-ROM SD-M1212

I had some code logging the commands issued and I did rmmod ide-cd. At
that point it sent a cache flush to the drive which then errorred it.

The actual log entry is

hdd: packet command error
Gives status=0x51, error=0x50

Dumping the error in detail its

Error;Illegal Request (Sense 0x05)
Invalid command operation code (0x20, 0x00)
The failed "Flush cache" packet command was
"35 00 00 00 00 00 ... 00"


Subject: Re: IDE problems with rmmod ide-cd

On 4/28/05, Alan Cox <[email protected]> wrote:
> On Iau, 2005-04-28 at 21:46, Bartlomiej Zolnierkiewicz wrote:
> > > The problem you are thinking of was also an ATAPI cache flush command,
> > > so I'm not so sure I would call it harmless... I haven't changed
> > > anything in there recently, Bart?
> >
> > I don't remember changing anything there recently.
> > Alan, please give more details of the issue.
>
> Torvalds tree - head
>
> Hardware is as follows
> Promise IDE controller on ide0/1 - no drives
> VIA IDE controller on ide2/3 - hdd is a DVD-ROM
> and hdg is a disk.
>
> hdd: TOSHIBA DVD-ROM SD-M1212
>
> I had some code logging the commands issued and I did rmmod ide-cd. At
> that point it sent a cache flush to the drive which then errorred it.
>
> The actual log entry is
>
> hdd: packet command error
> Gives status=0x51, error=0x50
>
> Dumping the error in detail its
>
> Error;Illegal Request (Sense 0x05)
> Invalid command operation code (0x20, 0x00)
> The failed "Flush cache" packet command was
> "35 00 00 00 00 00 ... 00"

I would suggest auditing MRW support in cdrom.c.
IDE layer itself never sends GPCMD_FLUSH_CACHE.

2005-04-28 22:25:28

by Alan

[permalink] [raw]
Subject: Re: IDE problems with rmmod ide-cd

On Iau, 2005-04-28 at 18:25, Jens Axboe wrote:
> The problem you are thinking of was also an ATAPI cache flush command,
> so I'm not so sure I would call it harmless... I haven't changed
> anything in there recently, Bart?

Eeep - I must admit to being somewhat baffled where it is coming from
too. Its occurring between the rmmod starting and the userspace
notifiers from the syslog ordering but I don't see anything that would
queue flushes on the IDE side. The power management does check and
issues WIN_FLUSH_CACHE* stuff. The cd layer only seems to issue it in
the dvd rw close path and that checks media written and mmc3 bits or in
places like cdrom_mrw_exit.

One possibility might be that the specific drive is incorrectly
reporting capabilities and register_cdrom is setting cdi->exit as a
result. Will try and work out what is going on there tomorrow.

2005-04-29 14:04:44

by Alan

[permalink] [raw]
Subject: Re: IDE problems with rmmod ide-cd

On Iau, 2005-04-28 at 23:24, Alan Cox wrote:
> One possibility might be that the specific drive is incorrectly
> reporting capabilities and register_cdrom is setting cdi->exit as a
> result. Will try and work out what is going on there tomorrow.

Looks like a dumb bug in ide-cd. The error is coming from mrw_exit.

That gets called because ide-cd sets mask to 0 "I do everything" and
then subtracts features by checking drive bits. What it should do is set
the mask to every flag it knows about and then work back.

The ide-cd code doesn't know about CDC_MRW_W so its always a zero bit in
the mask, CDROM_CAN(CDC_MRW_W) is always true and cache flushes get
written.

Alan