* [PATCH V2] arm64: Neaten show_regs, remove KERN_CONT
@ 2016-10-25 16:40 Joe Perches
2016-10-25 17:07 ` Mark Rutland
0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2016-10-25 16:40 UTC (permalink / raw)
To: Mark Rutland, linux-kernel; +Cc: Catalin Marinas, Will Deacon, linux-arm-kernel
commit db4b0710fae9 ("arm64: fix show_regs fallout from KERN_CONT changes")
corrected the KERN_CONT fallout from commit 4bcc595ccd80
("printk: reinstate KERN_CONT for printing continuation lines"), but
the code still has unnecessary KERN_CONT uses.
Remove the KERN_CONT uses to avoid possible message interleaving.
Miscellanea:
o Remove unnecessary trailing blank from the output too.
o Convert i and top_reg to unsigned int
o Move the extra blank line after __show_reg to the caller for symmetry
Signed-off-by: Joe Perches <joe@perches.com>
---
arch/arm64/kernel/process.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index 01753cd7d3f0..5ba12f019bf7 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -168,7 +168,7 @@ void machine_restart(char *cmd)
void __show_regs(struct pt_regs *regs)
{
- int i, top_reg;
+ unsigned int i, top_reg;
u64 lr, sp;
if (compat_user_mode(regs)) {
@@ -190,24 +190,23 @@ void __show_regs(struct pt_regs *regs)
i = top_reg;
- while (i >= 0) {
- printk("x%-2d: %016llx ", i, regs->regs[i]);
+ if (i % 2) {
+ printk("x%-2d: %016llx\n", i, regs->regs[i]);
i--;
-
- if (i % 2 == 0) {
- pr_cont("x%-2d: %016llx ", i, regs->regs[i]);
- i--;
- }
-
- pr_cont("\n");
}
- printk("\n");
+ while (i > 0) {
+ printk("x%-2d: %016llx x%-2d: %016llx\n",
+ i, regs->regs[i],
+ i - 1, regs->regs[i - 1]);
+ i -= 2;
+ }
}
void show_regs(struct pt_regs * regs)
{
printk("\n");
__show_regs(regs);
+ printk("\n");
}
static void tls_thread_flush(void)
--
2.10.0.rc2.1.g053435c
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH V2] arm64: Neaten show_regs, remove KERN_CONT
2016-10-25 16:40 [PATCH V2] arm64: Neaten show_regs, remove KERN_CONT Joe Perches
@ 2016-10-25 17:07 ` Mark Rutland
2016-10-25 17:29 ` Joe Perches
0 siblings, 1 reply; 3+ messages in thread
From: Mark Rutland @ 2016-10-25 17:07 UTC (permalink / raw)
To: Joe Perches; +Cc: linux-kernel, Catalin Marinas, Will Deacon, linux-arm-kernel
On Tue, Oct 25, 2016 at 09:40:26AM -0700, Joe Perches wrote:
> commit db4b0710fae9 ("arm64: fix show_regs fallout from KERN_CONT changes")
> corrected the KERN_CONT fallout from commit 4bcc595ccd80
> ("printk: reinstate KERN_CONT for printing continuation lines"), but
> the code still has unnecessary KERN_CONT uses.
>
> Remove the KERN_CONT uses to avoid possible message interleaving.
>
> Miscellanea:
>
> o Remove unnecessary trailing blank from the output too.
> o Convert i and top_reg to unsigned int
> o Move the extra blank line after __show_reg to the caller for symmetry
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> arch/arm64/kernel/process.c | 21 ++++++++++-----------
> 1 file changed, 10 insertions(+), 11 deletions(-)
>
> diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
> index 01753cd7d3f0..5ba12f019bf7 100644
> --- a/arch/arm64/kernel/process.c
> +++ b/arch/arm64/kernel/process.c
> @@ -168,7 +168,7 @@ void machine_restart(char *cmd)
>
> void __show_regs(struct pt_regs *regs)
> {
> - int i, top_reg;
> + unsigned int i, top_reg;
This change is not necessary. These will work perfectly fine as ints;
please leave them as-is.
> u64 lr, sp;
>
> if (compat_user_mode(regs)) {
> @@ -190,24 +190,23 @@ void __show_regs(struct pt_regs *regs)
>
> i = top_reg;
>
> - while (i >= 0) {
> - printk("x%-2d: %016llx ", i, regs->regs[i]);
> + if (i % 2) {
This should be:
if (i % 2 == 0) {
Otherwise we'll lose x0 in the native case (and x29 will be given a line
of its own).
> + printk("x%-2d: %016llx\n", i, regs->regs[i]);
> i--;
> -
> - if (i % 2 == 0) {
> - pr_cont("x%-2d: %016llx ", i, regs->regs[i]);
> - i--;
> - }
> -
> - pr_cont("\n");
> }
> - printk("\n");
> + while (i > 0) {
> + printk("x%-2d: %016llx x%-2d: %016llx\n",
> + i, regs->regs[i],
> + i - 1, regs->regs[i - 1]);
> + i -= 2;
> + }
> }
>
> void show_regs(struct pt_regs * regs)
> {
> printk("\n");
> __show_regs(regs);
> + printk("\n");
> }
Other functions call __show_regs() directly and the trailing newline
there is expected. Please leave it in __show_regs().
Otherwise, this looks fine to me.
Thanks,
Mark.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH V2] arm64: Neaten show_regs, remove KERN_CONT
2016-10-25 17:07 ` Mark Rutland
@ 2016-10-25 17:29 ` Joe Perches
0 siblings, 0 replies; 3+ messages in thread
From: Joe Perches @ 2016-10-25 17:29 UTC (permalink / raw)
To: Mark Rutland; +Cc: linux-kernel, Catalin Marinas, Will Deacon, linux-arm-kernel
On Tue, 2016-10-25 at 18:07 +0100, Mark Rutland wrote:
> On Tue, Oct 25, 2016 at 09:40:26AM -0700, Joe Perches wrote:
> > commit db4b0710fae9 ("arm64: fix show_regs fallout from KERN_CONT changes")
> > corrected the KERN_CONT fallout from commit 4bcc595ccd80
> > ("printk: reinstate KERN_CONT for printing continuation lines"), but
> > the code still has unnecessary KERN_CONT uses.
> >
> > Remove the KERN_CONT uses to avoid possible message interleaving.
Hey Mark.
Please fix it as you think appropriate.
No credit to me is necessary.
cheers, Joe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-10-25 17:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-25 16:40 [PATCH V2] arm64: Neaten show_regs, remove KERN_CONT Joe Perches
2016-10-25 17:07 ` Mark Rutland
2016-10-25 17:29 ` Joe Perches
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).