From: Tejun Heo <tj@kernel.org>
To: Gwendal Grignou <gwendal@google.com>
Cc: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
IDE/ATA development list <linux-ide@vger.kernel.org>,
whiteheadm@acm.org
Subject: Re: [PATCH] pata_legacy: Allow disabling of legacy PATA device probes on non-PCI systems
Date: Tue, 24 Jan 2017 10:57:28 -0500 [thread overview]
Message-ID: <20170124155728.GB12281@htj.duckdns.org> (raw)
In-Reply-To: <CAMHSBOVS+ehZkHG7nnUS9qQoDXKmsiBUEhBbPb=3qA2-ZaQ2Ow@mail.gmail.com>
Hello,
On Mon, Jan 23, 2017 at 03:36:18PM -0800, Gwendal Grignou wrote:
> > Can you please explain why the libata transport code is explicitly
> > pinning the parent device and then putting it in the release methods?
> > device_add/del() already gets and puts the parent, so I don't get why
> > this part is necessary. Is this intentional?
>
> It was intentional. When I wrote the code, I used other transport as
> inspiration, in particular drivers/scsi/scsi_transport_sas.c.
> For instance, in sas_port_alloc, "port->dev.parent =
> get_device(parent);", undo in sas_port_release().
> From your debug code, in case of ATA at least, it looks unnecessary.
kobjects release their parents on kobject_del() rather than release,
which I don't think is a good design, so if there are code paths which
try to walk up the hierarchy after being deleted but before released,
having the extra ref around release does make sense. I don't know
whether that's the case for the transport code tho.
Anyways, I was curious but this is a bit tangential to the issue.
This code does make the ata device hang around till the transport
kobject is released and the problem is caused by the transport kobject
not being released, so there's linkage there, but we wanna find out
why the transport kobject isn't being released and fix it.
> Moreover, in the error path of ata_XXX_add, a put_device(&link->tdev)
> Also,How ata_tport_add() increase the reference twice before calling
> device_add()?
Dunno, attribute additions?
> > Also, it looks like there is a ref leak on the transport device
> > itself. Its release function never gets called and thus the parent
> > device (ata_port) stays pinned too.
>
> That's the root cause of pata port not released. Can we run your debug
> code one more time, enabling ap->tdev.kobj.release_debug?
Yeah, I'll update the patch.
Thanks.
--
tejun
next prev parent reply other threads:[~2017-01-24 15:57 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-29 17:53 [PATCH] pata_legacy: Allow disabling of legacy PATA device probes on non-PCI systems Matthew Whitehead
2016-11-29 19:41 ` Tejun Heo
2016-11-29 20:12 ` tedheadster
2016-11-29 20:46 ` Tejun Heo
2016-11-30 13:06 ` Bartlomiej Zolnierkiewicz
2016-11-30 17:13 ` tedheadster
2016-11-30 13:11 ` Sergei Shtylyov
2016-11-30 14:53 ` One Thousand Gnomes
2016-11-30 15:03 ` tedheadster
2016-11-30 18:15 ` One Thousand Gnomes
2016-12-02 13:37 ` tedheadster
2016-12-02 16:24 ` One Thousand Gnomes
2016-11-30 20:22 ` Tejun Heo
[not found] ` <CAP8WD_bZWeLBhLXqJG5uDwBe+zBubw+A+ecSuaihOuwvw9QoCQ@mail.gmail.com>
2016-12-02 17:07 ` Tejun Heo
2016-12-05 14:19 ` tedheadster
2016-12-05 19:23 ` Tejun Heo
[not found] ` <CAP8WD_becq+h2=-g7t-6Pp1psmkCCvdB0YUcg+wYPocUP4dYdw@mail.gmail.com>
2016-12-12 17:01 ` Tejun Heo
[not found] ` <CAP8WD_YMtnsuYmJHGz1eLmrQNemsB1Z6Soyb6f72brAfMNUNeg@mail.gmail.com>
2016-12-20 2:12 ` tedheadster
2016-12-22 16:37 ` Tejun Heo
2016-12-22 17:14 ` tedheadster
2016-12-22 17:19 ` Tejun Heo
2016-12-22 18:30 ` tedheadster
2016-12-22 19:22 ` Tejun Heo
2017-01-03 17:34 ` One Thousand Gnomes
[not found] ` <CAP8WD_bS61spyQkd7cvktFf_dPc0wgNZ8qEa7GVrXgUobHQdvw@mail.gmail.com>
2017-01-19 21:37 ` Tejun Heo
2017-01-20 17:08 ` tedheadster
2017-01-20 19:19 ` Tejun Heo
2017-01-20 19:38 ` Tejun Heo
2017-01-23 23:36 ` Gwendal Grignou
2017-01-23 23:57 ` tedheadster
2017-01-24 16:19 ` Tejun Heo
2017-01-27 3:01 ` tedheadster
2017-02-07 20:21 ` Gwendal Grignou
2017-02-08 19:43 ` Tejun Heo
2017-02-09 23:49 ` Gwendal Grignou
2017-02-10 0:36 ` tedheadster
2017-02-10 13:19 ` Tejun Heo
2017-02-23 19:26 ` tedheadster
2017-03-03 17:00 ` [PATCH] libata: transport: Remove circular dependency at free time Gwendal Grignou
2017-03-03 18:28 ` Sergei Shtylyov
2017-03-03 18:36 ` Tejun Heo
2017-03-06 20:09 ` Tejun Heo
2017-03-06 20:11 ` Sergei Shtylyov
2017-03-06 20:26 ` Tejun Heo
2017-01-24 15:57 ` Tejun Heo [this message]
2016-12-12 12:21 ` [PATCH] pata_legacy: Allow disabling of legacy PATA device probes on non-PCI systems Bartlomiej Zolnierkiewicz
2016-11-30 13:12 ` Bartlomiej Zolnierkiewicz
2016-11-30 13:15 ` Sergei Shtylyov
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=20170124155728.GB12281@htj.duckdns.org \
--to=tj@kernel.org \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=gregkh@linuxfoundation.org \
--cc=gwendal@google.com \
--cc=linux-ide@vger.kernel.org \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=whiteheadm@acm.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.