public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail•com>
To: benh@kernel•crashing.org
Cc: FUJITA Tomonori <fujita.tomonori@lab•ntt.co.jp>,
	linux-ide@vger•kernel.org, petkovbb@gmail•com,
	linuxppc-dev@ozlabs•org
Subject: Re: ide pmac breakage
Date: Thu, 31 Jul 2008 12:51:01 +0200	[thread overview]
Message-ID: <200807311251.02251.bzolnier@gmail.com> (raw)
In-Reply-To: <1217478322.11188.410.camel@pasglop>

On Thursday 31 July 2008, Benjamin Herrenschmidt wrote:
>=20
> > Is it actually caused by additional reference counting on drive->gendev?
> > IOW if you reverse the patch below instead of applying the previous fix
> > do things work OK again?
> >=20
> > > Note that there shouldn't be anything fundamentally different from
> > > ide-pmac here vs. something like pcmcia IDE cards... do you have one =
of
> > > these to test with ?
> >=20
> > Nope and I really don't intend to have one.  I count on other people
> > to take some care of support for host drivers that they maintain/use. ;)
>=20
> Reverting the patch below does the job. Thanks.

Thanks, this narrows down the problem pretty nicely.

[ Unfortunately we cannot revert the whole patch as it would break
  unloading of IDE host drivers modules so I still need you help on
  fixing this one. ]

Lets get back to the oops:

Vector: 300 (Data Access) at [c59dfdc0]
=C2=A0 =C2=A0 pc: c0211f78: ide_device_put+0x18/0x58
=C2=A0 =C2=A0 lr: c0223c34: ide_cd_put+0x40/0x5c
=C2=A0 =C2=A0 sp: c59dfe70
=C2=A0 =C2=A0msr: 9032
=C2=A0 =C2=A0dar: 10
=C2=A0dsisr: 40000000
=C2=A0 current =3D 0xc58a9880
=C2=A0 =C2=A0 pid =C2=A0 =3D 843, comm =3D media-bay
enter ? for help
[c59dfe80] c0223c34 ide_cd_put+0x40/0x5c
[c59dfea0] c02114d4 generic_ide_remove+0x28/0x3c
[c59dfeb0] c01ea108 __device_release_driver+0x78/0xb4
[c59dfec0] c01ea218 device_release_driver+0x28/0x44
[c59dfee0] c01e9350 bus_remove_device+0xac/0xd8
[c59dff00] c01e77f8 device_del+0x104/0x198
[c59dff20] c01e78a4 device_unregister+0x18/0x30
[c59dff40] c0212598 __ide_port_unregister_devices+0x6c/0x88
[c59dff60] c021276c ide_port_unregister_devices+0x38/0x80
[c59dff80] c0209078 media_bay_step+0x1cc/0x5c0
[c59dffb0] c02094f8 media_bay_task+0x8c/0xcc
[c59dffd0] c0048640 kthread+0x48/0x84
[c59dfff0] c0011b38 kernel_thread+0x44/0x60

On a fresh look at ide_device_put(), ide_host_alloc() and pmac.c
it may be that the above oops is actually media-bay specific.

ide_device_put():
=2E..
        struct device *host_dev =3D drive->hwif->host->dev[0];
        struct module *module =3D host_dev ? host_dev->driver->owner : NULL;
=2E..

ide_host_alloc():
=2E..
       if (hws[0])
                host->dev[0] =3D hws[0]->dev;
=2E..

pmac.c:
=2E..
pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *ma=
tch)
=2E..
	dev_set_drvdata(&mdev->ofdev.dev, pmif);

	memset(&hw, 0, sizeof(hw));
	pmac_ide_init_ports(&hw, pmif->regbase);
	hw.irq =3D irq;
	hw.dev =3D &mdev->bus->pdev->dev;
	hw.parent =3D &mdev->ofdev.dev;
=2E..

pmac macio is unique in using different devices for hwif->dev / host->dev
(hw.dev) and hwif->gendev.parent / dev_set_drvdata() (hw.parent)

[ I has been actually wondering why is it so for some time...? ]

Thus we may be hitting oops in ide_device_put() on host_dev->driver
because hw.dev is used as host->dev for pmac macio in ide_device_put()
while we really want to use hw.parent.

=46ix should be as simple as:

=2D                host->dev[0] =3D hws[0]->dev;
+                host->dev[0] =3D hws[0]->parent ? hws[0]->parent : hws[0]-=
>dev;

Could you please try it together with my previous patch for
ide_device_{get,put}()?

Bart

  reply	other threads:[~2008-07-31 10:54 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-28  1:29 ide pmac breakage Benjamin Herrenschmidt
2008-07-28  2:02 ` Benjamin Herrenschmidt
2008-07-28 14:31   ` Bartlomiej Zolnierkiewicz
2008-07-29  5:17     ` FUJITA Tomonori
2008-07-29  5:20       ` Benjamin Herrenschmidt
2008-07-29 11:41         ` Bartlomiej Zolnierkiewicz
2008-07-29 12:02           ` Benjamin Herrenschmidt
2008-07-29 12:04             ` Bartlomiej Zolnierkiewicz
2008-07-29 14:45               ` Bartlomiej Zolnierkiewicz
2008-07-29 19:26                 ` Bartlomiej Zolnierkiewicz
2008-07-29 21:30                   ` Benjamin Herrenschmidt
2008-07-30  1:23                   ` FUJITA Tomonori
2008-07-30  6:57                   ` Benjamin Herrenschmidt
2008-07-30 19:11                     ` Bartlomiej Zolnierkiewicz
2008-07-30 22:49                       ` Benjamin Herrenschmidt
2008-07-31  0:48                         ` Bartlomiej Zolnierkiewicz
2008-07-31  1:09                           ` Benjamin Herrenschmidt
2008-07-31  3:17                             ` Bartlomiej Zolnierkiewicz
2008-07-31  8:49                           ` Alan Cox
2008-07-31  9:11                             ` Benjamin Herrenschmidt
2008-07-31  9:13                               ` Alan Cox
2008-07-31  9:48                                 ` Benjamin Herrenschmidt
2008-07-31  4:25                       ` Benjamin Herrenschmidt
2008-07-31 10:51                         ` Bartlomiej Zolnierkiewicz [this message]
2008-08-01 10:54                           ` Bartlomiej Zolnierkiewicz
2008-08-01 22:26                             ` Benjamin Herrenschmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200807311251.02251.bzolnier@gmail.com \
    --to=bzolnier@gmail$(echo .)com \
    --cc=benh@kernel$(echo .)crashing.org \
    --cc=fujita.tomonori@lab$(echo .)ntt.co.jp \
    --cc=linux-ide@vger$(echo .)kernel.org \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=petkovbb@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox