Merge tag 'v3.10.71' into update
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / kernel / debug / kdb / kdb_main.c
index 00eb8f7fbf41c49e1deb4b09e6858858064ae9e9..51bcfb5e867a7a3f1a7da7b100e9e8fb966b6be0 100644 (file)
@@ -1110,6 +1110,11 @@ void kdb_set_current_task(struct task_struct *p)
        kdb_current_regs = NULL;
 }
 
+/* Check timeout and force kernel panic if no user input for KE_TIMEOUT_SEC */
+int check_timeout;
+int force_panic;
+unsigned long long enter_time;
+
 /*
  * kdb_local - The main code for kdb.  This routine is invoked on a
  *     specific processor, it is not global.  The main kdb() routine
@@ -1137,6 +1142,12 @@ static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs,
        struct task_struct *kdb_current =
                kdb_curr_task(raw_smp_processor_id());
 
+       check_timeout = 1;
+       force_panic = 0;
+       enter_time = sched_clock();
+
+       get_cpu_var(kdb_in_use) = 1;
+       put_cpu_var(kdb_in_use);
        KDB_DEBUG_STATE("kdb_local 1", reason);
        kdb_go_count = 0;
        if (reason == KDB_REASON_DEBUG) {
@@ -1295,6 +1306,9 @@ do_full_getstr:
                        kdb_cmderror(diag);
        }
        KDB_DEBUG_STATE("kdb_local 9", diag);
+       get_cpu_var(kdb_in_use) = 0;
+       put_cpu_var(kdb_in_use);
+       
        return diag;
 }
 
@@ -2532,7 +2546,7 @@ static int kdb_summary(int argc, const char **argv)
 #define K(x) ((x) << (PAGE_SHIFT - 10))
        kdb_printf("\nMemTotal:       %8lu kB\nMemFree:        %8lu kB\n"
                   "Buffers:        %8lu kB\n",
-                  val.totalram, val.freeram, val.bufferram);
+                  K(val.totalram), K(val.freeram), K(val.bufferram));
        return 0;
 }
 
@@ -2853,6 +2867,10 @@ static void __init kdb_cmd_init(void)
        }
 }
 
+#ifdef CONFIG_MTK_EXTMEM
+extern void init_debug_alloc_pool_aligned(void);
+#endif
+
 /* Initialize kdb_printf, breakpoint tables and kdb state */
 void __init kdb_init(int lvl)
 {
@@ -2861,6 +2879,11 @@ void __init kdb_init(int lvl)
 
        if (kdb_init_lvl == KDB_INIT_FULL || lvl <= kdb_init_lvl)
                return;
+
+#ifdef CONFIG_MTK_EXTMEM
+       init_debug_alloc_pool_aligned();
+#endif
+
        for (i = kdb_init_lvl; i < lvl; i++) {
                switch (i) {
                case KDB_NOT_INITIALIZED: