diff options
author | Randy Dunlap <randy.dunlap@oracle.com> | 2007-02-01 02:48:17 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-01 19:22:42 -0500 |
commit | d346cce308f7fc99c7ffdb62060ed404fa340a1c (patch) | |
tree | e6d4f82ad87c3ee34ed91f79acb5f9c24a3f1e4b | |
parent | 7d8952440f4090522b740257f1c6b2cf96413969 (diff) |
[PATCH] sysrq: showBlockedTasks is sysrq-W
Change SysRq showBlockedTasks from sysrq-X to sysrq-W and show that in the
Help message.
It was previously done via X, but X is already used for Xmon on ppc & powerpc
platforms and this collision needs to be avoided.
All callers of register_sysrq_key() are now marked in the sysrq op/key table.
I didn't mark 'h' as Help because Help is just printed for any unknown key,
such as '?'.
Added some omitted sysrq key entries in the sysrq.txt file.
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | Documentation/sysrq.txt | 66 | ||||
-rw-r--r-- | drivers/char/sysrq.c | 20 |
2 files changed, 46 insertions, 40 deletions
diff --git a/Documentation/sysrq.txt b/Documentation/sysrq.txt index e0188a23fd5e..61613166981b 100644 --- a/Documentation/sysrq.txt +++ b/Documentation/sysrq.txt | |||
@@ -1,6 +1,6 @@ | |||
1 | Linux Magic System Request Key Hacks | 1 | Linux Magic System Request Key Hacks |
2 | Documentation for sysrq.c version 1.15 | 2 | Documentation for sysrq.c |
3 | Last update: $Date: 2001/01/28 10:15:59 $ | 3 | Last update: 2007-JAN-06 |
4 | 4 | ||
5 | * What is the magic SysRq key? | 5 | * What is the magic SysRq key? |
6 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 6 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
@@ -35,7 +35,7 @@ You can set the value in the file by the following command: | |||
35 | 35 | ||
36 | Note that the value of /proc/sys/kernel/sysrq influences only the invocation | 36 | Note that the value of /proc/sys/kernel/sysrq influences only the invocation |
37 | via a keyboard. Invocation of any operation via /proc/sysrq-trigger is always | 37 | via a keyboard. Invocation of any operation via /proc/sysrq-trigger is always |
38 | allowed. | 38 | allowed (by a user with admin privileges). |
39 | 39 | ||
40 | * How do I use the magic SysRq key? | 40 | * How do I use the magic SysRq key? |
41 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 41 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
@@ -58,7 +58,7 @@ On PowerPC - Press 'ALT - Print Screen (or F13) - <command key>, | |||
58 | On other - If you know of the key combos for other architectures, please | 58 | On other - If you know of the key combos for other architectures, please |
59 | let me know so I can add them to this section. | 59 | let me know so I can add them to this section. |
60 | 60 | ||
61 | On all - write a character to /proc/sysrq-trigger. eg: | 61 | On all - write a character to /proc/sysrq-trigger. e.g.: |
62 | 62 | ||
63 | echo t > /proc/sysrq-trigger | 63 | echo t > /proc/sysrq-trigger |
64 | 64 | ||
@@ -74,6 +74,8 @@ On all - write a character to /proc/sysrq-trigger. eg: | |||
74 | 74 | ||
75 | 'c' - Will perform a kexec reboot in order to take a crashdump. | 75 | 'c' - Will perform a kexec reboot in order to take a crashdump. |
76 | 76 | ||
77 | 'd' - Shows all locks that are held. | ||
78 | |||
77 | 'o' - Will shut your system off (if configured and supported). | 79 | 'o' - Will shut your system off (if configured and supported). |
78 | 80 | ||
79 | 's' - Will attempt to sync all mounted filesystems. | 81 | 's' - Will attempt to sync all mounted filesystems. |
@@ -87,38 +89,43 @@ On all - write a character to /proc/sysrq-trigger. eg: | |||
87 | 89 | ||
88 | 'm' - Will dump current memory info to your console. | 90 | 'm' - Will dump current memory info to your console. |
89 | 91 | ||
92 | 'n' - Used to make RT tasks nice-able | ||
93 | |||
90 | 'v' - Dumps Voyager SMP processor info to your console. | 94 | 'v' - Dumps Voyager SMP processor info to your console. |
91 | 95 | ||
96 | 'w' - Dumps tasks that are in uninterruptable (blocked) state. | ||
97 | |||
98 | 'x' - Used by xmon interface on ppc/powerpc platforms. | ||
99 | |||
92 | '0'-'9' - Sets the console log level, controlling which kernel messages | 100 | '0'-'9' - Sets the console log level, controlling which kernel messages |
93 | will be printed to your console. ('0', for example would make | 101 | will be printed to your console. ('0', for example would make |
94 | it so that only emergency messages like PANICs or OOPSes would | 102 | it so that only emergency messages like PANICs or OOPSes would |
95 | make it to your console.) | 103 | make it to your console.) |
96 | 104 | ||
97 | 'f' - Will call oom_kill to kill a memory hog process | 105 | 'f' - Will call oom_kill to kill a memory hog process. |
98 | 106 | ||
99 | 'e' - Send a SIGTERM to all processes, except for init. | 107 | 'e' - Send a SIGTERM to all processes, except for init. |
100 | 108 | ||
101 | 'i' - Send a SIGKILL to all processes, except for init. | 109 | 'g' - Used by kgdb on ppc platforms. |
102 | 110 | ||
103 | 'l' - Send a SIGKILL to all processes, INCLUDING init. (Your system | 111 | 'i' - Send a SIGKILL to all processes, except for init. |
104 | will be non-functional after this.) | ||
105 | 112 | ||
106 | 'h' - Will display help ( actually any other key than those listed | 113 | 'h' - Will display help (actually any other key than those listed |
107 | above will display help. but 'h' is easy to remember :-) | 114 | above will display help. but 'h' is easy to remember :-) |
108 | 115 | ||
109 | * Okay, so what can I use them for? | 116 | * Okay, so what can I use them for? |
110 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 117 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
111 | Well, un'R'aw is very handy when your X server or a svgalib program crashes. | 118 | Well, un'R'aw is very handy when your X server or a svgalib program crashes. |
112 | 119 | ||
113 | sa'K' (Secure Access Key) is useful when you want to be sure there are no | 120 | sa'K' (Secure Access Key) is useful when you want to be sure there is no |
114 | trojan program is running at console and which could grab your password | 121 | trojan program running at console which could grab your password |
115 | when you would try to login. It will kill all programs on given console | 122 | when you would try to login. It will kill all programs on given console, |
116 | and thus letting you make sure that the login prompt you see is actually | 123 | thus letting you make sure that the login prompt you see is actually |
117 | the one from init, not some trojan program. | 124 | the one from init, not some trojan program. |
118 | IMPORTANT: In its true form it is not a true SAK like the one in a :IMPORTANT | 125 | IMPORTANT: In its true form it is not a true SAK like the one in a :IMPORTANT |
119 | IMPORTANT: c2 compliant system, and it should not be mistaken as :IMPORTANT | 126 | IMPORTANT: c2 compliant system, and it should not be mistaken as :IMPORTANT |
120 | IMPORTANT: such. :IMPORTANT | 127 | IMPORTANT: such. :IMPORTANT |
121 | It seems other find it useful as (System Attention Key) which is | 128 | It seems others find it useful as (System Attention Key) which is |
122 | useful when you want to exit a program that will not let you switch consoles. | 129 | useful when you want to exit a program that will not let you switch consoles. |
123 | (For example, X or a svgalib program.) | 130 | (For example, X or a svgalib program.) |
124 | 131 | ||
@@ -139,8 +146,8 @@ OK or Done message...) | |||
139 | Again, the unmount (remount read-only) hasn't taken place until you see the | 146 | Again, the unmount (remount read-only) hasn't taken place until you see the |
140 | "OK" and "Done" message appear on the screen. | 147 | "OK" and "Done" message appear on the screen. |
141 | 148 | ||
142 | The loglevel'0'-'9' is useful when your console is being flooded with | 149 | The loglevels '0'-'9' are useful when your console is being flooded with |
143 | kernel messages you do not want to see. Setting '0' will prevent all but | 150 | kernel messages you do not want to see. Selecting '0' will prevent all but |
144 | the most urgent kernel messages from reaching your console. (They will | 151 | the most urgent kernel messages from reaching your console. (They will |
145 | still be logged if syslogd/klogd are alive, though.) | 152 | still be logged if syslogd/klogd are alive, though.) |
146 | 153 | ||
@@ -152,7 +159,7 @@ processes. | |||
152 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 159 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
153 | That happens to me, also. I've found that tapping shift, alt, and control | 160 | That happens to me, also. I've found that tapping shift, alt, and control |
154 | on both sides of the keyboard, and hitting an invalid sysrq sequence again | 161 | on both sides of the keyboard, and hitting an invalid sysrq sequence again |
155 | will fix the problem. (ie, something like alt-sysrq-z). Switching to another | 162 | will fix the problem. (i.e., something like alt-sysrq-z). Switching to another |
156 | virtual console (ALT+Fn) and then back again should also help. | 163 | virtual console (ALT+Fn) and then back again should also help. |
157 | 164 | ||
158 | * I hit SysRq, but nothing seems to happen, what's wrong? | 165 | * I hit SysRq, but nothing seems to happen, what's wrong? |
@@ -174,11 +181,11 @@ handler function you will use, B) a help_msg string, that will print when SysRQ | |||
174 | prints help, and C) an action_msg string, that will print right before your | 181 | prints help, and C) an action_msg string, that will print right before your |
175 | handler is called. Your handler must conform to the prototype in 'sysrq.h'. | 182 | handler is called. Your handler must conform to the prototype in 'sysrq.h'. |
176 | 183 | ||
177 | After the sysrq_key_op is created, you can call the macro | 184 | After the sysrq_key_op is created, you can call the kernel function |
178 | register_sysrq_key(int key, struct sysrq_key_op *op_p) that is defined in | 185 | register_sysrq_key(int key, struct sysrq_key_op *op_p); this will |
179 | sysrq.h, this will register the operation pointed to by 'op_p' at table | 186 | register the operation pointed to by 'op_p' at table key 'key', |
180 | key 'key', if that slot in the table is blank. At module unload time, you must | 187 | if that slot in the table is blank. At module unload time, you must call |
181 | call the macro unregister_sysrq_key(int key, struct sysrq_key_op *op_p), which | 188 | the function unregister_sysrq_key(int key, struct sysrq_key_op *op_p), which |
182 | will remove the key op pointed to by 'op_p' from the key 'key', if and only if | 189 | will remove the key op pointed to by 'op_p' from the key 'key', if and only if |
183 | it is currently registered in that slot. This is in case the slot has been | 190 | it is currently registered in that slot. This is in case the slot has been |
184 | overwritten since you registered it. | 191 | overwritten since you registered it. |
@@ -186,15 +193,12 @@ overwritten since you registered it. | |||
186 | The Magic SysRQ system works by registering key operations against a key op | 193 | The Magic SysRQ system works by registering key operations against a key op |
187 | lookup table, which is defined in 'drivers/char/sysrq.c'. This key table has | 194 | lookup table, which is defined in 'drivers/char/sysrq.c'. This key table has |
188 | a number of operations registered into it at compile time, but is mutable, | 195 | a number of operations registered into it at compile time, but is mutable, |
189 | and 4 functions are exported for interface to it: __sysrq_lock_table, | 196 | and 2 functions are exported for interface to it: |
190 | __sysrq_unlock_table, __sysrq_get_key_op, and __sysrq_put_key_op. The | 197 | register_sysrq_key and unregister_sysrq_key. |
191 | functions __sysrq_swap_key_ops and __sysrq_swap_key_ops_nolock are defined | 198 | Of course, never ever leave an invalid pointer in the table. I.e., when |
192 | in the header itself, and the REGISTER and UNREGISTER macros are built from | 199 | your module that called register_sysrq_key() exits, it must call |
193 | these. More complex (and dangerous!) manipulations of the table are possible | 200 | unregister_sysrq_key() to clean up the sysrq key table entry that it used. |
194 | using these functions, but you must be careful to always lock the table before | 201 | Null pointers in the table are always safe. :) |
195 | you read or write from it, and to unlock it again when you are done. (And of | ||
196 | course, to never ever leave an invalid pointer in the table). Null pointers in | ||
197 | the table are always safe :) | ||
198 | 202 | ||
199 | If for some reason you feel the need to call the handle_sysrq function from | 203 | If for some reason you feel the need to call the handle_sysrq function from |
200 | within a function called by handle_sysrq, you must be aware that you are in | 204 | within a function called by handle_sysrq, you must be aware that you are in |
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index 13935235e066..7fd3cd5ddf21 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c | |||
@@ -215,7 +215,7 @@ static void sysrq_handle_showstate_blocked(int key, struct tty_struct *tty) | |||
215 | } | 215 | } |
216 | static struct sysrq_key_op sysrq_showstate_blocked_op = { | 216 | static struct sysrq_key_op sysrq_showstate_blocked_op = { |
217 | .handler = sysrq_handle_showstate_blocked, | 217 | .handler = sysrq_handle_showstate_blocked, |
218 | .help_msg = "showBlockedTasks", | 218 | .help_msg = "shoW-blocked-tasks", |
219 | .action_msg = "Show Blocked State", | 219 | .action_msg = "Show Blocked State", |
220 | .enable_mask = SYSRQ_ENABLE_DUMP, | 220 | .enable_mask = SYSRQ_ENABLE_DUMP, |
221 | }; | 221 | }; |
@@ -315,15 +315,16 @@ static struct sysrq_key_op *sysrq_key_table[36] = { | |||
315 | &sysrq_loglevel_op, /* 9 */ | 315 | &sysrq_loglevel_op, /* 9 */ |
316 | 316 | ||
317 | /* | 317 | /* |
318 | * Don't use for system provided sysrqs, it is handled specially on | 318 | * a: Don't use for system provided sysrqs, it is handled specially on |
319 | * sparc and will never arrive | 319 | * sparc and will never arrive. |
320 | */ | 320 | */ |
321 | NULL, /* a */ | 321 | NULL, /* a */ |
322 | &sysrq_reboot_op, /* b */ | 322 | &sysrq_reboot_op, /* b */ |
323 | &sysrq_crashdump_op, /* c */ | 323 | &sysrq_crashdump_op, /* c & ibm_emac driver debug */ |
324 | &sysrq_showlocks_op, /* d */ | 324 | &sysrq_showlocks_op, /* d */ |
325 | &sysrq_term_op, /* e */ | 325 | &sysrq_term_op, /* e */ |
326 | &sysrq_moom_op, /* f */ | 326 | &sysrq_moom_op, /* f */ |
327 | /* g: May be registered by ppc for kgdb */ | ||
327 | NULL, /* g */ | 328 | NULL, /* g */ |
328 | NULL, /* h */ | 329 | NULL, /* h */ |
329 | &sysrq_kill_op, /* i */ | 330 | &sysrq_kill_op, /* i */ |
@@ -332,18 +333,19 @@ static struct sysrq_key_op *sysrq_key_table[36] = { | |||
332 | NULL, /* l */ | 333 | NULL, /* l */ |
333 | &sysrq_showmem_op, /* m */ | 334 | &sysrq_showmem_op, /* m */ |
334 | &sysrq_unrt_op, /* n */ | 335 | &sysrq_unrt_op, /* n */ |
335 | /* This will often be registered as 'Off' at init time */ | 336 | /* o: This will often be registered as 'Off' at init time */ |
336 | NULL, /* o */ | 337 | NULL, /* o */ |
337 | &sysrq_showregs_op, /* p */ | 338 | &sysrq_showregs_op, /* p */ |
338 | NULL, /* q */ | 339 | NULL, /* q */ |
339 | &sysrq_unraw_op, /* r */ | 340 | &sysrq_unraw_op, /* r */ |
340 | &sysrq_sync_op, /* s */ | 341 | &sysrq_sync_op, /* s */ |
341 | &sysrq_showstate_op, /* t */ | 342 | &sysrq_showstate_op, /* t */ |
342 | &sysrq_mountro_op, /* u */ | 343 | &sysrq_mountro_op, /* u */ |
343 | /* May be assigned at init time by SMP VOYAGER */ | 344 | /* v: May be registered at init time by SMP VOYAGER */ |
344 | NULL, /* v */ | 345 | NULL, /* v */ |
345 | NULL, /* w */ | 346 | &sysrq_showstate_blocked_op, /* w */ |
346 | &sysrq_showstate_blocked_op, /* x */ | 347 | /* x: May be registered on ppc/powerpc for xmon */ |
348 | NULL, /* x */ | ||
347 | NULL, /* y */ | 349 | NULL, /* y */ |
348 | NULL /* z */ | 350 | NULL /* z */ |
349 | }; | 351 | }; |