public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org,
	"Rafael J. Wysocki" <rafael@kernel.org>
Subject: Re: [PATCH v1 1/1] devres: Pass unique name of the resource to devm_add_action()
Date: Fri, 10 Mar 2023 16:11:41 +0200	[thread overview]
Message-ID: <ZAs6nZz05C016l0E@smile.fi.intel.com> (raw)
In-Reply-To: <83bebd97-ba44-9e19-d66c-95b43b123797@alu.unizg.hr>

On Fri, Mar 10, 2023 at 02:21:24PM +0100, Mirsad Todorovac wrote:
> On 2/24/23 21:07, Andy Shevchenko wrote:
> > Pass the unique name of the resource to devm_add_action(),
> > so it will be easier to debug managed resources.

...

> (I'm late two weeks w testing, but those were rather busy two weeks.)

Thank you for this test!

> I see what it is meant to do, but I am unsure of how to test whether it works.

Your test below is good enough.

> Being the unfaithful Thomas, I always prefer to test rather to just assume it
> is OK.
> 
> Is this OK output you expected to see in syslog?

Not really. It seems that we need to also wrap the devm_add_action_or_reset()
separately.

> Mar  8 22:20:36 pc-mtodorov kernel: gpio-sim gpio-sim.0: DEVRES ADD 00000000ea28d384 action (16 bytes)

> Mar  8 22:20:36 pc-mtodorov kernel: gpio-sim gpio-sim.0: DEVRES ADD 000000004090f288 action (16 bytes)
> Mar  8 22:20:36 pc-mtodorov kernel: gpio-sim gpio-sim.0: DEVRES REL 000000004090f288 action (16 bytes)

> Mar  8 22:20:36 pc-mtodorov kernel: gpio-sim gpio-sim.0: DEVRES REL 00000000ea28d384 action (16 bytes)

Instead of 'action' we need to see the real name of the action.

> NOTE: Maybe I should emphasise that this is not seen in either dmesg or kernel console.

Do you have 'ignore_loglevel' in the kernel command line? You should,
independently on this patch, for debug testing.

> I have just checked, and DEVRES lines are only in /var/log/messages (on AlmaLinux 8.7, CentOS fork).
> 
> As you must have guessed yourself already, this will frustrate debugging past the lifetime of rsyslog process.
> 
> Also, there is no way known to me to access dmesg log from the previous kernel run.

Can you test this on top?

diff --git a/include/linux/device.h b/include/linux/device.h
index 0f128520f6e5..12dc08aa5c0f 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -250,17 +250,19 @@ int __devm_add_action(struct device *dev, void (*action)(void *), void *data, co
 #define devm_add_action(release, action, data) \
 	__devm_add_action(release, action, data, #action)
 
-static inline int devm_add_action_or_reset(struct device *dev,
-					   void (*action)(void *), void *data)
+static inline int __devm_add_action_or_reset(struct device *dev, void (*action)(void *),
+					     void *data, const char *name)
 {
 	int ret;
 
-	ret = devm_add_action(dev, action, data);
+	ret = __devm_add_action(dev, action, data, name);
 	if (ret)
 		action(data);
 
 	return ret;
 }
+#define devm_add_action_or_reset(release, action, data) \
+	__devm_add_action_or_reset(release, action, data, #action)
 
 /**
  * devm_alloc_percpu - Resource-managed alloc_percpu

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2023-03-10 14:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24 20:07 [PATCH v1 1/1] devres: Pass unique name of the resource to devm_add_action() Andy Shevchenko
2023-03-10 13:21 ` Mirsad Todorovac
2023-03-10 14:11   ` Andy Shevchenko [this message]
2023-03-10 21:02     ` Mirsad Goran Todorovac
2023-03-10 23:03     ` [PATCH v1 1/1] devres: Pass unique name of the resource to devm_add_action() P.S Mirsad Goran Todorovac
2023-03-13 13:36       ` Andy Shevchenko

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=ZAs6nZz05C016l0E@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mirsad.todorovac@alu.unizg.hr \
    --cc=rafael@kernel.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