All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv3 00/50] Add log level to show_stack()
@ 2020-04-18 20:18 ` Dmitry Safonov
  0 siblings, 0 replies; 102+ messages in thread
From: Dmitry Safonov @ 2020-04-18 20:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Juri Lelli, linux-sh, Catalin Marinas, Ben Segall, Guo Ren,
	Pavel Machek, Vincent Guittot, Paul Burton, Dmitry Safonov,
	Michael Ellerman, Geert Uytterhoeven, Mel Gorman, Jiri Slaby,
	Matt Turner, uclinux-h8-devel, Len Brown, linux-pm,
	Heiko Carstens, linux-um, Thomas Gleixner, Dietmar Eggemann,
	Richard Henderson, Greg Kroah-Hartman, Rafael J. Wysocki,
	Ralf Baechle, Paul Mackerras, Andrew Morton, linux-ia64,
	Tetsuo Handa, James Hogan, James E.J. Bottomley, Max Filippov,
	Vincent Chen, Ingo Molnar, linux-s390, linux-c6x-dev,
	Yoshinori Sato, linux-hexagon, Helge Deller, Rafael J. Wysocki,
	linux-xtensa, Vasily Gorbik, Aurelien Jacquiot, linux-m68k,
	Stafford Horne, linux-arm-kernel, Chris Zankel, Tony Luck,
	Douglas Anderson, Benjamin Herrenschmidt, Dmitry Safonov,
	Will Deacon, Daniel Thompson, Brian Cain, Christian Borntraeger,
	kgdb-bugreport, linux-snps-arc, Fenghua Yu, Borislav Petkov,
	Jeff Dike, Steven Rostedt, Ivan Kokshaysky, Greentime Hu,
	Guan Xuetao, linux-parisc, linux-alpha, Ley Foon Tan,
	David S. Miller, Rich Felker, Petr Mladek, Peter Zijlstra,
	H. Peter Anvin, sparclinux, linux-riscv, Anton Ivanov,
	Jonas Bonn, Richard Weinberger, x86, Russell King,
	clang-built-linux, Ingo Molnar, Mark Salter, Albert Ou,
	Stefan Kristiansson, openrisc, Paul Walmsley, Michal Simek,
	Vineet Gupta, linux-mips, Sergey Senozhatsky, Palmer Dabbelt,
	Jason Wessel, nios2-dev, linuxppc-dev

Changes to v3:
- Collected more architectual Acks and Reviewed-by
- Fixed compilation on sparc64

Changes to v2:
- Removed excessive pr_cont("\n") (nits by Senozhatsky)
- Leave backtrace debugging messages with pr_debug()
  (noted by Russell King and Will Deacon)
- Correct microblaze_unwind_inner() declaration
  (Thanks to Michal Simek and kbuild test robot)
- Fix copy'n'paste typo in show_stack_loglvl() for sparc
  (kbuild robot)
- Fix backtrace output on xtensa
  (Thanks Max Filippov)
- Add loglevel to show_stack() on s390 (kbuild robot)
- Collected all Reviewed-by and Acked-by (thanks!)

v2: https://lore.kernel.org/linux-riscv/20200316143916.195608-1-dima@arista.com/
v1: https://lore.kernel.org/linux-riscv/20191106030542.868541-1-dima@arista.com/

Add log level argument to show_stack().
Done in three stages:
1. Introducing show_stack_loglvl() for every architecture
2. Migrating old users with an explicit log level
3. Renaming show_stack_loglvl() into show_stack()

Justification:
o It's a design mistake to move a business-logic decision
  into platform realization detail.
o I have currently two patches sets that would benefit from this work:
  Removing console_loglevel jumps in sysrq driver [1]
  Hung task warning before panic [2] - suggested by Tetsuo (but he
  probably didn't realise what it would involve).
o While doing (1), (2) the backtraces were adjusted to headers
  and other messages for each situation - so there won't be a situation
  when the backtrace is printed, but the headers are missing because
  they have lesser log level (or the reverse).
o As the result in (2) plays with console_loglevel for kdb are removed.

The least important for upstream, but maybe still worth to note that
every company I've worked in so far had an off-list patch to print
backtrace with the needed log level (but only for the architecture they
cared about).
If you have other ideas how you will benefit from show_stack() with
a log level - please, reply to this cover letter.

See also discussion on v1:
https://lore.kernel.org/linux-riscv/20191106083538.z5nlpuf64cigxigh@pathway.suse.cz/

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>

Thanks,
Dmitry

[1]: https://lore.kernel.org/lkml/20190528002412.1625-1-dima@arista.com/T/#u
[2]: https://lkml.kernel.org/r/41fd7652-df1f-26f6-aba0-b87ebae07db6@i-love.sakura.ne.jp

Dmitry Safonov (50):
  kallsyms/printk: Add loglvl to print_ip_sym()
  alpha: Add show_stack_loglvl()
  arc: Add show_stack_loglvl()
  arm/asm: Add loglvl to c_backtrace()
  arm: Add loglvl to unwind_backtrace()
  arm: Add loglvl to dump_backtrace()
  arm: Wire up dump_backtrace_{entry,stm}
  arm: Add show_stack_loglvl()
  arm64: Add loglvl to dump_backtrace()
  arm64: Add show_stack_loglvl()
  c6x: Add show_stack_loglvl()
  csky: Add show_stack_loglvl()
  h8300: Add show_stack_loglvl()
  hexagon: Add show_stack_loglvl()
  ia64: Pass log level as arg into ia64_do_show_stack()
  ia64: Add show_stack_loglvl()
  m68k: Add show_stack_loglvl()
  microblaze: Add loglvl to microblaze_unwind_inner()
  microblaze: Add loglvl to microblaze_unwind()
  microblaze: Add show_stack_loglvl()
  mips: Add show_stack_loglvl()
  nds32: Add show_stack_loglvl()
  nios2: Add show_stack_loglvl()
  openrisc: Add show_stack_loglvl()
  parisc: Add show_stack_loglvl()
  powerpc: Add show_stack_loglvl()
  riscv: Add show_stack_loglvl()
  s390: Add show_stack_loglvl()
  sh: Add loglvl to dump_mem()
  sh: Remove needless printk()
  sh: Add loglvl to printk_address()
  sh: Add loglvl to show_trace()
  sh: Add show_stack_loglvl()
  sparc: Add show_stack_loglvl()
  um/sysrq: Remove needless variable sp
  um: Add show_stack_loglvl()
  unicore32: Remove unused pmode argument in c_backtrace()
  unicore32: Add loglvl to c_backtrace()
  unicore32: Add show_stack_loglvl()
  x86: Add missing const qualifiers for log_lvl
  x86: Add show_stack_loglvl()
  xtensa: Add loglvl to show_trace()
  xtensa: Add show_stack_loglvl()
  sysrq: Use show_stack_loglvl()
  x86/amd_gart: Print stacktrace for a leak with KERN_ERR
  power: Use show_stack_loglvl()
  kdb: Don't play with console_loglevel
  sched: Print stack trace with KERN_INFO
  kernel: Use show_stack_loglvl()
  kernel: Rename show_stack_loglvl() => show_stack()

 arch/alpha/kernel/traps.c            | 22 +++++++--------
 arch/arc/include/asm/bug.h           |  3 ++-
 arch/arc/kernel/stacktrace.c         | 17 +++++++-----
 arch/arc/kernel/troubleshoot.c       |  2 +-
 arch/arm/include/asm/bug.h           |  3 ++-
 arch/arm/include/asm/traps.h         |  3 ++-
 arch/arm/include/asm/unwind.h        |  3 ++-
 arch/arm/kernel/traps.c              | 39 +++++++++++++++------------
 arch/arm/kernel/unwind.c             |  5 ++--
 arch/arm/lib/backtrace-clang.S       |  9 +++++--
 arch/arm/lib/backtrace.S             | 14 +++++++---
 arch/arm64/include/asm/stacktrace.h  |  3 ++-
 arch/arm64/kernel/process.c          |  2 +-
 arch/arm64/kernel/traps.c            | 17 ++++++------
 arch/c6x/kernel/traps.c              | 16 ++++++-----
 arch/csky/kernel/dumpstack.c         |  9 ++++---
 arch/csky/kernel/ptrace.c            |  4 +--
 arch/h8300/kernel/traps.c            | 12 ++++-----
 arch/hexagon/kernel/traps.c          | 25 ++++++++---------
 arch/ia64/include/asm/ptrace.h       |  1 -
 arch/ia64/kernel/mca.c               |  2 +-
 arch/ia64/kernel/process.c           | 17 ++++++------
 arch/m68k/kernel/traps.c             | 13 ++++-----
 arch/microblaze/include/asm/unwind.h |  3 ++-
 arch/microblaze/kernel/stacktrace.c  |  4 +--
 arch/microblaze/kernel/traps.c       | 12 ++++-----
 arch/microblaze/kernel/unwind.c      | 40 +++++++++++++++++-----------
 arch/mips/kernel/traps.c             | 35 ++++++++++++------------
 arch/nds32/kernel/traps.c            | 15 ++++++-----
 arch/nios2/kernel/traps.c            | 17 ++++++------
 arch/openrisc/kernel/traps.c         | 12 +++++----
 arch/parisc/kernel/traps.c           | 24 ++++++++---------
 arch/powerpc/kernel/process.c        | 15 ++++++-----
 arch/powerpc/kernel/stacktrace.c     |  2 +-
 arch/riscv/kernel/stacktrace.c       |  9 ++++---
 arch/s390/kernel/dumpstack.c         | 13 ++++-----
 arch/sh/include/asm/kdebug.h         |  6 +++--
 arch/sh/include/asm/processor_32.h   |  2 +-
 arch/sh/kernel/dumpstack.c           | 36 ++++++++++++-------------
 arch/sh/kernel/process_32.c          |  2 +-
 arch/sh/kernel/process_64.c          |  3 +--
 arch/sh/kernel/traps.c               |  4 +--
 arch/sh/mm/fault.c                   |  2 +-
 arch/sparc/kernel/process_32.c       | 10 +++----
 arch/sparc/kernel/process_64.c       |  2 +-
 arch/sparc/kernel/traps_64.c         |  9 ++++---
 arch/um/drivers/mconsole_kern.c      |  2 +-
 arch/um/kernel/sysrq.c               | 23 ++++++++--------
 arch/unicore32/kernel/setup.h        |  2 +-
 arch/unicore32/kernel/traps.c        | 34 +++++++++++------------
 arch/unicore32/lib/backtrace.S       | 24 +++++++++++------
 arch/x86/include/asm/stacktrace.h    |  2 +-
 arch/x86/kernel/amd_gart_64.c        |  2 +-
 arch/x86/kernel/dumpstack.c          |  9 ++++---
 arch/xtensa/kernel/traps.c           | 22 ++++++++-------
 drivers/base/power/main.c            |  2 +-
 drivers/tty/sysrq.c                  |  2 +-
 include/linux/kallsyms.h             |  4 +--
 include/linux/sched/debug.h          |  3 ++-
 kernel/debug/kdb/kdb_bt.c            | 15 ++++++-----
 kernel/locking/lockdep.c             |  4 +--
 kernel/locking/rtmutex-debug.c       |  2 +-
 kernel/sched/core.c                  |  8 +++---
 kernel/trace/ftrace.c                |  8 +++---
 lib/dump_stack.c                     |  2 +-
 tools/include/linux/kallsyms.h       |  2 +-
 66 files changed, 375 insertions(+), 315 deletions(-)

-- 
2.26.0



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

end of thread, other threads:[~2020-05-18 13:35 UTC | newest]

Thread overview: 102+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-18 20:18 [PATCHv3 00/50] Add log level to show_stack() Dmitry Safonov
2020-04-18 20:18 ` Dmitry Safonov
2020-04-18 20:18 ` Dmitry Safonov
2020-04-18 20:18 ` [OpenRISC] " Dmitry Safonov
2020-04-18 20:18 ` Dmitry Safonov
2020-04-18 20:18 ` Dmitry Safonov
2020-04-18 20:18 ` [PATCHv3 01/50] kallsyms/printk: Add loglvl to print_ip_sym() Dmitry Safonov
2020-04-18 20:18   ` Dmitry Safonov
2020-04-18 20:40   ` Joe Perches
2020-04-18 20:40     ` Joe Perches
2020-04-20 17:25     ` Dmitry Safonov
2020-04-20 17:25       ` Dmitry Safonov
2020-04-20 17:28       ` Joe Perches
2020-04-20 17:28         ` Joe Perches
2020-04-18 20:18 ` [PATCHv3 02/50] alpha: Add show_stack_loglvl() Dmitry Safonov
2020-04-18 20:18 ` [PATCHv3 03/50] arc: " Dmitry Safonov
2020-04-18 20:18   ` Dmitry Safonov
2020-04-18 20:18 ` [PATCHv3 04/50] arm/asm: Add loglvl to c_backtrace() Dmitry Safonov
2020-04-18 20:18   ` Dmitry Safonov
2020-04-18 20:18 ` [PATCHv3 05/50] arm: Add loglvl to unwind_backtrace() Dmitry Safonov
2020-04-18 20:18   ` Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 06/50] arm: Add loglvl to dump_backtrace() Dmitry Safonov
2020-04-18 20:19   ` Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 07/50] arm: Wire up dump_backtrace_{entry,stm} Dmitry Safonov
2020-04-18 20:19   ` Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 08/50] arm: Add show_stack_loglvl() Dmitry Safonov
2020-04-18 20:19   ` Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 09/50] arm64: Add loglvl to dump_backtrace() Dmitry Safonov
2020-04-18 20:19   ` Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 10/50] arm64: Add show_stack_loglvl() Dmitry Safonov
2020-04-18 20:19   ` Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 11/50] c6x: " Dmitry Safonov
2020-04-25 18:18   ` Joe Perches
2020-04-26  1:06     ` Tetsuo Handa
2020-04-27 14:32       ` Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 12/50] csky: " Dmitry Safonov
2020-05-15 19:23   ` Andrew Morton
2020-05-18 13:34     ` Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 13/50] h8300: " Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 14/50] hexagon: " Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 15/50] ia64: Pass log level as arg into ia64_do_show_stack() Dmitry Safonov
2020-04-18 20:19   ` Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 16/50] ia64: Add show_stack_loglvl() Dmitry Safonov
2020-04-18 20:19   ` Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 17/50] m68k: " Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 18/50] microblaze: Add loglvl to microblaze_unwind_inner() Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 19/50] microblaze: Add loglvl to microblaze_unwind() Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 20/50] microblaze: Add show_stack_loglvl() Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 21/50] mips: " Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 22/50] nds32: " Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 23/50] nios2: " Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 24/50] openrisc: " Dmitry Safonov
2020-04-18 20:19   ` [OpenRISC] " Dmitry Safonov
2020-04-19 20:57   ` Stafford Horne
2020-04-19 20:57     ` [OpenRISC] " Stafford Horne
2020-04-20 17:06     ` Dmitry Safonov
2020-04-20 17:06       ` [OpenRISC] " Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 25/50] parisc: " Dmitry Safonov
2020-04-18 20:54   ` Helge Deller
2020-04-18 20:19 ` [PATCHv3 26/50] powerpc: " Dmitry Safonov
2020-04-18 20:19   ` Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 27/50] riscv: " Dmitry Safonov
2020-04-18 20:19   ` Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 28/50] s390: " Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 29/50] sh: Add loglvl to dump_mem() Dmitry Safonov
2020-04-18 20:19   ` Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 30/50] sh: Remove needless printk() Dmitry Safonov
2020-04-18 20:19   ` Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 31/50] sh: Add loglvl to printk_address() Dmitry Safonov
2020-04-18 20:19   ` Dmitry Safonov
2020-04-20 22:52   ` Andrew Morton
2020-04-20 22:52     ` Andrew Morton
2020-04-25 16:06     ` Rob Landley
2020-04-25 16:06       ` Rob Landley
2020-04-25 16:22       ` Rich Felker
2020-04-25 16:22         ` Rich Felker
2020-04-18 20:19 ` [PATCHv3 32/50] sh: Add loglvl to show_trace() Dmitry Safonov
2020-04-18 20:19   ` Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 33/50] sh: Add show_stack_loglvl() Dmitry Safonov
2020-04-18 20:19   ` Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 34/50] sparc: " Dmitry Safonov
2020-04-18 20:19   ` Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 35/50] um/sysrq: Remove needless variable sp Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 36/50] um: Add show_stack_loglvl() Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 37/50] unicore32: Remove unused pmode argument in c_backtrace() Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 38/50] unicore32: Add loglvl to c_backtrace() Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 39/50] unicore32: Add show_stack_loglvl() Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 40/50] x86: Add missing const qualifiers for log_lvl Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 41/50] x86: Add show_stack_loglvl() Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 42/50] xtensa: Add loglvl to show_trace() Dmitry Safonov
2020-05-11 19:45   ` Mike Rapoport
2020-05-11 21:12     ` Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 43/50] xtensa: Add show_stack_loglvl() Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 44/50] sysrq: Use show_stack_loglvl() Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 45/50] x86/amd_gart: Print stacktrace for a leak with KERN_ERR Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 46/50] power: Use show_stack_loglvl() Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 47/50] kdb: Don't play with console_loglevel Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 48/50] sched: Print stack trace with KERN_INFO Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 49/50] kernel: Use show_stack_loglvl() Dmitry Safonov
2020-04-18 20:19 ` [PATCHv3 50/50] kernel: Rename show_stack_loglvl() => show_stack() Dmitry Safonov
2020-04-23 15:48 ` [PATCHv3 00/50] Add log level to show_stack() Tetsuo Handa
2020-04-23 16:10   ` Dmitry Safonov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.