aboutsummaryrefslogtreecommitdiff
path: root/arch/nds32/kernel/traps.c
AgeCommit message (Collapse)AuthorFilesLines
2020-06-09kernel: rename show_stack_loglvl() => show_stack()Dmitry Safonov1-7/+1
Now the last users of show_stack() got converted to use an explicit log level, show_stack_loglvl() can drop it's redundant suffix and become once again well known show_stack(). Signed-off-by: Dmitry Safonov <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
2020-06-09nds32: add show_stack_loglvl()Dmitry Safonov1-7/+14
Currently, the log-level of show_stack() depends on a platform realization. It creates situations where the headers are printed with lower log level or higher than the stacktrace (depending on a platform or user). Furthermore, it forces the logic decision from user to an architecture side. In result, some users as sysrq/kdb/etc are doing tricks with temporary rising console_loglevel while printing their messages. And in result it not only may print unwanted messages from other CPUs, but also omit printing at all in the unlucky case where the printk() was deferred. Introducing log-level parameter and KERN_UNSUPPRESSED [1] seems an easier approach than introducing more printk buffers. Also, it will consolidate printings with headers. Introduce show_stack_loglvl(), that eventually will substitute show_stack(). [1]: https://lore.kernel.org/lkml/[email protected]/T/#u Signed-off-by: Dmitry Safonov <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Cc: Greentime Hu <[email protected]> Cc: Vincent Chen <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
2020-06-09kallsyms/printk: add loglvl to print_ip_sym()Dmitry Safonov1-2/+2
Patch series "Add log level to show_stack()", v3. 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: - It's a design mistake to move a business-logic decision into platform realization detail. - 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). - 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). - 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/[email protected]/ This patch (of 50): print_ip_sym() needs to have a log level parameter to comply with other parts being printed. Otherwise, half of the expected backtrace would be printed and other may be missing with some logging level. The following callee(s) are using now the adjusted log level: - microblaze/unwind: the same level as headers & userspace unwind. Note that pr_debug()'s there are for debugging the unwinder itself. - nds32/traps: symbol addresses are printed with the same log level as backtrace headers. - lockdep: ip for locking issues is printed with the same log level as other part of the warning. - sched: ip where preemption was disabled is printed as error like the rest part of the message. - ftrace: bug reports are now consistent in the log level being used. Signed-off-by: Dmitry Safonov <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Acked-by: Steven Rostedt (VMware) <[email protected]> Cc: Albert Ou <[email protected]> Cc: Ben Segall <[email protected]> Cc: Dietmar Eggemann <[email protected]> Cc: Greentime Hu <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Hogan <[email protected]> Cc: Juri Lelli <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Michal Simek <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Paul Burton <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Ralf Baechle <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vincent Chen <[email protected]> Cc: Vincent Guittot <[email protected]> Cc: Will Deacon <[email protected]> Cc: Dmitry Safonov <[email protected]> Cc: Dmitry Safonov <[email protected]> Cc: Jiri Slaby <[email protected]> Cc: Petr Mladek <[email protected]> Cc: Sergey Senozhatsky <[email protected]> Cc: Ivan Kokshaysky <[email protected]> Cc: Matt Turner <[email protected]> Cc: Richard Henderson <[email protected]> Cc: Vineet Gupta <[email protected]> Cc: Russell King <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Aurelien Jacquiot <[email protected]> Cc: Mark Salter <[email protected]> Cc: Guo Ren <[email protected]> Cc: Yoshinori Sato <[email protected]> Cc: Brian Cain <[email protected]> Cc: Fenghua Yu <[email protected]> Cc: Tony Luck <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Ley Foon Tan <[email protected]> Cc: Jonas Bonn <[email protected]> Cc: Stafford Horne <[email protected]> Cc: Stefan Kristiansson <[email protected]> Cc: Helge Deller <[email protected]> Cc: "James E.J. Bottomley" <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Vasily Gorbik <[email protected]> Cc: Rich Felker <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Anton Ivanov <[email protected]> Cc: Jeff Dike <[email protected]> Cc: Richard Weinberger <[email protected]> Cc: Guan Xuetao <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Chris Zankel <[email protected]> Cc: Max Filippov <[email protected]> Cc: Len Brown <[email protected]> Cc: Pavel Machek <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Cc: Daniel Thompson <[email protected]> Cc: Douglas Anderson <[email protected]> Cc: Jason Wessel <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
2019-05-29signal: Remove the task parameter from force_sig_faultEric W. Biederman1-2/+2
As synchronous exceptions really only make sense against the current task (otherwise how are you synchronous) remove the task parameter from from force_sig_fault to make it explicit that is what is going on. The two known exceptions that deliver a synchronous exception to a stopped ptraced task have already been changed to force_sig_fault_to_task. The callers have been changed with the following emacs regular expression (with obvious variations on the architectures that take more arguments) to avoid typos: force_sig_fault[(]\([^,]+\)[,]\([^,]+\)[,]\([^,]+\)[,]\W+current[)] -> force_sig_fault(\1,\2,\3) Signed-off-by: "Eric W. Biederman" <[email protected]>
2019-05-29signal: Explicitly call force_sig_fault on currentEric W. Biederman1-1/+1
Update the calls of force_sig_fault that pass in a variable that is set to current earlier to explicitly use current. This is to make the next change that removes the task parameter from force_sig_fault easier to verify. Signed-off-by: "Eric W. Biederman" <[email protected]>
2019-05-29signal/nds32: Remove tsk parameter from send_sigtrapEric W. Biederman1-3/+4
The send_sigtrap function is always called with tsk == current. Make that obvious by removing the tsk parameter. This also makes it clear that send_sigtrap always calls force_sig_fault on the current task. Signed-off-by: "Eric W. Biederman" <[email protected]>
2019-05-27signal: Remove task parameter from force_sigEric W. Biederman1-3/+3
All of the remaining callers pass current into force_sig so remove the task parameter to make this obvious and to make misuse more difficult in the future. This also makes it clear force_sig passes current into force_sig_info. Signed-off-by: "Eric W. Biederman" <[email protected]>
2018-11-22nds32: nds32 FPU portVincent Chen1-0/+16
This patch set contains basic components for supporting the nds32 FPU, such as exception handlers and context switch for FPU registers. By default, the lazy FPU scheme is supported and the user can configure it via CONFIG_LZAY_FPU. Signed-off-by: Vincent Chen <[email protected]> Acked-by: Greentime Hu <[email protected]> Signed-off-by: Greentime Hu <[email protected]>
2018-09-04nds32: Only print one page of stack when die to prevent printing too much ↵Greentime Hu1-3/+2
information. It may print too much information sometimes if the stack is wrong or too big. This patch can limit the debug information in a page of stack. Signed-off-by: Greentime Hu <[email protected]>
2018-09-04nds32: Add macro definition for offset of lp register on stackZong Li1-1/+1
Use macro to replace the magic number. Signed-off-by: Zong Li <[email protected]> Acked-by: Greentime Hu <[email protected]> Signed-off-by: Greentime Hu <[email protected]>
2018-09-04nds32: Remove the deprecated ABI implementationZong Li1-5/+0
We are not using NDS32 ABI 2 for now, just remove the preprocessor directives __NDS32_ABI_2. Signed-off-by: Zong Li <[email protected]> Acked-by: Greentime Hu <[email protected]> Signed-off-by: Greentime Hu <[email protected]>
2018-09-04nds32/stack: Get real return address by using ftrace_graph_ret_addrZong Li1-24/+6
Function graph tracer has modified the return address to 'return_to_handler' on stack, and provide the 'ftrace_graph_ret_addr' to get the real return address. Signed-off-by: Zong Li <[email protected]> Acked-by: Greentime Hu <[email protected]> Signed-off-by: Greentime Hu <[email protected]>
2018-09-04nds32: Fix empty call traceZong Li1-1/+1
The compiler predefined macro 'NDS32_ABI_2' had been removed, it should use the '__NDS32_ABI_2' here. Signed-off-by: Zong Li <[email protected]> Acked-by: Greentime Hu <[email protected]> Signed-off-by: Greentime Hu <[email protected]>
2018-04-25signal/nds32: Use force_sig_fault where appropriateEric W. Biederman1-16/+4
Filling in struct siginfo before calling force_sig_info a tedious and error prone process, where once in a great while the wrong fields are filled out, and siginfo has been inconsistently cleared. Simplify this process by using the helper force_sig_fault. Which takes as a parameters all of the information it needs, ensures all of the fiddly bits of filling in struct siginfo are done properly and then calls force_sig_info. In short about a 5 line reduction in code for every time force_sig_info is called, which makes the calling function clearer. Cc: Greentime Hu <[email protected]> Cc: Vincent Chen <[email protected]> Acked-by: Vincent Chen <[email protected]> Signed-off-by: "Eric W. Biederman" <[email protected]>
2018-04-25signal: Ensure every siginfo we send has all bits initializedEric W. Biederman1-1/+2
Call clear_siginfo to ensure every stack allocated siginfo is properly initialized before being passed to the signal sending functions. Note: It is not safe to depend on C initializers to initialize struct siginfo on the stack because C is allowed to skip holes when initializing a structure. The initialization of struct siginfo in tracehook_report_syscall_exit was moved from the helper user_single_step_siginfo into tracehook_report_syscall_exit itself, to make it clear that the local variable siginfo gets fully initialized. In a few cases the scope of struct siginfo has been reduced to make it clear that siginfo siginfo is not used on other paths in the function in which it is declared. Instances of using memset to initialize siginfo have been replaced with calls clear_siginfo for clarity. Signed-off-by: "Eric W. Biederman" <[email protected]>
2018-04-25signal/nds32: Use force_sig(SIGILL) in do_revisnEric W. Biederman1-4/+1
As originally committed do_revisn would deliver a siginfo for SIGILL with an si_code composed of random stack contents. That makes no sense and is not something userspace can depend on. So simplify the code and just use "force_sig(SIG_ILL, current)" instead. Fixes: 2923f5ea7738 ("nds32: Exception handling") Cc: Vincent Chen <[email protected]> Cc: Greentime Hu <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: "Eric W. Biederman" <[email protected]>
2018-04-25signal/nds32: Use force_sig in unhandled_interruption and unhandled_exceptionsEric W. Biederman1-9/+2
Neither unhandled_interrupt nor unhandled_exceptions fills in any of the siginfo fields whend sending SIGKILL. Further because it is SIGKILL even if all of the fields were filled out appropriately it would be impossible for the process to read any of the siginfo fields. So simplfy things and just use force_sig instead of force_sig_info. Fixes: 2923f5ea7738 ("nds32: Exception handling") Cc: Vincent Chen <[email protected]> Cc: Greentime Hu <[email protected]> Cc: Arnd Bergmann <[email protected]> Acked-by: Vincent Chen <[email protected]> Signed-off-by: "Eric W. Biederman" <[email protected]>
2018-03-16nds32: To use the generic dump_stack()Greentime Hu1-12/+0
Use the generic dump_stack() instead of nds32 one because they are doing the same thing. Signed-off-by: Greentime Hu <[email protected]> Acked-by: Arnd Bergmann <[email protected]>
2018-02-22nds32: Exception handlingGreentime Hu1-0/+442
This patch includes the exception/interrupt entries, pt_reg structure and related accessors. /* Unaligned accessing handling*/ Andes processors cannot load/store information which is not naturally aligned on the bus, i.e., loading a 4 byte data whose start address must be divisible by 4. If unaligned data accessing is happened, data unaligned exception will be triggered and user will get SIGSEGV or kernel oops according to the unaligned address. In order to make user be able to load/store data from an unaligned address, software load/store emulation is implemented in arch/nds32/mm/alignment.c to address data unaligned exception. Unaligned accessing handling is disabled by default because it is not a normal case. User can enable this feature by following steps. A. Compile time: 1. Enable kernel config CONFIG_ALIGNMENT_TRAP B. Run time: 1. Enter /proc/sys/nds32/unaligned_acess folder 2. Write 1 to file enable_mode to enable unaligned accessing handling. User can disable it by writing 0 to this file. 3. Write 1 to file debug to show which unaligned address is under processing. User can disable it by writing 0 to this file. However, unaligned accessing handler cannot work if this unaligned address is not accessible such as protection violation. On this condition, the default behaviors for addressing data unaligned exception still happen Signed-off-by: Vincent Chen <[email protected]> Signed-off-by: Greentime Hu <[email protected]> Acked-by: Arnd Bergmann <[email protected]>