Re: [PATCH] stacktrace: fix spaces and annoying extra newlines

From: Linus Torvalds
Date: Tue Feb 07 2017 - 18:23:08 EST


Hmm.

Looks ok, except I think we migth want to go even further:

On Tue, Feb 7, 2017 at 2:44 PM, Omar Sandoval <osandov@xxxxxxxxxxx> wrote:
>
> Since KERN_CONT became meaningful again, lockdep stack traces have
> looked like this:

[ removed really ugly trace ]

> This is what it should look like:
>
> [ 6.650322] -> #1 (B){+.+...}:
> [ 6.651053] [<ffffffff810d8873>] lock_acquire+0xc3/0x210
> [ 6.652000] [<ffffffff816f6414>] mutex_lock_nested+0x74/0x6d0
> [ 6.652664] [<ffffffffa01b43c3>] init_btrfs_fs+0x21/0x196 [btrfs]
> [ 6.653288] [<ffffffff81000472>] do_one_initcall+0x52/0x1b0
> [ 6.653858] [<ffffffff811a3ae6>] do_init_module+0x5f/0x209
> [ 6.654426] [<ffffffff81122f3d>] load_module+0x218d/0x2b80
> [ 6.654992] [<ffffffff81123bdb>] SyS_finit_module+0xeb/0x120
> [ 6.655591] [<ffffffff816fd241>] entry_SYSCALL_64_fastpath+0x1f/0xc2

That's still pretty ugly.

Actually, let's just remove those hex numbers too, which buy you nothing at all.

> - printk("%*c", 1 + spaces, ' ');
> - print_ip_sym(trace->entries[i]);
> + ip = (void *)trace->entries[i];
> + printk("%*c[<%p>] %pS\n", 1 + spaces, ' ', ip, ip);

So how does it look if we make that just be

printk("%*c%pS\n", 1 + spaces, ' ', (void *)trace->entries[i]);

which also avoids the extra variable because the thing is only used
once anyway. We've removed the hex numbers from other printouts, and
they really are completely useless with modules and kernel randomized
addresses.

Would you mind testing such a thing and re-submitting?

Linus