]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - kernel/hung_task.c
tracing/kprobes: Enforce kprobes teardown after testing
[mirror_ubuntu-artful-kernel.git] / kernel / hung_task.c
index 40c07e4fa116e064668bc6f36e438d67a4905326..751593ed7c0b0b9cc9bf74735fb9bd5d7e100be2 100644 (file)
@@ -16,6 +16,9 @@
 #include <linux/export.h>
 #include <linux/sysctl.h>
 #include <linux/utsname.h>
+#include <linux/sched/signal.h>
+#include <linux/sched/debug.h>
+
 #include <trace/events/sched.h>
 
 /*
@@ -40,6 +43,7 @@ unsigned long __read_mostly sysctl_hung_task_timeout_secs = CONFIG_DEFAULT_HUNG_
 int __read_mostly sysctl_hung_task_warnings = 10;
 
 static int __read_mostly did_panic;
+static bool hung_task_show_lock;
 
 static struct task_struct *watchdog_task;
 
@@ -117,12 +121,14 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
                pr_err("\"echo 0 > /proc/sys/kernel/hung_task_timeout_secs\""
                        " disables this message.\n");
                sched_show_task(t);
-               debug_show_all_locks();
+               hung_task_show_lock = true;
        }
 
        touch_nmi_watchdog();
 
        if (sysctl_hung_task_panic) {
+               if (hung_task_show_lock)
+                       debug_show_all_locks();
                trigger_all_cpu_backtrace();
                panic("hung_task: blocked tasks");
        }
@@ -169,6 +175,7 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout)
        if (test_taint(TAINT_DIE) || did_panic)
                return;
 
+       hung_task_show_lock = false;
        rcu_read_lock();
        for_each_process_thread(g, t) {
                if (!max_count--)
@@ -184,6 +191,8 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout)
        }
  unlock:
        rcu_read_unlock();
+       if (hung_task_show_lock)
+               debug_show_all_locks();
 }
 
 static long hung_timeout_jiffies(unsigned long last_checked,