Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
c985aafb
Commit
c985aafb
authored
Aug 30, 2021
by
Petr Mladek
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'rework/printk_safe-removal' into for-linus
parents
715d3edb
26d1982f
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
192 additions
and
544 deletions
+192
-544
arch/arm/kernel/smp.c
arch/arm/kernel/smp.c
+2
-2
arch/powerpc/kernel/traps.c
arch/powerpc/kernel/traps.c
+0
-1
arch/powerpc/kernel/watchdog.c
arch/powerpc/kernel/watchdog.c
+0
-5
arch/powerpc/kexec/crash.c
arch/powerpc/kexec/crash.c
+1
-1
include/linux/hardirq.h
include/linux/hardirq.h
+0
-2
include/linux/printk.h
include/linux/printk.h
+19
-22
init/Kconfig
init/Kconfig
+0
-5
kernel/kexec_core.c
kernel/kexec_core.c
+0
-1
kernel/panic.c
kernel/panic.c
+0
-3
kernel/printk/internal.h
kernel/printk/internal.h
+0
-25
kernel/printk/printk.c
kernel/printk/printk.c
+162
-106
kernel/printk/printk_safe.c
kernel/printk/printk_safe.c
+1
-363
kernel/trace/trace.c
kernel/trace/trace.c
+0
-2
lib/nmi_backtrace.c
lib/nmi_backtrace.c
+7
-6
No files found.
arch/arm/kernel/smp.c
View file @
c985aafb
...
...
@@ -667,9 +667,9 @@ static void do_handle_IPI(int ipinr)
break
;
case
IPI_CPU_BACKTRACE
:
printk_
nmi
_enter
();
printk_
deferred
_enter
();
nmi_cpu_backtrace
(
get_irq_regs
());
printk_
nmi
_exit
();
printk_
deferred
_exit
();
break
;
default:
...
...
arch/powerpc/kernel/traps.c
View file @
c985aafb
...
...
@@ -171,7 +171,6 @@ extern void panic_flush_kmsg_start(void)
extern
void
panic_flush_kmsg_end
(
void
)
{
printk_safe_flush_on_panic
();
kmsg_dump
(
KMSG_DUMP_PANIC
);
bust_spinlocks
(
0
);
debug_locks_off
();
...
...
arch/powerpc/kernel/watchdog.c
View file @
c985aafb
...
...
@@ -184,11 +184,6 @@ static void watchdog_smp_panic(int cpu, u64 tb)
wd_smp_unlock
(
&
flags
);
printk_safe_flush
();
/*
* printk_safe_flush() seems to require another print
* before anything actually goes out to console.
*/
if
(
sysctl_hardlockup_all_cpu_backtrace
)
trigger_allbutself_cpu_backtrace
();
...
...
arch/powerpc/kexec/crash.c
View file @
c985aafb
...
...
@@ -313,7 +313,7 @@ void default_machine_crash_shutdown(struct pt_regs *regs)
int
(
*
old_handler
)(
struct
pt_regs
*
regs
);
/* Avoid hardlocking with irresponsive CPU holding logbuf_lock */
printk_
nmi
_enter
();
printk_
deferred
_enter
();
/*
* This function is only called after the system
...
...
include/linux/hardirq.h
View file @
c985aafb
...
...
@@ -116,7 +116,6 @@ extern void rcu_nmi_exit(void);
do { \
lockdep_off(); \
arch_nmi_enter(); \
printk_nmi_enter(); \
BUG_ON(in_nmi() == NMI_MASK); \
__preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \
} while (0)
...
...
@@ -135,7 +134,6 @@ extern void rcu_nmi_exit(void);
do { \
BUG_ON(!in_nmi()); \
__preempt_count_sub(NMI_OFFSET + HARDIRQ_OFFSET); \
printk_nmi_exit(); \
arch_nmi_exit(); \
lockdep_on(); \
} while (0)
...
...
include/linux/printk.h
View file @
c985aafb
...
...
@@ -141,18 +141,6 @@ static inline __printf(1, 2) __cold
void
early_printk
(
const
char
*
s
,
...)
{
}
#endif
#ifdef CONFIG_PRINTK_NMI
extern
void
printk_nmi_enter
(
void
);
extern
void
printk_nmi_exit
(
void
);
extern
void
printk_nmi_direct_enter
(
void
);
extern
void
printk_nmi_direct_exit
(
void
);
#else
static
inline
void
printk_nmi_enter
(
void
)
{
}
static
inline
void
printk_nmi_exit
(
void
)
{
}
static
inline
void
printk_nmi_direct_enter
(
void
)
{
}
static
inline
void
printk_nmi_direct_exit
(
void
)
{
}
#endif
/* PRINTK_NMI */
struct
dev_printk_info
;
#ifdef CONFIG_PRINTK
...
...
@@ -172,6 +160,16 @@ int _printk(const char *fmt, ...);
*/
__printf
(
1
,
2
)
__cold
int
_printk_deferred
(
const
char
*
fmt
,
...);
extern
void
__printk_safe_enter
(
void
);
extern
void
__printk_safe_exit
(
void
);
/*
* The printk_deferred_enter/exit macros are available only as a hack for
* some code paths that need to defer all printk console printing. Interrupts
* must be disabled for the deferred duration.
*/
#define printk_deferred_enter __printk_safe_enter
#define printk_deferred_exit __printk_safe_exit
/*
* Please don't use printk_ratelimit(), because it shares ratelimiting state
* with all other unrelated printk_ratelimit() callsites. Instead use
...
...
@@ -200,8 +198,6 @@ void dump_stack_print_info(const char *log_lvl);
void
show_regs_print_info
(
const
char
*
log_lvl
);
extern
asmlinkage
void
dump_stack_lvl
(
const
char
*
log_lvl
)
__cold
;
extern
asmlinkage
void
dump_stack
(
void
)
__cold
;
extern
void
printk_safe_flush
(
void
);
extern
void
printk_safe_flush_on_panic
(
void
);
#else
static
inline
__printf
(
1
,
0
)
int
vprintk
(
const
char
*
s
,
va_list
args
)
...
...
@@ -218,6 +214,15 @@ int _printk_deferred(const char *s, ...)
{
return
0
;
}
static
inline
void
printk_deferred_enter
(
void
)
{
}
static
inline
void
printk_deferred_exit
(
void
)
{
}
static
inline
int
printk_ratelimit
(
void
)
{
return
0
;
...
...
@@ -269,14 +274,6 @@ static inline void dump_stack_lvl(const char *log_lvl)
static
inline
void
dump_stack
(
void
)
{
}
static
inline
void
printk_safe_flush
(
void
)
{
}
static
inline
void
printk_safe_flush_on_panic
(
void
)
{
}
#endif
#ifdef CONFIG_SMP
...
...
init/Kconfig
View file @
c985aafb
...
...
@@ -1523,11 +1523,6 @@ config PRINTK
very difficult to diagnose system problems, saying N here is
strongly discouraged.
config PRINTK_NMI
def_bool y
depends on PRINTK
depends on HAVE_NMI
config BUG
bool "BUG() support" if EXPERT
default y
...
...
kernel/kexec_core.c
View file @
c985aafb
...
...
@@ -979,7 +979,6 @@ void crash_kexec(struct pt_regs *regs)
old_cpu
=
atomic_cmpxchg
(
&
panic_cpu
,
PANIC_CPU_INVALID
,
this_cpu
);
if
(
old_cpu
==
PANIC_CPU_INVALID
)
{
/* This is the 1st CPU which comes here, so go ahead. */
printk_safe_flush_on_panic
();
__crash_kexec
(
regs
);
/*
...
...
kernel/panic.c
View file @
c985aafb
...
...
@@ -248,7 +248,6 @@ void panic(const char *fmt, ...)
* Bypass the panic_cpu check and call __crash_kexec directly.
*/
if
(
!
_crash_kexec_post_notifiers
)
{
printk_safe_flush_on_panic
();
__crash_kexec
(
NULL
);
/*
...
...
@@ -272,8 +271,6 @@ void panic(const char *fmt, ...)
*/
atomic_notifier_call_chain
(
&
panic_notifier_list
,
0
,
buf
);
/* Call flush even twice. It tries harder with a single online CPU */
printk_safe_flush_on_panic
();
kmsg_dump
(
KMSG_DUMP_PANIC
);
/*
...
...
kernel/printk/internal.h
View file @
c985aafb
...
...
@@ -6,12 +6,6 @@
#ifdef CONFIG_PRINTK
#define PRINTK_SAFE_CONTEXT_MASK 0x007ffffff
#define PRINTK_NMI_DIRECT_CONTEXT_MASK 0x008000000
#define PRINTK_NMI_CONTEXT_MASK 0xff0000000
#define PRINTK_NMI_CONTEXT_OFFSET 0x010000000
/* Flags for a single printk record. */
enum
printk_info_flags
{
LOG_NEWLINE
=
2
,
/* text ended with a newline */
...
...
@@ -25,10 +19,7 @@ int vprintk_store(int facility, int level,
__printf
(
1
,
0
)
int
vprintk_default
(
const
char
*
fmt
,
va_list
args
);
__printf
(
1
,
0
)
int
vprintk_deferred
(
const
char
*
fmt
,
va_list
args
);
void
__printk_safe_enter
(
void
);
void
__printk_safe_exit
(
void
);
void
printk_safe_init
(
void
);
bool
printk_percpu_data_ready
(
void
);
#define printk_safe_enter_irqsave(flags) \
...
...
@@ -43,18 +34,6 @@ bool printk_percpu_data_ready(void);
local_irq_restore(flags); \
} while (0)
#define printk_safe_enter_irq() \
do { \
local_irq_disable(); \
__printk_safe_enter(); \
} while (0)
#define printk_safe_exit_irq() \
do { \
__printk_safe_exit(); \
local_irq_enable(); \
} while (0)
void
defer_console_output
(
void
);
u16
printk_parse_prefix
(
const
char
*
text
,
int
*
level
,
...
...
@@ -69,9 +48,5 @@ u16 printk_parse_prefix(const char *text, int *level,
#define printk_safe_enter_irqsave(flags) local_irq_save(flags)
#define printk_safe_exit_irqrestore(flags) local_irq_restore(flags)
#define printk_safe_enter_irq() local_irq_disable()
#define printk_safe_exit_irq() local_irq_enable()
static
inline
void
printk_safe_init
(
void
)
{
}
static
inline
bool
printk_percpu_data_ready
(
void
)
{
return
false
;
}
#endif
/* CONFIG_PRINTK */
kernel/printk/printk.c
View file @
c985aafb
This diff is collapsed.
Click to expand it.
kernel/printk/printk_safe.c
View file @
c985aafb
This diff is collapsed.
Click to expand it.
kernel/trace/trace.c
View file @
c985aafb
...
...
@@ -9797,7 +9797,6 @@ void ftrace_dump(enum ftrace_dump_mode oops_dump_mode)
tracing_off
();
local_irq_save
(
flags
);
printk_nmi_direct_enter
();
/* Simulate the iterator */
trace_init_global_iter
(
&
iter
);
...
...
@@ -9879,7 +9878,6 @@ void ftrace_dump(enum ftrace_dump_mode oops_dump_mode)
atomic_dec
(
&
per_cpu_ptr
(
iter
.
array_buffer
->
data
,
cpu
)
->
disabled
);
}
atomic_dec
(
&
dump_running
);
printk_nmi_direct_exit
();
local_irq_restore
(
flags
);
}
EXPORT_SYMBOL_GPL
(
ftrace_dump
);
...
...
lib/nmi_backtrace.c
View file @
c985aafb
...
...
@@ -75,12 +75,6 @@ void nmi_trigger_cpumask_backtrace(const cpumask_t *mask,
touch_softlockup_watchdog
();
}
/*
* Force flush any remote buffers that might be stuck in IRQ context
* and therefore could not run their irq_work.
*/
printk_safe_flush
();
clear_bit_unlock
(
0
,
&
backtrace_flag
);
put_cpu
();
}
...
...
@@ -92,8 +86,14 @@ module_param(backtrace_idle, bool, 0644);
bool
nmi_cpu_backtrace
(
struct
pt_regs
*
regs
)
{
int
cpu
=
smp_processor_id
();
unsigned
long
flags
;
if
(
cpumask_test_cpu
(
cpu
,
to_cpumask
(
backtrace_mask
)))
{
/*
* Allow nested NMI backtraces while serializing
* against other CPUs.
*/
printk_cpu_lock_irqsave
(
flags
);
if
(
!
READ_ONCE
(
backtrace_idle
)
&&
regs
&&
cpu_in_idle
(
instruction_pointer
(
regs
)))
{
pr_warn
(
"NMI backtrace for cpu %d skipped: idling at %pS
\n
"
,
cpu
,
(
void
*
)
instruction_pointer
(
regs
));
...
...
@@ -104,6 +104,7 @@ bool nmi_cpu_backtrace(struct pt_regs *regs)
else
dump_stack
();
}
printk_cpu_unlock_irqrestore
(
flags
);
cpumask_clear_cpu
(
cpu
,
to_cpumask
(
backtrace_mask
));
return
true
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment