Skip to content

Commit

Permalink
Merge branch 'rework/kthreads' into for-linus
Browse files Browse the repository at this point in the history
  • Loading branch information
pmladek committed Jun 23, 2022
2 parents 93d17c1 + 07a22b6 commit 51889d2
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 640 deletions.
2 changes: 0 additions & 2 deletions drivers/tty/sysrq.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,6 @@ void __handle_sysrq(int key, bool check_mask)

rcu_sysrq_start();
rcu_read_lock();
printk_prefer_direct_enter();
/*
* Raise the apparent loglevel to maximum so that the sysrq header
* is shown to provide the user with positive feedback. We do not
Expand Down Expand Up @@ -623,7 +622,6 @@ void __handle_sysrq(int key, bool check_mask)
pr_cont("\n");
console_loglevel = orig_log_level;
}
printk_prefer_direct_exit();
rcu_read_unlock();
rcu_sysrq_end();

Expand Down
17 changes: 0 additions & 17 deletions include/linux/console.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

#include <linux/atomic.h>
#include <linux/types.h>
#include <linux/mutex.h>

struct vc_data;
struct console_font_op;
Expand Down Expand Up @@ -154,22 +153,6 @@ struct console {
uint ospeed;
u64 seq;
unsigned long dropped;
struct task_struct *thread;
bool blocked;

/*
* The per-console lock is used by printing kthreads to synchronize
* this console with callers of console_lock(). This is necessary in
* order to allow printing kthreads to run in parallel to each other,
* while each safely accessing the @blocked field and synchronizing
* against direct printing via console_lock/console_unlock.
*
* Note: For synchronizing against direct printing via
* console_trylock/console_unlock, see the static global
* variable @console_kthreads_active.
*/
struct mutex lock;

void *data;
struct console *next;
};
Expand Down
16 changes: 0 additions & 16 deletions include/linux/printk.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,7 @@ extern void __printk_safe_exit(void);
#define printk_deferred_enter __printk_safe_enter
#define printk_deferred_exit __printk_safe_exit

extern void printk_prefer_direct_enter(void);
extern void printk_prefer_direct_exit(void);

extern bool pr_flush(int timeout_ms, bool reset_on_progress);
extern void try_block_console_kthreads(int timeout_ms);

/*
* Please don't use printk_ratelimit(), because it shares ratelimiting state
Expand Down Expand Up @@ -225,23 +221,11 @@ static inline void printk_deferred_exit(void)
{
}

static inline void printk_prefer_direct_enter(void)
{
}

static inline void printk_prefer_direct_exit(void)
{
}

static inline bool pr_flush(int timeout_ms, bool reset_on_progress)
{
return true;
}

static inline void try_block_console_kthreads(int timeout_ms)
{
}

static inline int printk_ratelimit(void)
{
return 0;
Expand Down
11 changes: 1 addition & 10 deletions kernel/hung_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
* complain:
*/
if (sysctl_hung_task_warnings) {
printk_prefer_direct_enter();

if (sysctl_hung_task_warnings > 0)
sysctl_hung_task_warnings--;
pr_err("INFO: task %s:%d blocked for more than %ld seconds.\n",
Expand All @@ -144,8 +142,6 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)

if (sysctl_hung_task_all_cpu_backtrace)
hung_task_show_all_bt = true;

printk_prefer_direct_exit();
}

touch_nmi_watchdog();
Expand Down Expand Up @@ -208,17 +204,12 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout)
}
unlock:
rcu_read_unlock();
if (hung_task_show_lock) {
printk_prefer_direct_enter();
if (hung_task_show_lock)
debug_show_all_locks();
printk_prefer_direct_exit();
}

if (hung_task_show_all_bt) {
hung_task_show_all_bt = false;
printk_prefer_direct_enter();
trigger_all_cpu_backtrace();
printk_prefer_direct_exit();
}

if (hung_task_call_panic)
Expand Down
6 changes: 0 additions & 6 deletions kernel/panic.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,15 +297,13 @@ void panic(const char *fmt, ...)
* unfortunately means it may not be hardened to work in a
* panic situation.
*/
try_block_console_kthreads(10000);
smp_send_stop();
} else {
/*
* If we want to do crash dump after notifier calls and
* kmsg_dump, we will need architecture dependent extra
* works in addition to stopping other CPUs.
*/
try_block_console_kthreads(10000);
crash_smp_send_stop();
}

Expand Down Expand Up @@ -605,8 +603,6 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
{
disable_trace_on_warning();

printk_prefer_direct_enter();

if (file)
pr_warn("WARNING: CPU: %d PID: %d at %s:%d %pS\n",
raw_smp_processor_id(), current->pid, file, line,
Expand Down Expand Up @@ -636,8 +632,6 @@ void __warn(const char *file, int line, void *caller, unsigned taint,

/* Just a warning, don't kill lockdep. */
add_taint(taint, LOCKDEP_STILL_OK);

printk_prefer_direct_exit();
}

#ifndef __WARN_FLAGS
Expand Down
2 changes: 0 additions & 2 deletions kernel/printk/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ enum printk_info_flags {
LOG_CONT = 8, /* text is a fragment of a continuation line */
};

extern bool block_console_kthreads;

__printf(4, 0)
int vprintk_store(int facility, int level,
const struct dev_printk_info *dev_info,
Expand Down
Loading

0 comments on commit 51889d2

Please sign in to comment.