linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] documentation: Add nodebugmon for arm64 platforms
@ 2025-04-16  6:27 Anshuman Khandual
  2025-04-18  0:25 ` Bagas Sanjaya
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Anshuman Khandual @ 2025-04-16  6:27 UTC (permalink / raw)
  To: linux-doc
  Cc: Anshuman Khandual, Jonathan Corbet, Andrew Morton,
	Catalin Marinas, Will Deacon, Mark Rutland, linux-kernel,
	linux-arm-kernel

Add an entry for nodebugmon which has been used on arm64 platforms.

Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: linux-doc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
This patch applies on v6.15-rc2

 Documentation/admin-guide/kernel-parameters.txt | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index d9fd26b95b34..f4a313d6c0ab 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -4085,6 +4085,13 @@
 			/sys/module/printk/parameters/console_suspend) to
 			turn on/off it dynamically.
 
+	nodebugmon
+			[HW,ARM64] Disable debug monitor
+			Disables the debug monitor exception handling on the platform
+			regardless whether breakpoints and watchpoints are programmed
+			or not. This prevents debug exceptions from being enabled via
+			MDSCR_EL1 register.
+
 	no_debug_objects
 			[KNL,EARLY] Disable object debugging
 
-- 
2.25.1



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

* Re: [PATCH] documentation: Add nodebugmon for arm64 platforms
  2025-04-16  6:27 [PATCH] documentation: Add nodebugmon for arm64 platforms Anshuman Khandual
@ 2025-04-18  0:25 ` Bagas Sanjaya
  2025-04-29  4:14 ` Anshuman Khandual
  2025-04-29 16:27 ` Will Deacon
  2 siblings, 0 replies; 5+ messages in thread
From: Bagas Sanjaya @ 2025-04-18  0:25 UTC (permalink / raw)
  To: Anshuman Khandual, linux-doc
  Cc: Jonathan Corbet, Andrew Morton, Catalin Marinas, Will Deacon,
	Mark Rutland, linux-kernel, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 508 bytes --]

On Wed, Apr 16, 2025 at 11:57:06AM +0530, Anshuman Khandual wrote:
> +	nodebugmon
> +			[HW,ARM64] Disable debug monitor
> +			Disables the debug monitor exception handling on the platform
> +			regardless whether breakpoints and watchpoints are programmed
> +			or not. This prevents debug exceptions from being enabled via
> +			MDSCR_EL1 register.

The wording looks good, thanks!

Reviewed-by: Bagas Sanjaya <bagasdotme@gmail.com>

-- 
An old man doll... just what I always wanted! - Clara

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH] documentation: Add nodebugmon for arm64 platforms
  2025-04-16  6:27 [PATCH] documentation: Add nodebugmon for arm64 platforms Anshuman Khandual
  2025-04-18  0:25 ` Bagas Sanjaya
@ 2025-04-29  4:14 ` Anshuman Khandual
  2025-04-29 16:27 ` Will Deacon
  2 siblings, 0 replies; 5+ messages in thread
From: Anshuman Khandual @ 2025-04-29  4:14 UTC (permalink / raw)
  To: linux-doc
  Cc: Jonathan Corbet, Andrew Morton, Catalin Marinas, Will Deacon,
	Mark Rutland, linux-kernel, linux-arm-kernel



On 4/16/25 11:57, Anshuman Khandual wrote:
> Add an entry for nodebugmon which has been used on arm64 platforms.
> 
> Cc: Jonathan Corbet <corbet@lwn.net>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: linux-doc@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> This patch applies on v6.15-rc2
> 
>  Documentation/admin-guide/kernel-parameters.txt | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index d9fd26b95b34..f4a313d6c0ab 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -4085,6 +4085,13 @@
>  			/sys/module/printk/parameters/console_suspend) to
>  			turn on/off it dynamically.
>  
> +	nodebugmon
> +			[HW,ARM64] Disable debug monitor
> +			Disables the debug monitor exception handling on the platform
> +			regardless whether breakpoints and watchpoints are programmed
> +			or not. This prevents debug exceptions from being enabled via
> +			MDSCR_EL1 register.
> +
>  	no_debug_objects
>  			[KNL,EARLY] Disable object debugging
>  

Any updates on this ?


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

* Re: [PATCH] documentation: Add nodebugmon for arm64 platforms
  2025-04-16  6:27 [PATCH] documentation: Add nodebugmon for arm64 platforms Anshuman Khandual
  2025-04-18  0:25 ` Bagas Sanjaya
  2025-04-29  4:14 ` Anshuman Khandual
@ 2025-04-29 16:27 ` Will Deacon
  2025-04-30  4:31   ` Anshuman Khandual
  2 siblings, 1 reply; 5+ messages in thread
From: Will Deacon @ 2025-04-29 16:27 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-doc, Jonathan Corbet, Andrew Morton, Catalin Marinas,
	Mark Rutland, linux-kernel, linux-arm-kernel

On Wed, Apr 16, 2025 at 11:57:06AM +0530, Anshuman Khandual wrote:
> Add an entry for nodebugmon which has been used on arm64 platforms.
> 
> Cc: Jonathan Corbet <corbet@lwn.net>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: linux-doc@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> This patch applies on v6.15-rc2
> 
>  Documentation/admin-guide/kernel-parameters.txt | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index d9fd26b95b34..f4a313d6c0ab 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -4085,6 +4085,13 @@
>  			/sys/module/printk/parameters/console_suspend) to
>  			turn on/off it dynamically.
>  
> +	nodebugmon
> +			[HW,ARM64] Disable debug monitor
> +			Disables the debug monitor exception handling on the platform
> +			regardless whether breakpoints and watchpoints are programmed
> +			or not. This prevents debug exceptions from being enabled via
> +			MDSCR_EL1 register.

Hmm. I appreciate the effort to document this, but I'm not sure that the
text above is really going to help anybody.

Firstly, this option goes hand-in-hand with a debugfs control
("debug_enabled") and so the two would ideally be documented together.

Secondly, I think the documentation should talk about the user-visible
effects that the control has... and that's where I get stuck! This has
been there since day 1 but I'm not really sure what it's useful for. I
_do_ remember needing it to use the DS-5 debugger back in the day, but
looking at what the option does (it mostly prevents the kernel from
touching MDSCR_EL1.{MDE,KDE} which effectively disables hardware
breakpoints and watchpoints for kernel/user and single-step for kernel)
I don't see why that's relevant for halting debug. The architecture says
that EDSCR.HDE can be used by the external debugger to enter debug state
and I don't see anything to suggest that MDSCR_EL1 settings interfere
with this.

Maybe the problem was that the external debugger left a load of live
breakpoint registers around after detaching, so this was a way to
suppress those? I don't remember :/

I wonder if we can remove this?

Will


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

* Re: [PATCH] documentation: Add nodebugmon for arm64 platforms
  2025-04-29 16:27 ` Will Deacon
