Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] arm64: Show three registers per line
@ 2021-04-20 17:22 Matthew Wilcox (Oracle)
  2021-04-20 18:57 ` Kees Cook
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Matthew Wilcox (Oracle) @ 2021-04-20 17:22 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Mark Rutland, Peter Zijlstra,
	Kees Cook, Marc Zyngier, Vincenzo Frascino
  Cc: Matthew Wilcox (Oracle), linux-arm-kernel, linux-kernel

Displaying two registers per line takes 15 lines.  That improves to just
10 lines if we display three registers per line, which reduces the amount
of information lost when oopses are cut off.  It stays within 80 columns
and matches x86-64.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 arch/arm64/kernel/process.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index 6e60aa3b5ea9..aff5a2c12297 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -294,13 +294,10 @@ void __show_regs(struct pt_regs *regs)
 	i = top_reg;
 
 	while (i >= 0) {
-		printk("x%-2d: %016llx ", i, regs->regs[i]);
-		i--;
+		printk("x%-2d: %016llx", i, regs->regs[i]);
 
-		if (i % 2 == 0) {
-			pr_cont("x%-2d: %016llx ", i, regs->regs[i]);
-			i--;
-		}
+		while (i-- % 3)
+			pr_cont(" x%-2d: %016llx", i, regs->regs[i]);
 
 		pr_cont("\n");
 	}
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: Show three registers per line
  2021-04-20 17:22 [PATCH] arm64: Show three registers per line Matthew Wilcox (Oracle)
@ 2021-04-20 18:57 ` Kees Cook
  2021-04-21  8:31 ` David Laight
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Kees Cook @ 2021-04-20 18:57 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle)
  Cc: Catalin Marinas, Will Deacon, Mark Rutland, Peter Zijlstra,
	Marc Zyngier, Vincenzo Frascino, linux-arm-kernel, linux-kernel

On Tue, Apr 20, 2021 at 06:22:45PM +0100, Matthew Wilcox (Oracle) wrote:
> Displaying two registers per line takes 15 lines.  That improves to just
> 10 lines if we display three registers per line, which reduces the amount
> of information lost when oopses are cut off.  It stays within 80 columns
> and matches x86-64.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Reviewed-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* RE: [PATCH] arm64: Show three registers per line
  2021-04-20 17:22 [PATCH] arm64: Show three registers per line Matthew Wilcox (Oracle)
  2021-04-20 18:57 ` Kees Cook
