linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: whiteheadm@acm.org
Cc: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
	linux-ide@vger.kernel.org
Subject: Re: [PATCH] pata_legacy: Allow disabling of legacy PATA device probes on non-PCI systems
Date: Thu, 19 Jan 2017 16:37:37 -0500	[thread overview]
Message-ID: <20170119213737.GB25133@mtj.duckdns.org> (raw)
In-Reply-To: <CAP8WD_bS61spyQkd7cvktFf_dPc0wgNZ8qEa7GVrXgUobHQdvw@mail.gmail.com>

On Wed, Jan 11, 2017 at 08:54:21PM -0500, tedheadster wrote:
> ​Tejun,
>   I'm interested in debugging this. What can I do to help?

Sorry about taking so long.  I suck. :)

Can you please try the following patch and post what the kernel prints
out?

Thanks.
---
 drivers/ata/pata_legacy.c |    2 ++
 drivers/base/core.c       |    9 +++++++++
 include/linux/kobject.h   |    1 +
 lib/kobject.c             |   22 ++++++++++++++++++++++
 4 files changed, 34 insertions(+)

--- a/drivers/ata/pata_legacy.c
+++ b/drivers/ata/pata_legacy.c
@@ -962,6 +962,8 @@ static __init int legacy_init_one(struct
 	if (IS_ERR(pdev))
 		return PTR_ERR(pdev);
 
+	pdev->dev.kobj.release_debug = true;
+
 	ret = -EBUSY;
 	if (devm_request_region(&pdev->dev, io, 8, "pata_legacy") == NULL ||
 	    devm_request_region(&pdev->dev, io + 0x0206, 1,
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -803,8 +803,17 @@ static void device_release(struct kobjec
 	 * is deleted but alive, so release devres here to avoid
 	 * possible memory leak.
 	 */
+	if (kobj->release_debug)
+		dev_info(dev, "XXX device_release: drel=%pf trel=%pf cdrel=%pf\n",
+			 dev->release,
+			 dev->type ? dev->type->release : NULL,
+			 dev->class ? dev->class->dev_release : NULL);
+
 	devres_release_all(dev);
 
+	if (kobj->release_debug)
+		dev_info(dev, "XXX device_release: devres_release_all() done\n");
+
 	if (dev->release)
 		dev->release(dev);
 	else if (dev->type && dev->type->release)
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -76,6 +76,7 @@ struct kobject {
 	unsigned int state_add_uevent_sent:1;
 	unsigned int state_remove_uevent_sent:1;
 	unsigned int uevent_suppress:1;
+	unsigned int release_debug:1;
 };
 
 extern __printf(2, 3)
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -595,6 +595,13 @@ struct kobject *kobject_get(struct kobje
 			WARN(1, KERN_WARNING "kobject: '%s' (%p): is not "
 			       "initialized, yet kobject_get() is being "
 			       "called.\n", kobject_name(kobj), kobj);
+		if (kobj->release_debug)
+			printk("XXX kobject_get(%s): ref=%d++ (%pf:%pf:%pf)\n",
+			       kobject_name(kobj),
+			       atomic_read(&kobj->kref.refcount),
+			       __builtin_return_address(1),
+			       __builtin_return_address(2),
+			       __builtin_return_address(3));
 		kref_get(&kobj->kref);
 	}
 	return kobj;
@@ -620,6 +627,14 @@ static void kobject_cleanup(struct kobje
 	pr_debug("kobject: '%s' (%p): %s, parent %p\n",
 		 kobject_name(kobj), kobj, __func__, kobj->parent);
 
+	if (kobj->release_debug)
+		printk("XXX kobject_cleanup(%s): rel=%pf (%pf:%pf:%pf)\n",
+		       kobject_name(kobj),
+		       (t && t->release) ? t->release : NULL,
+		       __builtin_return_address(1),
+		       __builtin_return_address(2),
+		       __builtin_return_address(3));
+
 	if (t && !t->release)
 		pr_debug("kobject: '%s' (%p): does not have a release() "
 			 "function, it is broken and must be fixed.\n",
@@ -688,6 +703,13 @@ void kobject_put(struct kobject *kobj)
 			WARN(1, KERN_WARNING "kobject: '%s' (%p): is not "
 			       "initialized, yet kobject_put() is being "
 			       "called.\n", kobject_name(kobj), kobj);
+		if (kobj->release_debug)
+			printk("XXX kobject_put(%s): ref=%d-- (%pf:%pf:%pf)\n",
+			       kobject_name(kobj),
+			       atomic_read(&kobj->kref.refcount),
+			       __builtin_return_address(1),
+			       __builtin_return_address(2),
+			       __builtin_return_address(3));
 		kref_put(&kobj->kref, kobject_release);
 	}
 }

  parent reply	other threads:[~2017-01-19 21:46 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 [this message]
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                                               ` [PATCH] pata_legacy: Allow disabling of legacy PATA device probes on non-PCI systems Tejun Heo
2016-12-12 12:21               ` 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=20170119213737.GB25133@mtj.duckdns.org \
    --to=tj@kernel.org \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --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 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).