kernel: sys : print task info on reboot or poweroff
authorzhaoxp3 <zhaoxp3@motorola.com>
Thu, 2 Aug 2018 06:56:11 +0000 (14:56 +0800)
committerxiest1 <xiest1@lenovo.com>
Tue, 5 Nov 2019 09:30:13 +0000 (17:30 +0800)
Pick up (CR). The current task name(pid),
and its parent task name(pid) are printed out to console
on reboot or power off. This patch is to indicate
which task has triggered the reboot or power off.

Change-Id: Ie99616432cd5a589fa3c1147094cb5d637d63ce7
Signed-off-by: zhaoxp3 <zhaoxp3@motorola.com>
Reviewed-on: https://gerrit.mot.com/1220330
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Submit-Approved: Jira Key

kernel/reboot.c

index f56409a3e1b53895fec1f8065e43802f451b5622..b46b5fb14bc18678bbd6a928113a2f343910a017 100644 (file)
@@ -220,6 +220,10 @@ void kernel_restart(char *cmd)
                pr_emerg("Restarting system\n");
        else
                pr_emerg("Restarting system with command '%s'\n", cmd);
+       printk(KERN_EMERG "Current task:%s(%d) Parent task:%s(%d)\n",
+               current->comm, current->pid,
+               current->real_parent->comm,
+               current->real_parent->pid);
        kmsg_dump(KMSG_DUMP_RESTART);
        machine_restart(cmd);
 }
@@ -262,6 +266,10 @@ void kernel_power_off(void)
        migrate_to_reboot_cpu();
        syscore_shutdown();
        pr_emerg("Power down\n");
+       printk(KERN_EMERG "Current task:%s(%d) Parent task:%s(%d)\n",
+               current->comm, current->pid,
+               current->real_parent->comm,
+               current->real_parent->pid);
        kmsg_dump(KMSG_DUMP_POWEROFF);
        machine_power_off();
 }