linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] coresight: cpu-debug: control default behavior via Kconfig
@ 2021-09-04  1:28 Brian Norris
  2021-09-04  2:31 ` Leo Yan
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Brian Norris @ 2021-09-04  1:28 UTC (permalink / raw)
  To: Leo Yan, Mathieu Poirier, Mike Leach, Suzuki K Poulose
  Cc: coresight, linux-kernel, linux-arm-kernel, Brian Norris

Debugfs is nice and so are module parameters, but
 * debugfs doesn't take effect early (e.g., if drivers are locking up
   before user space gets anywhere)
 * module parameters either add a lot to the kernel command line, or
   else take effect late as well (if you build =m and configure in
   /etc/modprobe.d/)

So in the same spirit as these
  CONFIG_PANIC_ON_OOPS (also available via cmdline or modparam)
  CONFIG_INTEL_IOMMU_DEFAULT_ON (also available via cmdline)
add a new Kconfig option.

Module parameters and debugfs can still override.

Signed-off-by: Brian Norris <briannorris@chromium.org>
---

 drivers/hwtracing/coresight/Kconfig               | 13 +++++++++++++
 drivers/hwtracing/coresight/coresight-cpu-debug.c |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig
index f026e5c0e777..8b638eb3cb7d 100644
--- a/drivers/hwtracing/coresight/Kconfig
+++ b/drivers/hwtracing/coresight/Kconfig
@@ -150,6 +150,19 @@ config CORESIGHT_CPU_DEBUG
 	  To compile this driver as a module, choose M here: the
 	  module will be called coresight-cpu-debug.
 
+config CORESIGHT_CPU_DEBUG_DEFAULT_ON
+	bool "Enable CoreSight CPU Debug by default
+	depends on CORESIGHT_CPU_DEBUG
+	help
+	  Say Y here to enable the CoreSight Debug panic-debug by default. This
+	  can also be enabled via debugfs, but this ensures the debug feature
+	  is enabled as early as possible.
+
+	  Has the same effect as setting coresight_cpu_debug.enable=1 on the
+	  kernel command line.
+
+	  Say N if unsure.
+
 config CORESIGHT_CTI
 	tristate "CoreSight Cross Trigger Interface (CTI) driver"
 	depends on ARM || ARM64
diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c
index 00de46565bc4..8845ec4b4402 100644
--- a/drivers/hwtracing/coresight/coresight-cpu-debug.c
+++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c
@@ -105,7 +105,7 @@ static DEFINE_PER_CPU(struct debug_drvdata *, debug_drvdata);
 static int debug_count;
 static struct dentry *debug_debugfs_dir;
 
-static bool debug_enable;
+static bool debug_enable = IS_ENABLED(CONFIG_CORESIGHT_CPU_DEBUG_DEFAULT_ON);
 module_param_named(enable, debug_enable, bool, 0600);
 MODULE_PARM_DESC(enable, "Control to enable coresight CPU debug functionality");
 
-- 
2.33.0.153.gba50c8fa24-goog


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] coresight: cpu-debug: control default behavior via Kconfig
  2021-09-04  1:28 [PATCH] coresight: cpu-debug: control default behavior via Kconfig Brian Norris
@ 2021-09-04  2:31 ` Leo Yan
  2021-09-06 15:37 ` Mathieu Poirier
  2021-09-15 23:41 ` Brian Norris
  2 siblings, 0 replies; 5+ messages in thread
From: Leo Yan @ 2021-09-04  2:31 UTC (permalink / raw)
  To: Brian Norris
  Cc: Mathieu Poirier, Mike Leach, Suzuki K Poulose, coresight,
	linux-kernel, linux-arm-kernel

On Fri, Sep 03, 2021 at 06:28:54PM -0700, Brian Norris wrote:
> Debugfs is nice and so are module parameters, but
>  * debugfs doesn't take effect early (e.g., if drivers are locking up
>    before user space gets anywhere)
>  * module parameters either add a lot to the kernel command line, or
>    else take effect late as well (if you build =m and configure in
>    /etc/modprobe.d/)
> 
> So in the same spirit as these
>   CONFIG_PANIC_ON_OOPS (also available via cmdline or modparam)
>   CONFIG_INTEL_IOMMU_DEFAULT_ON (also available via cmdline)
> add a new Kconfig option.
> 
> Module parameters and debugfs can still override.
> 
> Signed-off-by: Brian Norris <briannorris@chromium.org>

Thanks for the patch, looks good to me:

Reviewed-by: Leo Yan <leo.yan@linaro.org>

