summaryrefslogtreecommitdiff
path: root/drivers/tty/sprdrq.c
blob: b07da2a30c13e150384fa2d02795e60d318c8982 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * Copyright (C) 2012 Spreadtrum Communications Inc.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <linux/sched.h>
#include <linux/sysrq.h>
#include <linux/nmi.h>

void show_state_group(unsigned long state_filter)
{
	struct task_struct *p, *g;

	rcu_read_lock();
	do_each_thread(g, p) {
		touch_nmi_watchdog();
		if (p->state & state_filter){
			printk(KERN_INFO "\nGroup: %s - %d\n", g->comm, g->pid);
			/* dump all threads stack in same group */
			p = g;
			do{
				sched_show_task(p);
			}while_each_thread(g, p);
			break;
		}
	} while_each_thread(g, p);
	rcu_read_unlock();
}

static void sysrq_handle_show_blocked_group(int key)
{
	show_state_group(TASK_UNINTERRUPTIBLE);
}

struct sysrq_key_op sysrq_show_blocked_group_op = {
	.handler	= sysrq_handle_show_blocked_group,
	.help_msg	= "show-blocked-group(x)",
	.action_msg	= "Show Blocked Group State",
	.enable_mask	= SYSRQ_ENABLE_DUMP,
};