2003-07-23 17:56:43

by Dave Lawrence

[permalink] [raw]
Subject: compact flash IDE hot-swap summary please

I have read through some old threads on this mailing
list and am confused about what is and isn't supported
by Linux in the area of removable IDE devices. I
apologize in advance for my ignorance, but I think there
are others nearly as ignorant as I that could benefit
from answers to these questions.

I have a Zaurus handheld that runs Linux that seems
to be able to hot-swap its IDE compact flash device
with no problems. But I've read in a recent
thread "hdparm and removable IDE?" that hot-swap
isn't "fully" supported and that is won't be
until:

>2.7 at the earliest, and only if there is a general buy in about such a
>change to the init handling. Similarly the big issues with hdparm -U and
>-R are the same as with hotplug races, and will take a lot more than
>quick hacks to fix.
>
>Alan Cox

How come my Zaurus hot-swaps fine (or does it have
intermittent problems that I've just never seen?)?


I have a single board computer with one IDE connector
that has two compact flash (one master (hda), one slave (hdb))
IDE devices connected to the one cable. Is it possible in
Linux now to (safely) remove the slave compact flash
device after unmounting all partitions on that device?
If not, will it ever be possible (or is there a hardware
limitation that precludes doing this?)?

Is it possible in Linux now to (safely) remove the slave
compact flash without unmounting the partitions (assuming
you're using a file system like ext3 that is robust to
shutdowns)?

If not, will this ever be supported (and when?) or is there a
hardware limitation that precludes it?

How about if the compact flash device is in a SanDisk
USB card reader or a Lexar Jumpshot USB card reader?
Is hot-swapping of such media supported today without
unmounting the partitions? If not, will it ever be?


Also, there were two related threads in January/February of
2002 that discussed the removability of compact flash:

false positives on disk change checks
PROBLEM: ext2/mount - multiple mounts corrupts inodes

The original problem was that in 2.4 kernels, compact
flash disks are corrupted if you remount already mounted
partitions. Somebody found a hack workaround for this
problem, which was to remove the following lines of
code from ide-probe.c:

> if (id->config & (1<<7))
> drive->removable = 1;
> +#endif

However, Andre Hedrick had the following response to
this hack:

>REGARDLESS, it is removable media and this it reports so.
>The driver will not change to create false reports, because CFA has its
>own rules, and if you can figure them out great.
>
>Removable media shall always report as Removable media.
>
>If you purchase enough of the media, the OEM will allow you to alter the
>identify page and this it will not longer report "Removable".
>
>Regards,
>
>Andre Hedrick
>Linux Disk Certification Project Linux ATA Development

It seems like Andre is implying the problem that is
causing my compact flash disk corruption is that the
disk is reporting being removable when it actually
is not. But what good is it for the disk to be
flagged as removable if hot-swapping isn't supported?
Shouldn't the "hack" solution be put into the kernel
(at least as a configuration option) until the kernel
fully supports removable compact flash (at which time,
one would hope that you could remount compact flash
without disk curruption)? In 2.2 kernels,
compact flash disks weren't corrupted by remounts - in
2.4 they are.

On a potentially related note (or maybe completely
off-topic), I always get these kernel messages when
using compact flash:
hda: task_no_data_intr: status=0x51 { DriveReady SeekComplete Error }
hda: task_no_data_intr: error=0x04 { DriveStatusError }
They don't seem to be related to any real problem. How do
I make those error messages go away?


Thanks in advance for a "hotswap for dummies" summary.

Dave


2003-07-23 18:08:56

by Alan

[permalink] [raw]
Subject: Re: compact flash IDE hot-swap summary please

On Mer, 2003-07-23 at 19:11, Dave Lawrence wrote:
> I have a Zaurus handheld that runs Linux that seems
> to be able to hot-swap its IDE compact flash device
> with no problems. But I've read in a recent
> thread "hdparm and removable IDE?" that hot-swap
> isn't "fully" supported and that is won't be
> until:

Thats hot swapping an IDE controller (built into the CF and
PCMCIA stuff)

Drive level hotswap is supported only in the "I unmounted it all
properly first" case and providing your system has the required bus
isolation. Typically its also only allowed in IDE if you have a
single disk on the channel. With dual device you tend to have nasty
accidents pulling something out while the other device is "live"


2003-07-23 19:08:36

by Andre Hedrick

[permalink] [raw]
Subject: Re: compact flash IDE hot-swap summary please


You never remove the "TrueIDE" from the cable so the bridge chip saves
you. Go try it with standard media and you will see different.

Andre Hedrick
LAD Storage Consulting Group

On Wed, 23 Jul 2003, Dave Lawrence wrote:

> I have read through some old threads on this mailing
> list and am confused about what is and isn't supported
> by Linux in the area of removable IDE devices. I
> apologize in advance for my ignorance, but I think there
> are others nearly as ignorant as I that could benefit
> from answers to these questions.
>
> I have a Zaurus handheld that runs Linux that seems
> to be able to hot-swap its IDE compact flash device
> with no problems. But I've read in a recent
> thread "hdparm and removable IDE?" that hot-swap
> isn't "fully" supported and that is won't be
> until:
>
> >2.7 at the earliest, and only if there is a general buy in about such a
> >change to the init handling. Similarly the big issues with hdparm -U and
> >-R are the same as with hotplug races, and will take a lot more than
> >quick hacks to fix.
> >
> >Alan Cox
>
> How come my Zaurus hot-swaps fine (or does it have
> intermittent problems that I've just never seen?)?
>
>
> I have a single board computer with one IDE connector
> that has two compact flash (one master (hda), one slave (hdb))
> IDE devices connected to the one cable. Is it possible in
> Linux now to (safely) remove the slave compact flash
> device after unmounting all partitions on that device?
> If not, will it ever be possible (or is there a hardware
> limitation that precludes doing this?)?
>
> Is it possible in Linux now to (safely) remove the slave
> compact flash without unmounting the partitions (assuming
> you're using a file system like ext3 that is robust to
> shutdowns)?
>
> If not, will this ever be supported (and when?) or is there a
> hardware limitation that precludes it?
>
> How about if the compact flash device is in a SanDisk
> USB card reader or a Lexar Jumpshot USB card reader?
> Is hot-swapping of such media supported today without
> unmounting the partitions? If not, will it ever be?
>
>
> Also, there were two related threads in January/February of
> 2002 that discussed the removability of compact flash:
>
> false positives on disk change checks
> PROBLEM: ext2/mount - multiple mounts corrupts inodes
>
> The original problem was that in 2.4 kernels, compact
> flash disks are corrupted if you remount already mounted
> partitions. Somebody found a hack workaround for this
> problem, which was to remove the following lines of
> code from ide-probe.c:
>
> > if (id->config & (1<<7))
> > drive->removable = 1;
> > +#endif
>
> However, Andre Hedrick had the following response to
> this hack:
>
> >REGARDLESS, it is removable media and this it reports so.
> >The driver will not change to create false reports, because CFA has its
> >own rules, and if you can figure them out great.
> >
> >Removable media shall always report as Removable media.
> >
> >If you purchase enough of the media, the OEM will allow you to alter the
> >identify page and this it will not longer report "Removable".
> >
> >Regards,
> >
> >Andre Hedrick
> >Linux Disk Certification Project Linux ATA Development
>
> It seems like Andre is implying the problem that is
> causing my compact flash disk corruption is that the
> disk is reporting being removable when it actually
> is not. But what good is it for the disk to be
> flagged as removable if hot-swapping isn't supported?
> Shouldn't the "hack" solution be put into the kernel
> (at least as a configuration option) until the kernel
> fully supports removable compact flash (at which time,
> one would hope that you could remount compact flash
> without disk curruption)? In 2.2 kernels,
> compact flash disks weren't corrupted by remounts - in
> 2.4 they are.
>
> On a potentially related note (or maybe completely
> off-topic), I always get these kernel messages when
> using compact flash:
> hda: task_no_data_intr: status=0x51 { DriveReady SeekComplete Error }
> hda: task_no_data_intr: error=0x04 { DriveStatusError }
> They don't seem to be related to any real problem. How do
> I make those error messages go away?
>
>
> Thanks in advance for a "hotswap for dummies" summary.
>
> Dave
> -
> 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/
>

2003-07-23 19:36:49

by Russell King

[permalink] [raw]
Subject: Re: compact flash IDE hot-swap summary please

On Wed, Jul 23, 2003 at 12:12:47PM -0700, Andre Hedrick wrote:
> You never remove the "TrueIDE" from the cable so the bridge chip saves
> you. Go try it with standard media and you will see different.

There is no IDE interface on the Zaurus. It connects to the PCMCIA
interface.

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

2003-07-23 19:35:00

by Russell King

[permalink] [raw]
Subject: Re: compact flash IDE hot-swap summary please

On Wed, Jul 23, 2003 at 07:18:23PM +0100, Alan Cox wrote:
> On Mer, 2003-07-23 at 19:11, Dave Lawrence wrote:
> > I have a Zaurus handheld that runs Linux that seems
> > to be able to hot-swap its IDE compact flash device
> > with no problems. But I've read in a recent
> > thread "hdparm and removable IDE?" that hot-swap
> > isn't "fully" supported and that is won't be
> > until:
>
> Thats hot swapping an IDE controller (built into the CF and
> PCMCIA stuff)
>
> Drive level hotswap is supported only in the "I unmounted it all
> properly first" case and providing your system has the required bus
> isolation. Typically its also only allowed in IDE if you have a
> single disk on the channel. With dual device you tend to have nasty
> accidents pulling something out while the other device is "live"

Any ideas if this is going to be fixed for 2.6? I think this is a show
stopper, certainly for embedded devices - a fair number of people do use
CF cards in their embedded solutions, and some of us hotplug CF cards to
grab images off our digital cameras.

I've had people at KS/OLS approach me about this issue in both 2.4 and
2.6 kernels.

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

2003-07-23 19:41:18

by Andre Hedrick

[permalink] [raw]
Subject: Re: compact flash IDE hot-swap summary please


Russell,

Thanks, we are saying the same thing. Just you simplified the answer.

Cheers,

Andre Hedrick
LAD Storage Consulting Group

On Wed, 23 Jul 2003, Russell King wrote:

> On Wed, Jul 23, 2003 at 12:12:47PM -0700, Andre Hedrick wrote:
> > You never remove the "TrueIDE" from the cable so the bridge chip saves
> > you. Go try it with standard media and you will see different.
>
> There is no IDE interface on the Zaurus. It connects to the PCMCIA
> interface.
>
> --
> Russell King ([email protected]) The developer of ARM Linux
> http://www.arm.linux.org.uk/personal/aboutme.html
>

2003-07-23 20:06:16

by Alan

[permalink] [raw]
Subject: Re: compact flash IDE hot-swap summary please

On Mer, 2003-07-23 at 20:49, Russell King wrote:
> > Drive level hotswap is supported only in the "I unmounted it all
> > properly first" case and providing your system has the required bus
> > isolation. Typically its also only allowed in IDE if you have a
> > single disk on the channel. With dual device you tend to have nasty
> > accidents pulling something out while the other device is "live"
>
> Any ideas if this is going to be fixed for 2.6? I think this is a show
> stopper, certainly for embedded devices - a fair number of people do use
> CF cards in their embedded solutions, and some of us hotplug CF cards to
> grab images off our digital cameras.

Everyone I know is using the PCMCIA interface stuff for that. Now that
can support the unplugging but the ide-cs code is still not doing the
right things in this case (and the core could be a little more careful).
The ide_unregister can fail - you are supposed to call it again later if
it does - ide_cs doesnt

2003-07-23 21:00:24

by Russell King

[permalink] [raw]
Subject: Re: compact flash IDE hot-swap summary please

On Wed, Jul 23, 2003 at 09:13:51PM +0100, Alan Cox wrote:
> Everyone I know is using the PCMCIA interface stuff for that. Now that
> can support the unplugging but the ide-cs code is still not doing the
> right things in this case (and the core could be a little more careful).
> The ide_unregister can fail - you are supposed to call it again later if
> it does - ide_cs doesnt

Ok, I see a couple of problems here.

Firstly, how does ide_cs in 2.6.0-test1 know that ide_unregister has
failed? In my copy of 2.6.0-test1, it doesn't return any values.

Secondly, 2.4.21 seems to fail with value '1' for two cases:
- the ide interface wasn't found to be present
- the drive is in use
- the shutdown fails

In the first case, we just want to forget all about the interface - we
don't want to retry at some time in the future. In the second case,
well, the device has physically gone, so any outstanding requests are
not going to complete. Hopefully an in-progress request should time
out, but we shouldn't try to start a new request.

Thirdly, we don't change the iops on unregister. Some hardware returns
random garbage to reads from the PCMCIA space when there isn't a card
present.

So, in short, I think that IDE unplug is broken in the core IDE driver
and needs significant work in _both_ 2.4 and 2.6 before we can think
about getting PCMCIA-based IDE cards to work sufficiently well. Yes,
ide-cs.c may need some work, but ide.c also requires work.

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

2003-07-23 22:06:45

by Alan

[permalink] [raw]
Subject: Re: compact flash IDE hot-swap summary please

On Mer, 2003-07-23 at 22:15, Russell King wrote:
> Ok, I see a couple of problems here.
>
> Firstly, how does ide_cs in 2.6.0-test1 know that ide_unregister has
> failed? In my copy of 2.6.0-test1, it doesn't return any values.

It does in 2.4. For 2.6 check with Bart - it may be the need has gone
away or that stuff got "cleaned up" that was needed

> Secondly, 2.4.21 seems to fail with value '1' for two cases:
> - the ide interface wasn't found to be present
> - the drive is in use
> - the shutdown fails

Right. We want multiple fail cases. I know this - ditto it needs to
zap the iops

> not going to complete. Hopefully an in-progress request should time
> out, but we shouldn't try to start a new request.

Once we've flipped the iops it wont matter if we accidentally queue
new requests.

> So, in short, I think that IDE unplug is broken in the core IDE driver
> and needs significant work in _both_ 2.4 and 2.6 before we can think
> about getting PCMCIA-based IDE cards to work sufficiently well. Yes,
> ide-cs.c may need some work, but ide.c also requires work.

You need a call in it to zap the iops, 3 return codes so you can tell
the difference - anything else ? If not I'll fix those.

2003-08-14 00:22:05

by Vojtech Pavlik

[permalink] [raw]
Subject: Re: compact flash IDE hot-swap summary please

On Wed, Jul 23, 2003 at 07:18:23PM +0100, Alan Cox wrote:
> On Mer, 2003-07-23 at 19:11, Dave Lawrence wrote:
> > I have a Zaurus handheld that runs Linux that seems
> > to be able to hot-swap its IDE compact flash device
> > with no problems. But I've read in a recent
> > thread "hdparm and removable IDE?" that hot-swap
> > isn't "fully" supported and that is won't be
> > until:
>
> Thats hot swapping an IDE controller (built into the CF and
> PCMCIA stuff)

Is there any difference between pulling the controller out and the drive
out in the PCMCIA/CF case? I think there is not - since there is no
BMDMA engines, it boils down to just the command/nsect/chs registers,
which are in the drive.

--
Vojtech Pavlik
SuSE Labs, SuSE CR