> ---
> 
>  drivers/hwtracing/coresight/Kconfig               | 13 +++++++++++++
>  drivers/hwtracing/coresight/coresight-cpu-debug.c |  2 +-
>  2 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig
> index f026e5c0e777..8b638eb3cb7d 100644
> --- a/drivers/hwtracing/coresight/Kconfig
> +++ b/drivers/hwtracing/coresight/Kconfig
> @@ -150,6 +150,19 @@ config CORESIGHT_CPU_DEBUG
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called coresight-cpu-debug.
>  
> +config CORESIGHT_CPU_DEBUG_DEFAULT_ON
> +	bool "Enable CoreSight CPU Debug by default
> +	depends on CORESIGHT_CPU_DEBUG
> +	help
> +	  Say Y here to enable the CoreSight Debug panic-debug by default. This
> +	  can also be enabled via debugfs, but this ensures the debug feature
> +	  is enabled as early as possible.
> +
> +	  Has the same effect as setting coresight_cpu_debug.enable=1 on the
> +	  kernel command line.
> +
> +	  Say N if unsure.
> +
>  config CORESIGHT_CTI
>  	tristate "CoreSight Cross Trigger Interface (CTI) driver"
>  	depends on ARM || ARM64
> diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c
> index 00de46565bc4..8845ec4b4402 100644
> --- a/drivers/hwtracing/coresight/coresight-cpu-debug.c
> +++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c
> @@ -105,7 +105,7 @@ static DEFINE_PER_CPU(struct debug_drvdata *, debug_drvdata);
>  static int debug_count;
>  static struct dentry *debug_debugfs_dir;
>  
> -static bool debug_enable;
> +static bool debug_enable = IS_ENABLED(CONFIG_CORESIGHT_CPU_DEBUG_DEFAULT_ON);
>  module_param_named(enable, debug_enable, bool, 0600);
>  MODULE_PARM_DESC(enable, "Control to enable coresight CPU debug functionality");
>  
> -- 
> 2.33.0.153.gba50c8fa24-goog
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] coresight: cpu-debug: control default behavior via Kconfig
  2021-09-04  1:28 [PATCH] coresight: cpu-debug: control default behavior via Kconfig Brian Norris
  2021-09-04  2:31 ` Leo Yan
@ 2021-09-06 15:37 ` Mathieu Poirier
  2021-09-15 23:41 ` Brian Norris
  2 siblings, 0 replies; 5+ messages in thread
From: Mathieu Poirier @ 2021-09-06 15:37 UTC (permalink / raw)
  To: Brian Norris
  Cc: Leo Yan, Mike Leach, Suzuki K Poulose, coresight, linux-kernel,
	linux-arm-kernel

Hi Brian,

On Fri, Sep 03, 2021 at 06:28:54PM -0700, Brian Norris wrote:
> Debugfs is nice and so are module parameters, but
>  * debugfs doesn't take effect early (e.g., if drivers are locking up
>    before user space gets anywhere)
>  * module parameters either add a lot to the kernel command line, or
>    else take effect late as well (if you build =m and configure in
>    /etc/modprobe.d/)
> 
> So in the same spirit as these
>   CONFIG_PANIC_ON_OOPS (also available via cmdline or modparam)
>   CONFIG_INTEL_IOMMU_DEFAULT_ON (also available via cmdline)
> add a new Kconfig option.
> 
> Module parameters and debugfs can still override.
> 
> Signed-off-by: Brian Norris <briannorris@chromium.org>
> ---
> 
>  drivers/hwtracing/coresight/Kconfig               | 13 +++++++++++++
>  drivers/hwtracing/coresight/coresight-cpu-debug.c |  2 +-
>  2 files changed, 14 insertions(+), 1 deletion(-)
> 

I have applied this patch to my local tree.  I will make that tree public when
next week when 5.15-rc1 has been released.

Thanks,
Mathieu

> diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig
> index f026e5c0e777..8b638eb3cb7d 100644
> --- a/drivers/hwtracing/coresight/Kconfig
> +++ b/drivers/hwtracing/coresight/Kconfig
> @@ -150,6 +150,19 @@ config CORESIGHT_CPU_DEBUG
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called coresight-cpu-debug.
>  
> +config CORESIGHT_CPU_DEBUG_DEFAULT_ON
> +	bool "Enable CoreSight CPU Debug by default
> +	depends on CORESIGHT_CPU_DEBUG
> +	help
> +	  Say Y here to enable the CoreSight Debug panic-debug by default. This
> +	  can also be enabled via debugfs, but this ensures the debug feature
> +	  is enabled as early as possible.
> +
> +	  Has the same effect as setting coresight_cpu_debug.enable=1 on the
> +	  kernel command line.
> +
> +	  Say N if unsure.
> +
>  config CORESIGHT_CTI
>  	tristate "CoreSight Cross Trigger Interface (CTI) driver"
>  	depends on ARM || ARM64
> diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c
> index 00de46565bc4..8845ec4b4402 100644
> --- a/drivers/hwtracing/coresight/coresight-cpu-debug.c
> +++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c
> @@ -105,7 +105,7 @@ static DEFINE_PER_CPU(struct debug_drvdata *, debug_drvdata);
>  static int debug_count;
>  static struct dentry *debug_debugfs_dir;
>  
> -static bool debug_enable;
> +static bool debug_enable = IS_ENABLED(CONFIG_CORESIGHT_CPU_DEBUG_DEFAULT_ON);
>  module_param_named(enable, debug_enable, bool, 0600);
>  MODULE_PARM_DESC(enable, "Control to enable coresight CPU debug functionality");
>  
> -- 
> 2.33.0.153.gba50c8fa24-goog
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] coresight: cpu-debug: control default behavior via Kconfig
  2021-09-04  1:28 [PATCH] coresight: cpu-debug: control default behavior via Kconfig Brian Norris
  2021-09-04  2:31 ` Leo Yan
  2021-09-06 15:37 ` Mathieu Poirier
@ 2021-09-15 23:41 ` Brian Norris
  2021-09-15 23:52   ` Brian Norris
  2 siblings, 1 reply; 5+ messages in thread
From: Brian Norris @ 2021-09-15 23:41 UTC (permalink / raw)
  To: Leo Yan, Mathieu Poirier, Mike Leach, Suzuki K Poulose
  Cc: coresight, Linux Kernel, linux-arm-kernel

On Fri, Sep 3, 2021 at 6:29 PM Brian Norris <briannorris@chromium.org> wrote:
> --- a/drivers/hwtracing/coresight/Kconfig
> +++ b/drivers/hwtracing/coresight/Kconfig
> @@ -150,6 +150,19 @@ config CORESIGHT_CPU_DEBUG

> +config CORESIGHT_CPU_DEBUG_DEFAULT_ON
> +       bool "Enable CoreSight CPU Debug by default

^^ Eek, I failed to terminate this string, and kbuild is even warning about it:

drivers/hwtracing/coresight/Kconfig:145:warning: multi-line strings
not supported

Sorry about that; I can submit a v2 if you'd like, or feel free to fix
up my mistake when you apply it.

Sorry,
Brian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] coresight: cpu-debug: control default behavior via Kconfig
  2021-09-15 23:41 ` Brian Norris