@ 2021-04-21  8:31 ` David Laight
  2021-04-22 10:35 ` Will Deacon
  2021-04-23 17:11 ` Catalin Marinas
  3 siblings, 0 replies; 5+ messages in thread
From: David Laight @ 2021-04-21  8:31 UTC (permalink / raw)
  To: 'Matthew Wilcox (Oracle)',
	Catalin Marinas, Will Deacon, Mark Rutland, Peter Zijlstra,
	Kees Cook, Marc Zyngier, Vincenzo Frascino
  Cc: linux-arm-kernel, linux-kernel

From: Matthew Wilcox
> Sent: 20 April 2021 18:23
>
> Displaying two registers per line takes 15 lines.  That improves to just
> 10 lines if we display three registers per line, which reduces the amount
> of information lost when oopses are cut off.  It stays within 80 columns
> and matches x86-64.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>  arch/arm64/kernel/process.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
> index 6e60aa3b5ea9..aff5a2c12297 100644
> --- a/arch/arm64/kernel/process.c
> +++ b/arch/arm64/kernel/process.c
> @@ -294,13 +294,10 @@ void __show_regs(struct pt_regs *regs)
>  	i = top_reg;
> 
>  	while (i >= 0) {
> -		printk("x%-2d: %016llx ", i, regs->regs[i]);
> -		i--;
> +		printk("x%-2d: %016llx", i, regs->regs[i]);
> 
> -		if (i % 2 == 0) {
> -			pr_cont("x%-2d: %016llx ", i, regs->regs[i]);
> -			i--;
> -		}
> +		while (i-- % 3)
> +			pr_cont(" x%-2d: %016llx", i, regs->regs[i]);
> 
>  		pr_cont("\n");
>  	}

I think I'd avoid pr_cont() to avoid 'mishaps' during concurrent oops.
This probably needs something like:
	for (; i >= 0; i -= 3) {
		switch (i) {
		case 0:
			printk("x%-2d: %016llx\n", i, regs->regs[i]);
			break;
		case 1:
			printk("x%-2d: %016llx x%-2d: %016llx\n",
			       i, regs->regs[i], i - 1, regs->regs[i - 1]);
			break;
		default:
			printk("x%-2d: %016llx x%-2d: %016llx x%-2d: %016llx\n",
			       i, regs->regs[i], i - 1, regs->regs[i - 1],
				 i - 2, regs->regs[i - 2]);
			continue;
		}
		break;
	}

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: Show three registers per line
  2021-04-20 17:22 [PATCH] arm64: Show three registers per line Matthew Wilcox (Oracle)
  2021-04-20 18:57 ` Kees Cook
  2021-04-21  8:31 ` David Laight
@ 2021-04-22 10:35 ` Will Deacon
  2021-04-23 17:11 ` Catalin Marinas
  3 siblings, 0 replies; 5+ messages in thread
From: Will Deacon @ 2021-04-22 10:35 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle)
  Cc: Catalin Marinas, Mark Rutland, Peter Zijlstra, Kees Cook,
	Marc Zyngier, Vincenzo Frascino, linux-arm-kernel, linux-kernel

On Tue, Apr 20, 2021 at 06:22:45PM +0100, Matthew Wilcox (Oracle) wrote:
> Displaying two registers per line takes 15 lines.  That improves to just
> 10 lines if we display three registers per line, which reduces the amount
> of information lost when oopses are cut off.  It stays within 80 columns
> and matches x86-64.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>  arch/arm64/kernel/process.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)

Acked-by: Will Deacon <will@kernel.org>

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: Show three registers per line
  2021-04-20 17:22 [PATCH] arm64: Show three registers per line Matthew Wilcox (Oracle)
                   ` (2 preceding siblings ...)
  2021-04-22 10:35 ` Will Deacon
@ 2021-04-23 17:11 ` Catalin Marinas
  3 siblings, 0 replies; 5+ messages in thread
From: Catalin Marinas @ 2021-04-23 17:11 UTC (permalink / raw)
  To: Peter Zijlstra, Marc Zyngier, Mark Rutland, Vincenzo Frascino,
	Kees Cook, Matthew Wilcox (Oracle),
	Will Deacon
  Cc: linux-kernel, linux-arm-kernel

On Tue, 20 Apr 2021 18:22:45 +0100, Matthew Wilcox (Oracle) wrote:
> Displaying two registers per line takes 15 lines.  That improves to just
> 10 lines if we display three registers per line, which reduces the amount
> of information lost when oopses are cut off.  It stays within 80 columns
> and matches x86-64.

Applied to arm64 (for-next/core), thanks!

[1/1] arm64: Show three registers per line
      https://git.kernel.org/arm64/c/0bca3ec846d7

-- 
Catalin


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-20 17:22 [PATCH] arm64: Show three registers per line Matthew Wilcox (Oracle)
2021-04-20 18:57 ` Kees Cook
2021-04-21  8:31 ` David Laight
2021-04-22 10:35 ` Will Deacon
2021-04-23 17:11 ` Catalin Marinas

Linux-ARM-Kernel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/0 linux-arm-kernel/git/0.git
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/1 linux-arm-kernel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-kernel linux-arm-kernel/ https://lore.kernel.org/linux-arm-kernel \
		linux-arm-kernel@lists.infradead.org
	public-inbox-index linux-arm-kernel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-arm-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git