* [PATCH] powerpc: Fix ide-pmac sysfs entry
@ 2006-05-15 6:58 Benjamin Herrenschmidt
2006-05-15 7:08 ` Andrew Morton
0 siblings, 1 reply; 7+ messages in thread
From: Benjamin Herrenschmidt @ 2006-05-15 6:58 UTC (permalink / raw)
To: Paul Mackerras
Cc: Bartlomiej Zolnierkiewicz, Andrew Morton, linuxppc-dev list
It looks like the generic ide code now wants ide_init_hwif_ports() to
set the parent struct device into the ide_hw structure (new field ?).
Without this, the mac ide code can cause the ide probing code to explode
in flames in sysfs registration due to what looks like a stale pointer
in there (happens when removing/re-inserting one of the hotswap media
bays on some laptops).
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
Andew: That's a 2.6.17 candidate
Index: linux-work/drivers/ide/ppc/pmac.c
===================================================================
--- linux-work.orig/drivers/ide/ppc/pmac.c 2006-04-19 15:04:47.000000000 +1000
+++ linux-work/drivers/ide/ppc/pmac.c 2006-05-15 16:43:20.000000000 +1000
@@ -553,6 +553,8 @@
if (irq != NULL)
*irq = pmac_ide[ix].irq;
+
+ hw->dev = &pmac_ide[ix].mdev->ofdev.dev;
}
#define PMAC_IDE_REG(x) ((void __iomem *)(IDE_DATA_REG+(x)))
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc: Fix ide-pmac sysfs entry
2006-05-15 6:58 [PATCH] powerpc: Fix ide-pmac sysfs entry Benjamin Herrenschmidt
@ 2006-05-15 7:08 ` Andrew Morton
2006-05-15 7:23 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2006-05-15 7:08 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: B.Zolnierkiewicz, linuxppc-dev, paulus, Pete Popov, Alan Cox
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
>
> It looks like the generic ide code now wants ide_init_hwif_ports() to
> set the parent struct device into the ide_hw structure (new field ?).
> Without this, the mac ide code can cause the ide probing code to explode
> in flames in sysfs registration due to what looks like a stale pointer
> in there (happens when removing/re-inserting one of the hotswap media
> bays on some laptops).
>
You don't sound very confident.
> ---
>
> Andew: That's a 2.6.17 candidate
>
> Index: linux-work/drivers/ide/ppc/pmac.c
> ===================================================================
> --- linux-work.orig/drivers/ide/ppc/pmac.c 2006-04-19 15:04:47.000000000 +1000
> +++ linux-work/drivers/ide/ppc/pmac.c 2006-05-15 16:43:20.000000000 +1000
> @@ -553,6 +553,8 @@
>
> if (irq != NULL)
> *irq = pmac_ide[ix].irq;
> +
> + hw->dev = &pmac_ide[ix].mdev->ofdev.dev;
> }
>
> #define PMAC_IDE_REG(x) ((void __iomem *)(IDE_DATA_REG+(x)))
>
afaict things went bad in October last year. hw_regs_t.dev was added here:
http://www.kernel.org/git/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=26a940e21752e0de8f068f77dad606a7d1986937
but that only converted one driver to initialse ->dev.
How come things didn't break then? Did some later change cause the
problems?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc: Fix ide-pmac sysfs entry
2006-05-15 7:08 ` Andrew Morton
@ 2006-05-15 7:23 ` Benjamin Herrenschmidt
2006-05-15 8:38 ` Gabriel Paubert
0 siblings, 1 reply; 7+ messages in thread
From: Benjamin Herrenschmidt @ 2006-05-15 7:23 UTC (permalink / raw)
To: Andrew Morton
Cc: B.Zolnierkiewicz, linuxppc-dev, paulus, Pete Popov, Alan Cox
On Mon, 2006-05-15 at 00:08 -0700, Andrew Morton wrote:
> Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> >
> > It looks like the generic ide code now wants ide_init_hwif_ports() to
> > set the parent struct device into the ide_hw structure (new field ?).
> > Without this, the mac ide code can cause the ide probing code to explode
> > in flames in sysfs registration due to what looks like a stale pointer
> > in there (happens when removing/re-inserting one of the hotswap media
> > bays on some laptops).
> >
>
> You don't sound very confident.
Well, the problem is fixed with my change, I'd like to have Bart
confirmation that's its the right approach. It looks like it is but that
code is fairly intricated :)
> afaict things went bad in October last year. hw_regs_t.dev was added here:
>
> http://www.kernel.org/git/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=26a940e21752e0de8f068f77dad606a7d1986937
>
> but that only converted one driver to initialse ->dev.
>
> How come things didn't break then? Did some later change cause the
> problems?
Well, for one, very few drivers cause ide_unregister nor rely on those
old mecanism... it seems that the way I initialize things at boot works
fine, it's when I unregister/re-register via the hotswap bay that things
go bunk.
It's possible that it got broken back then and not noticed since ... or
another change actually made _use_ of that field... not sure, Bart might
confirm. The Mac laptops with those hotswap bays are fairly old and I
haven't tested for some time. I just did after getting user reports, and
users of old machines like that tend to use stable distro kernels which
tend to be fairly old...
Ben.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc: Fix ide-pmac sysfs entry
2006-05-15 7:23 ` Benjamin Herrenschmidt
@ 2006-05-15 8:38 ` Gabriel Paubert
2006-05-15 8:52 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 7+ messages in thread
From: Gabriel Paubert @ 2006-05-15 8:38 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: Andrew Morton, Pete Popov, B.Zolnierkiewicz, linuxppc-dev, paulus,
Alan Cox
On Mon, May 15, 2006 at 05:23:50PM +1000, Benjamin Herrenschmidt wrote:
> On Mon, 2006-05-15 at 00:08 -0700, Andrew Morton wrote:
> > Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> > >
> > > It looks like the generic ide code now wants ide_init_hwif_ports() to
> > > set the parent struct device into the ide_hw structure (new field ?).
> > > Without this, the mac ide code can cause the ide probing code to explode
> > > in flames in sysfs registration due to what looks like a stale pointer
> > > in there (happens when removing/re-inserting one of the hotswap media
> > > bays on some laptops).
> > >
> >
> > You don't sound very confident.
>
> Well, the problem is fixed with my change, I'd like to have Bart
> confirmation that's its the right approach. It looks like it is but that
> code is fairly intricated :)
>
> > afaict things went bad in October last year. hw_regs_t.dev was added here:
> >
> > http://www.kernel.org/git/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=26a940e21752e0de8f068f77dad606a7d1986937
> >
> > but that only converted one driver to initialse ->dev.
> >
> > How come things didn't break then? Did some later change cause the
> > problems?
>
> Well, for one, very few drivers cause ide_unregister nor rely on those
> old mecanism... it seems that the way I initialize things at boot works
> fine, it's when I unregister/re-register via the hotswap bay that things
> go bunk.
>
> It's possible that it got broken back then and not noticed since ... or
> another change actually made _use_ of that field... not sure, Bart might
> confirm. The Mac laptops with those hotswap bays are fairly old and I
> haven't tested for some time. I just did after getting user reports, and
> users of old machines like that tend to use stable distro kernels which
> tend to be fairly old...
Actually I have one of these, and regularly use it and update
the kernel to the latest git once or twice per month, but I
typically have two batteries and have not swapped in the
media bay under Linux for a long time.
If you are interested, I could test the patch when I find
some time (not today: my 8 year old son went to the hospital
for an emergency last Thursday, he is cured now and should
come out today).
Regards,
Gabriel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc: Fix ide-pmac sysfs entry
2006-05-15 8:38 ` Gabriel Paubert
@ 2006-05-15 8:52 ` Benjamin Herrenschmidt
2006-05-21 21:30 ` Gabriel Paubert
0 siblings, 1 reply; 7+ messages in thread
From: Benjamin Herrenschmidt @ 2006-05-15 8:52 UTC (permalink / raw)
To: Gabriel Paubert
Cc: Andrew Morton, Pete Popov, B.Zolnierkiewicz, linuxppc-dev, paulus,
Alan Cox
> Actually I have one of these, and regularly use it and update
> the kernel to the latest git once or twice per month, but I
> typically have two batteries and have not swapped in the
> media bay under Linux for a long time.
>
> If you are interested, I could test the patch when I find
> some time (not today: my 8 year old son went to the hospital
> for an emergency last Thursday, he is cured now and should
> come out today).
Any test is welcome, glad to know your son is well !
Cheers,
Ben.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc: Fix ide-pmac sysfs entry
2006-05-15 8:52 ` Benjamin Herrenschmidt
@ 2006-05-21 21:30 ` Gabriel Paubert
2006-05-21 21:46 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 7+ messages in thread
From: Gabriel Paubert @ 2006-05-21 21:30 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: Andrew Morton, Pete Popov, B.Zolnierkiewicz, linuxppc-dev, paulus,
Alan Cox
On Mon, May 15, 2006 at 06:52:36PM +1000, Benjamin Herrenschmidt wrote:
>
> > Actually I have one of these, and regularly use it and update
> > the kernel to the latest git once or twice per month, but I
> > typically have two batteries and have not swapped in the
> > media bay under Linux for a long time.
> >
> > If you are interested, I could test the patch when I find
> > some time (not today: my 8 year old son went to the hospital
> > for an emergency last Thursday, he is cured now and should
> > come out today).
>
> Any test is welcome, glad to know your son is well !
The one liner works here, I can no more solidly hang
the machine. There is still a bunch of error messages
on drive removal though:
mediabay0: switching to 7
mediabay0: powering down
media bay 0 is empty
Unregistering mb 0 ide, index:2
hde: status error: status=0x00 { }
ide: failed opcode was: unknown
hde: status error: status=0x00 { }
ide: failed opcode was: unknown
hde: status error: status=0x00 { }
ide: failed opcode was: unknown
hde: status error: status=0x00 { }
ide: failed opcode was: unknown
hde: DMA disabled
hde: ATAPI reset complete
hde: status error: status=0x00 { }
ide: failed opcode was: unknown
hde: status error: status=0x00 { }
ide: failed opcode was: unknown
hde: status error: status=0x00 { }
ide: failed opcode was: unknown
hde: status error: status=0x00 { }
ide: failed opcode was: unknown
hde: ATAPI reset complete
hde: status error: status=0x00 { }
ide: failed opcode was: unknown
hde: status error: status=0x00 { }
ide: failed opcode was: unknown
hde: status error: status=0x00 { }
ide: failed opcode was: unknown
hde: status error: status=0x00 { }
ide: failed opcode was: unknown
hde: status error: status=0x00 { }
ide: failed opcode was: unknown
hde: ATAPI reset complete
hde: status error: status=0x00 { }
ide: failed opcode was: unknown
hde: status error: status=0x00 { }
ide: failed opcode was: unknown
hde: status error: status=0x00 { }
ide: failed opcode was: unknown
hde: status error: status=0x00 { }
ide: failed opcode was: unknown
hde: ATAPI reset complete
hde: status error: status=0x00 { }
ide: failed opcode was: unknown
mediabay0: end of power down
On insertion there are also a few messages
but they seem normal:
mediabay0: switching to 3
mediabay0: powering up
mediabay0: enabling (kind:3)
mediabay0: waiting reset (kind:3)
mediabay0: waiting IDE reset (kind:3)
mediabay0: waiting IDE ready (kind:3)
mediabay 0, registering IDE...
Probing IDE interface ide2...
hde: LG DVD-ROM DRN-8080B, ATAPI CD/DVD-ROM drive
hde: Enabling MultiWord DMA 2
ide2 at 0xf1022000-0xf1022007,0xf1022160 on irq 20
hde: ATAPI 24X DVD-ROM drive, 512kB Cache, DMA
media-bay 0 is ide2
mediabay 0 IDE ready
Regards,
Gabriel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc: Fix ide-pmac sysfs entry
2006-05-21 21:30 ` Gabriel Paubert
@ 2006-05-21 21:46 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 7+ messages in thread
From: Benjamin Herrenschmidt @ 2006-05-21 21:46 UTC (permalink / raw)
To: Gabriel Paubert
Cc: Andrew Morton, Pete Popov, B.Zolnierkiewicz, linuxppc-dev, paulus,
Alan Cox
On Sun, 2006-05-21 at 23:30 +0200, Gabriel Paubert wrote:
> On Mon, May 15, 2006 at 06:52:36PM +1000, Benjamin Herrenschmidt wrote:
> >
> > > Actually I have one of these, and regularly use it and update
> > > the kernel to the latest git once or twice per month, but I
> > > typically have two batteries and have not swapped in the
> > > media bay under Linux for a long time.
> > >
> > > If you are interested, I could test the patch when I find
> > > some time (not today: my 8 year old son went to the hospital
> > > for an emergency last Thursday, he is cured now and should
> > > come out today).
> >
> > Any test is welcome, glad to know your son is well !
>
> The one liner works here, I can no more solidly hang
> the machine. There is still a bunch of error messages
> on drive removal though:
Yes, I noticed those. Looks like the IDE driver is trying to much around
with the drive when unregistered. In our case, it's not a very good idea
as we unregister it after we detect it's been physically removed :)
Seems harmless so far though.
Ben.
> mediabay0: switching to 7
> mediabay0: powering down
> media bay 0 is empty
> Unregistering mb 0 ide, index:2
> hde: status error: status=0x00 { }
> ide: failed opcode was: unknown
> hde: status error: status=0x00 { }
> ide: failed opcode was: unknown
> hde: status error: status=0x00 { }
> ide: failed opcode was: unknown
> hde: status error: status=0x00 { }
> ide: failed opcode was: unknown
> hde: DMA disabled
> hde: ATAPI reset complete
> hde: status error: status=0x00 { }
> ide: failed opcode was: unknown
> hde: status error: status=0x00 { }
> ide: failed opcode was: unknown
> hde: status error: status=0x00 { }
> ide: failed opcode was: unknown
> hde: status error: status=0x00 { }
> ide: failed opcode was: unknown
> hde: ATAPI reset complete
> hde: status error: status=0x00 { }
> ide: failed opcode was: unknown
> hde: status error: status=0x00 { }
> ide: failed opcode was: unknown
> hde: status error: status=0x00 { }
> ide: failed opcode was: unknown
> hde: status error: status=0x00 { }
> ide: failed opcode was: unknown
> hde: status error: status=0x00 { }
> ide: failed opcode was: unknown
> hde: ATAPI reset complete
> hde: status error: status=0x00 { }
> ide: failed opcode was: unknown
> hde: status error: status=0x00 { }
> ide: failed opcode was: unknown
> hde: status error: status=0x00 { }
> ide: failed opcode was: unknown
> hde: status error: status=0x00 { }
> ide: failed opcode was: unknown
> hde: ATAPI reset complete
> hde: status error: status=0x00 { }
> ide: failed opcode was: unknown
> mediabay0: end of power down
>
> On insertion there are also a few messages
> but they seem normal:
>
> mediabay0: switching to 3
> mediabay0: powering up
> mediabay0: enabling (kind:3)
> mediabay0: waiting reset (kind:3)
> mediabay0: waiting IDE reset (kind:3)
> mediabay0: waiting IDE ready (kind:3)
> mediabay 0, registering IDE...
> Probing IDE interface ide2...
> hde: LG DVD-ROM DRN-8080B, ATAPI CD/DVD-ROM drive
> hde: Enabling MultiWord DMA 2
> ide2 at 0xf1022000-0xf1022007,0xf1022160 on irq 20
> hde: ATAPI 24X DVD-ROM drive, 512kB Cache, DMA
> media-bay 0 is ide2
> mediabay 0 IDE ready
>
> Regards,
> Gabriel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-05-21 21:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-15 6:58 [PATCH] powerpc: Fix ide-pmac sysfs entry Benjamin Herrenschmidt
2006-05-15 7:08 ` Andrew Morton
2006-05-15 7:23 ` Benjamin Herrenschmidt
2006-05-15 8:38 ` Gabriel Paubert
2006-05-15 8:52 ` Benjamin Herrenschmidt
2006-05-21 21:30 ` Gabriel Paubert
2006-05-21 21:46 ` Benjamin Herrenschmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).