@ 2021-09-15 23:52   ` Brian Norris
  0 siblings, 0 replies; 5+ messages in thread
From: Brian Norris @ 2021-09-15 23:52 UTC (permalink / raw)
  To: Leo Yan, Mathieu Poirier, Mike Leach, Suzuki K Poulose
  Cc: coresight, Linux Kernel, linux-arm-kernel

On Wed, Sep 15, 2021 at 4:41 PM Brian Norris <briannorris@chromium.org> wrote:
>
> On Fri, Sep 3, 2021 at 6:29 PM Brian Norris <briannorris@chromium.org> wrote:
> > --- a/drivers/hwtracing/coresight/Kconfig
> > +++ b/drivers/hwtracing/coresight/Kconfig
> > @@ -150,6 +150,19 @@ config CORESIGHT_CPU_DEBUG
>
> > +config CORESIGHT_CPU_DEBUG_DEFAULT_ON
> > +       bool "Enable CoreSight CPU Debug by default
>
> ^^ Eek, I failed to terminate this string, and kbuild is even warning about it:
>
> drivers/hwtracing/coresight/Kconfig:145:warning: multi-line strings
> not supported
>
> Sorry about that; I can submit a v2 if you'd like, or feel free to fix
> up my mistake when you apply it.

And I see you already fixed it -- should've checked before posting:

https://git.kernel.org/pub/scm/linux/kernel/git/coresight/linux.git/commit/?id=616ac6902c982f03da9d0b1e4f845df0980d055d
[Fixed missing double quote in Kconfig title]

Thanks,
Brian

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-15 23:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-04  1:28 [PATCH] coresight: cpu-debug: control default behavior via Kconfig Brian Norris
2021-09-04  2:31 ` Leo Yan
2021-09-06 15:37 ` Mathieu Poirier
2021-09-15 23:41 ` Brian Norris
2021-09-15 23:52   ` Brian Norris

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).