@ 2025-04-30  4:31   ` Anshuman Khandual
  0 siblings, 0 replies; 5+ messages in thread
From: Anshuman Khandual @ 2025-04-30  4:31 UTC (permalink / raw)
  To: Will Deacon
  Cc: linux-doc, Jonathan Corbet, Andrew Morton, Catalin Marinas,
	Mark Rutland, linux-kernel, linux-arm-kernel

On 4/29/25 21:57, Will Deacon wrote:
> On Wed, Apr 16, 2025 at 11:57:06AM +0530, Anshuman Khandual wrote:
>> Add an entry for nodebugmon which has been used on arm64 platforms.
>>
>> Cc: Jonathan Corbet <corbet@lwn.net>
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Will Deacon <will@kernel.org>
>> Cc: Mark Rutland <mark.rutland@arm.com>
>> Cc: linux-doc@vger.kernel.org
>> Cc: linux-kernel@vger.kernel.org
>> Cc: linux-arm-kernel@lists.infradead.org
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>> ---
>> This patch applies on v6.15-rc2
>>
>>  Documentation/admin-guide/kernel-parameters.txt | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
>> index d9fd26b95b34..f4a313d6c0ab 100644
>> --- a/Documentation/admin-guide/kernel-parameters.txt
>> +++ b/Documentation/admin-guide/kernel-parameters.txt
>> @@ -4085,6 +4085,13 @@
>>  			/sys/module/printk/parameters/console_suspend) to
>>  			turn on/off it dynamically.
>>  
>> +	nodebugmon
>> +			[HW,ARM64] Disable debug monitor
>> +			Disables the debug monitor exception handling on the platform
>> +			regardless whether breakpoints and watchpoints are programmed
>> +			or not. This prevents debug exceptions from being enabled via
>> +			MDSCR_EL1 register.
> 
> Hmm. I appreciate the effort to document this, but I'm not sure that the
> text above is really going to help anybody.
> 
> Firstly, this option goes hand-in-hand with a debugfs control
> ("debug_enabled") and so the two would ideally be documented together.

Completely agree on this, but could find an appropriate Documentation/
file listing arm64 platform relate debugfs interfaces. Just wondering
if we need to have such a file created in Documentation/arch/arm64 ?

> 
> Secondly, I think the documentation should talk about the user-visible
> effects that the control has... and that's where I get stuck! This has
> been there since day 1 but I'm not really sure what it's useful for. I

Hmm, alright. I tried to reason about what is being done in the kernel
but as you mentioned above, user visible effects were not very clearly
apparent. But having a kernel command line option without documenting
on what it really does seemed problematic as well.

> _do_ remember needing it to use the DS-5 debugger back in the day, but
> looking at what the option does (it mostly prevents the kernel from
> touching MDSCR_EL1.{MDE,KDE} which effectively disables hardware
> breakpoints and watchpoints for kernel/user and single-step for kernel)

Right, it is an system wide override regardless whether there are any
current users for these break/watch points.

> I don't see why that's relevant for halting debug. The architecture says
> that EDSCR.HDE can be used by the external debugger to enter debug state
> and I don't see anything to suggest that MDSCR_EL1 settings interfere
> with this.

ARM ARM DDI 0487 L.A states that EDSCR.HDE can be used to enable/disable
debug halting with OSLSR_EL1.OSLK = 1. Hence MDSCR_EL1.{MDE,KDE} controls
are not required to disable debug state in kernel.

> 
> Maybe the problem was that the external debugger left a load of live
> breakpoint registers around after detaching, so this was a way to
> suppress those? I don't remember :/

But that would be a bug in the HW, not an expected behaviour - is not it ?

> 
> I wonder if we can remove this?

Yes, we could probably remove both 'nodebugmon' kernel command line option
and 'debug_enabled' debug fs control if EDSCR.HDE is the controller of the
debug state for external debuggers.


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

end of thread, other threads:[~2025-04-30  4:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-16  6:27 [PATCH] documentation: Add nodebugmon for arm64 platforms Anshuman Khandual
2025-04-18  0:25 ` Bagas Sanjaya
2025-04-29  4:14 ` Anshuman Khandual
2025-04-29 16:27 ` Will Deacon
2025-04-30  4:31   ` Anshuman Khandual

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