2023-04-12 23:06:34

by Stephen Boyd

[permalink] [raw]
Subject: [PATCH] driver core: Don't require dynamic_debug for initcall_debug probe timing

Don't require the use of dynamic debug (or modification of the kernel to
add a #define DEBUG to the top of this file) to get the printk message
about driver probe timing. This printk is only emitted when
initcall_debug is enabled on the kernel commandline, and it isn't
immediately obvious that you have to do something else to debug boot
timing issues related to driver probe. Add a comment too so it doesn't
get converted back to pr_debug().

Fixes: eb7fbc9fb118 ("driver core: Add missing '\n' in log messages")
Cc: Christophe JAILLET <[email protected]>
Cc: Brian Norris <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
---
drivers/base/dd.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 8def2ba08a82..1b16e0fb7658 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -708,7 +708,12 @@ static int really_probe_debug(struct device *dev, struct device_driver *drv)
calltime = ktime_get();
ret = really_probe(dev, drv);
rettime = ktime_get();
- pr_debug("probe of %s returned %d after %lld usecs\n",
+ /*
+ * Don't change this to pr_debug() because that requires
+ * CONFIG_DYNAMIC_DEBUG and we want a simple 'initcall_debug' on the
+ * kernel commandline to print this all the time at the debug level.
+ */
+ printk(KERN_DEBUG "probe of %s returned %d after %lld usecs\n",
dev_name(dev), ret, ktime_us_delta(rettime, calltime));
return ret;
}

base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6
--
https://chromeos.dev


2023-04-12 23:06:43

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] driver core: Don't require dynamic_debug for initcall_debug probe timing



On 4/12/23 15:58, Stephen Boyd wrote:
> Don't require the use of dynamic debug (or modification of the kernel to
> add a #define DEBUG to the top of this file) to get the printk message
> about driver probe timing. This printk is only emitted when
> initcall_debug is enabled on the kernel commandline, and it isn't
> immediately obvious that you have to do something else to debug boot
> timing issues related to driver probe. Add a comment too so it doesn't
> get converted back to pr_debug().
>
> Fixes: eb7fbc9fb118 ("driver core: Add missing '\n' in log messages")
> Cc: Christophe JAILLET <[email protected]>
> Cc: Brian Norris <[email protected]>
> Signed-off-by: Stephen Boyd <[email protected]>

Good one. Thanks for catching this.

Acked-by: Randy Dunlap <[email protected]>


> ---
> drivers/base/dd.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> index 8def2ba08a82..1b16e0fb7658 100644
> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -708,7 +708,12 @@ static int really_probe_debug(struct device *dev, struct device_driver *drv)
> calltime = ktime_get();
> ret = really_probe(dev, drv);
> rettime = ktime_get();
> - pr_debug("probe of %s returned %d after %lld usecs\n",
> + /*
> + * Don't change this to pr_debug() because that requires
> + * CONFIG_DYNAMIC_DEBUG and we want a simple 'initcall_debug' on the
> + * kernel commandline to print this all the time at the debug level.
> + */
> + printk(KERN_DEBUG "probe of %s returned %d after %lld usecs\n",
> dev_name(dev), ret, ktime_us_delta(rettime, calltime));
> return ret;
> }
>
> base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6

--
~Randy

2023-04-13 00:20:34

by Brian Norris

[permalink] [raw]
Subject: Re: [PATCH] driver core: Don't require dynamic_debug for initcall_debug probe timing

On Wed, Apr 12, 2023 at 03:58:42PM -0700, Stephen Boyd wrote:
> Don't require the use of dynamic debug (or modification of the kernel to
> add a #define DEBUG to the top of this file) to get the printk message
> about driver probe timing. This printk is only emitted when
> initcall_debug is enabled on the kernel commandline, and it isn't
> immediately obvious that you have to do something else to debug boot
> timing issues related to driver probe. Add a comment too so it doesn't
> get converted back to pr_debug().
>
> Fixes: eb7fbc9fb118 ("driver core: Add missing '\n' in log messages")
> Cc: Christophe JAILLET <[email protected]>
> Cc: Brian Norris <[email protected]>
> Signed-off-by: Stephen Boyd <[email protected]>
> ---
> drivers/base/dd.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)

Reviewed-by: Brian Norris <[email protected]>