]> xenbits.xensource.com Git - people/aperard/linux-chromebook.git/commitdiff
CHROMIUM: sysrq-x: killall chrome process not just first one
authorMandeep Singh Baines <msb@chromium.org>
Tue, 5 Feb 2013 22:55:38 +0000 (14:55 -0800)
committerChromeBot <chrome-bot@google.com>
Wed, 6 Feb 2013 00:08:31 +0000 (16:08 -0800)
Currently, sysrq-x just kills the first chrome process it finds.
We've seen in at least one occassion where there may be a stale
chrome process from a previous session. The fix is to kill all
processes we find that meet our criteria.

I also modified the printk to print the pid of the process
that is killed. Previously we were printing the pid of
session_manager which is not as useful.

BUG=chrome-os-partner:17522
TEST=manual (debugging feature):
 hold down alt-volup then x - chrome should crash
 repeat immediately afterward - session should restart
 repeat and machine should reboot

2013-02-05T13:28:37.425355-08:00 localhost crash_reporter[2829]: Received crash notification for chrome[963] sig 6 (ignoring - chrome crash)
2013-02-05T13:28:37.557482-08:00 localhost session_manager: [0205/132837:INFO:session_manager_service.cc(523)] Handling child process exit: 963
2013-02-05T13:28:37.557537-08:00 localhost session_manager: [0205/132837:INFO:session_manager_service.cc(525)]   Exited with signal 6

Change-Id: Id039df7386cf7cccf42e0861bc2ab6f653147605
Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42658
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Reviewed-by: Sameer Nanda <snanda@chromium.org>
drivers/tty/sysrq.c

index 460998928668b094059b586f6563058f9ad3a3f7..357a02d4545f30f972a183fd07f5e40d51e9bc4d 100644 (file)
@@ -407,33 +407,18 @@ static void sysrq_x_cros_signal_process(char *comm, char *parent, int sig)
 
        read_lock(&tasklist_lock);
        for_each_process(p) {
-               if (p->flags & PF_KTHREAD)
+               if (p->flags & (PF_KTHREAD | PF_EXITING))
                        continue;
                if (is_global_init(p))
                        continue;
+               if (strncmp(p->comm, comm, TASK_COMM_LEN))
+                       continue;
+               if (parent && strncmp(p->parent->comm, parent, TASK_COMM_LEN))
+                       continue;
 
-               if (!strncmp(p->comm, comm, TASK_COMM_LEN)) {
-                       if (!parent) {
-                               printk(KERN_INFO
-                                      "%s: signal %d %s pid %u tgid %u\n",
-                                      __func__, sig, comm, p->pid, p->tgid);
-                               do_send_sig_info(sig, SEND_SIG_FORCED, p,
-                                                true);
-                               break;
-                       } else if (p->parent &&
-                                  !strncmp(p->parent->comm, parent,
-                                         TASK_COMM_LEN)) {
-                               printk(KERN_INFO
-                                      "%s: signal %d %s with parent %s "
-                                      "pid %u tgid %u\n",
-                                      __func__, sig,
-                                      comm, parent, p->parent->pid,
-                                      p->parent->tgid);
-                               do_send_sig_info(sig, SEND_SIG_FORCED, p,
-                                                true);
-                               break;
-                       }
-               }
+               printk(KERN_INFO "%s: signal %d %s pid %u tgid %u\n",
+                      __func__, sig, comm, p->pid, p->tgid);
+               do_send_sig_info(sig, SEND_SIG_FORCED, p, true);
        }
        read_unlock(&tasklist_lock);
 }