All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Add configurable handler to execute a compound action
@ 2020-08-17 13:27 ` Andrzej Pietrasiewicz
  0 siblings, 0 replies; 10+ messages in thread
From: Andrzej Pietrasiewicz @ 2020-08-17 13:27 UTC (permalink / raw)
  To: linux-kernel
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Daniel Vetter, Greg Kroah-Hartman, Jiri Slaby,
	Dmitry Torokhov, Andrzej Pietrasiewicz, linux-input, dri-devel,
	kernel

This is a follow-up of this thread:

https://www.spinics.net/lists/linux-input/msg68446.html

It only touches DRM (dri-devel) in such a way that it changes the help
message of sysrq_drm_fb_helper_restore_op, otherwise it is unrelated to DRM.

Patch 2/2 adds a configurable handler to execute a compound action.

Userland might want to execute e.g. 'w' (show blocked tasks), followed
by 's' (sync), followed by 1000 ms delay and then followed by 'c' (crash)
upon a single magic SysRq. Or one might want to execute the famous "Raising
Elephants Is So Utterly Boring" action. This patch adds a configurable
handler, triggered with 'C', for this exact purpose. The user specifies the
composition of the compound action using syntax similar to getopt, where
each letter corresponds to an individual action and a colon followed by a
number corresponds to a delay of that many milliseconds, e.g.:

ws:1000c

or

r:100eis:1000ub

An example of userspace that wants to perform a compound action is
Chrome OS, where SysRq-X (pressed for the second time within a certain
time period from the first time) causes showing the locked tasks, syncing,
waiting a 1000 ms delay and crashing the system.

Since all the slots in the sysrq_key_table[] are already taken or reserved,
patch 1/2 extends it to cover also capital letter versions.

v1..v2:
- used toupper() instead of opencoding it (Jiri Slaby)
- updated help message of sysrq_drm_fb_helper_restore_op (Jiri Slaby)
- used unsigned int for specifying delays (Jiri Slaby)
- improved printed messages formatting (Jiri Slaby)

Andrzej Pietrasiewicz (2):
  tty/sysrq: Extend the sysrq_key_table to cover capital letters
  tty/sysrq: Add configurable handler to execute a compound action

 Documentation/admin-guide/sysrq.rst |  11 +++
 drivers/gpu/drm/drm_fb_helper.c     |   2 +-
 drivers/tty/sysrq.c                 | 129 +++++++++++++++++++++++++++-
 include/linux/sysrq.h               |   1 +
 4 files changed, 140 insertions(+), 3 deletions(-)


base-commit: 9123e3a74ec7b934a4a099e98af6a61c2f80bbf5
-- 
2.17.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 0/2] Add configurable handler to execute a compound action
@ 2020-08-17 13:27 ` Andrzej Pietrasiewicz
  0 siblings, 0 replies; 10+ messages in thread
From: Andrzej Pietrasiewicz @ 2020-08-17 13:27 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-input, Thomas Zimmermann, David Airlie, Greg Kroah-Hartman,
	Dmitry Torokhov, Andrzej Pietrasiewicz, dri-devel, Jiri Slaby,
	kernel

This is a follow-up of this thread:

https://www.spinics.net/lists/linux-input/msg68446.html

It only touches DRM (dri-devel) in such a way that it changes the help
message of sysrq_drm_fb_helper_restore_op, otherwise it is unrelated to DRM.

Patch 2/2 adds a configurable handler to execute a compound action.

Userland might want to execute e.g. 'w' (show blocked tasks), followed
by 's' (sync), followed by 1000 ms delay and then followed by 'c' (crash)
upon a single magic SysRq. Or one might want to execute the famous "Raising
Elephants Is So Utterly Boring" action. This patch adds a configurable
handler, triggered with 'C', for this exact purpose. The user specifies the
composition of the compound action using syntax similar to getopt, where
each letter corresponds to an individual action and a colon followed by a
number corresponds to a delay of that many milliseconds, e.g.:

ws:1000c

or

r:100eis:1000ub

An example of userspace that wants to perform a compound action is
Chrome OS, where SysRq-X (pressed for the second time within a certain
time period from the first time) causes showing the locked tasks, syncing,
waiting a 1000 ms delay and crashing the system.

Since all the slots in the sysrq_key_table[] are already taken or reserved,
patch 1/2 extends it to cover also capital letter versions.

v1..v2:
- used toupper() instead of opencoding it (Jiri Slaby)
- updated help message of sysrq_drm_fb_helper_restore_op (Jiri Slaby)
- used unsigned int for specifying delays (Jiri Slaby)
- improved printed messages formatting (Jiri Slaby)

Andrzej Pietrasiewicz (2):
  tty/sysrq: Extend the sysrq_key_table to cover capital letters
  tty/sysrq: Add configurable handler to execute a compound action

 Documentation/admin-guide/sysrq.rst |  11 +++
 drivers/gpu/drm/drm_fb_helper.c     |   2 +-
 drivers/tty/sysrq.c                 | 129 +++++++++++++++++++++++++++-
 include/linux/sysrq.h               |   1 +
 4 files changed, 140 insertions(+), 3 deletions(-)


base-commit: 9123e3a74ec7b934a4a099e98af6a61c2f80bbf5
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 1/2] tty/sysrq: Extend the sysrq_key_table to cover capital letters
  2020-08-17 13:27 ` Andrzej Pietrasiewicz
@ 2020-08-17 13:27   ` Andrzej Pietrasiewicz
  -1 siblings, 0 replies; 10+ messages in thread
From: Andrzej Pietrasiewicz @ 2020-08-17 13:27 UTC (permalink / raw)
  To: linux-kernel
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Daniel Vetter, Greg Kroah-Hartman, Jiri Slaby,
	Dmitry Torokhov, Andrzej Pietrasiewicz, linux-input, dri-devel,
	kernel

All slots in sysrq_key_table[] are either used, reserved or at least
commented with their intended use. This patch adds capital letter versions
available, which means adding 26 more entries.

For already existing SysRq operations the user presses Alt-SysRq-<key>, and
for the newly added ones Alt-Shift-SysRq-<key>.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
---
 Documentation/admin-guide/sysrq.rst |  2 ++
 drivers/gpu/drm/drm_fb_helper.c     |  2 +-
 drivers/tty/sysrq.c                 | 49 +++++++++++++++++++++++++++--
 3 files changed, 50 insertions(+), 3 deletions(-)

diff --git a/Documentation/admin-guide/sysrq.rst b/Documentation/admin-guide/sysrq.rst
index e6424d8c5846..67dfa4c29093 100644
--- a/Documentation/admin-guide/sysrq.rst
+++ b/Documentation/admin-guide/sysrq.rst
@@ -79,6 +79,8 @@ On all
 
 		echo t > /proc/sysrq-trigger
 
+The :kbd:`<command key>` is case sensitive.
+
 What are the 'command' keys?
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 8697554ccd41..1543d9d10970 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -325,7 +325,7 @@ static void drm_fb_helper_sysrq(int dummy1)
 
 static const struct sysrq_key_op sysrq_drm_fb_helper_restore_op = {
 	.handler = drm_fb_helper_sysrq,
-	.help_msg = "force-fb(V)",
+	.help_msg = "force-fb(v)",
 	.action_msg = "Restore framebuffer console",
 };
 #else
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index a8e39b2cdd55..959f9e121cc6 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -19,6 +19,7 @@
 #include <linux/sched/rt.h>
 #include <linux/sched/debug.h>
 #include <linux/sched/task.h>
+#include <linux/ctype.h>
 #include <linux/interrupt.h>
 #include <linux/mm.h>
 #include <linux/fs.h>
@@ -440,7 +441,7 @@ static const struct sysrq_key_op sysrq_unrt_op = {
 /* Key Operations table and lock */
 static DEFINE_SPINLOCK(sysrq_key_table_lock);
 
-static const struct sysrq_key_op *sysrq_key_table[36] = {
+static const struct sysrq_key_op *sysrq_key_table[62] = {
 	&sysrq_loglevel_op,		/* 0 */
 	&sysrq_loglevel_op,		/* 1 */
 	&sysrq_loglevel_op,		/* 2 */
@@ -497,6 +498,32 @@ static const struct sysrq_key_op *sysrq_key_table[36] = {
 	/* y: May be registered on sparc64 for global register dump */
 	NULL,				/* y */
 	&sysrq_ftrace_dump_op,		/* z */
+	NULL,				/* A */
+	NULL,				/* B */
+	NULL,				/* C */
+	NULL,				/* D */
+	NULL,				/* E */
+	NULL,				/* F */
+	NULL,				/* G */
+	NULL,				/* H */
+	NULL,				/* I */
+	NULL,				/* J */
+	NULL,				/* K */
+	NULL,				/* L */
+	NULL,				/* M */
+	NULL,				/* N */
+	NULL,				/* O */
+	NULL,				/* P */
+	NULL,				/* Q */
+	NULL,				/* R */
+	NULL,				/* S */
+	NULL,				/* T */
+	NULL,				/* U */
+	NULL,				/* V */
+	NULL,				/* W */
+	NULL,				/* X */
+	NULL,				/* Y */
+	NULL,				/* Z */
 };
 
 /* key2index calculation, -1 on invalid index */
@@ -508,6 +535,8 @@ static int sysrq_key_table_key2index(int key)
 		retval = key - '0';
 	else if ((key >= 'a') && (key <= 'z'))
 		retval = key + 10 - 'a';
+	else if ((key >= 'A') && (key <= 'Z'))
+		retval = key + 36 - 'A';
 	else
 		retval = -1;
 	return retval;
@@ -621,6 +650,8 @@ struct sysrq_state {
 	unsigned long key_down[BITS_TO_LONGS(KEY_CNT)];
 	unsigned int alt;
 	unsigned int alt_use;
+	unsigned int shift;
+	unsigned int shift_use;
 	bool active;
 	bool need_reinject;
 	bool reinjecting;
@@ -805,10 +836,20 @@ static bool sysrq_handle_keypress(struct sysrq_state *sysrq,
 		}
 		break;
 
+	case KEY_LEFTSHIFT:
+	case KEY_RIGHTSHIFT:
+		if (!value)
+			sysrq->shift = KEY_RESERVED;
+		else if (value != 2)
+			sysrq->shift = code;
+		break;
+
 	case KEY_SYSRQ:
 		if (value == 1 && sysrq->alt != KEY_RESERVED) {
 			sysrq->active = true;
 			sysrq->alt_use = sysrq->alt;
+			/* either RESERVED (for released) or actual code */
+			sysrq->shift_use = sysrq->shift;
 			/*
 			 * If nothing else will be pressed we'll need
 			 * to re-inject Alt-SysRq keysroke.
@@ -831,8 +872,12 @@ static bool sysrq_handle_keypress(struct sysrq_state *sysrq,
 
 	default:
 		if (sysrq->active && value && value != 2) {
+			unsigned char c = sysrq_xlate[code];
+
 			sysrq->need_reinject = false;
-			__handle_sysrq(sysrq_xlate[code], true);
+			if (sysrq->shift_use != KEY_RESERVED)
+				c = toupper(c);
+			__handle_sysrq(c, true);
 		}
 		break;
 	}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 1/2] tty/sysrq: Extend the sysrq_key_table to cover capital letters
@ 2020-08-17 13:27   ` Andrzej Pietrasiewicz
  0 siblings, 0 replies; 10+ messages in thread
From: Andrzej Pietrasiewicz @ 2020-08-17 13:27 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-input, Thomas Zimmermann, David Airlie, Greg Kroah-Hartman,
	Dmitry Torokhov, Andrzej Pietrasiewicz, dri-devel, Jiri Slaby,
	kernel

All slots in sysrq_key_table[] are either used, reserved or at least
commented with their intended use. This patch adds capital letter versions
available, which means adding 26 more entries.

For already existing SysRq operations the user presses Alt-SysRq-<key>, and
for the newly added ones Alt-Shift-SysRq-<key>.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
---
 Documentation/admin-guide/sysrq.rst |  2 ++
 drivers/gpu/drm/drm_fb_helper.c     |  2 +-
 drivers/tty/sysrq.c                 | 49 +++++++++++++++++++++++++++--
 3 files changed, 50 insertions(+), 3 deletions(-)

diff --git a/Documentation/admin-guide/sysrq.rst b/Documentation/admin-guide/sysrq.rst
index e6424d8c5846..67dfa4c29093 100644
--- a/Documentation/admin-guide/sysrq.rst
+++ b/Documentation/admin-guide/sysrq.rst
@@ -79,6 +79,8 @@ On all
 
 		echo t > /proc/sysrq-trigger
 
+The :kbd:`<command key>` is case sensitive.
+
 What are the 'command' keys?
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 8697554ccd41..1543d9d10970 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -325,7 +325,7 @@ static void drm_fb_helper_sysrq(int dummy1)
 
 static const struct sysrq_key_op sysrq_drm_fb_helper_restore_op = {
 	.handler = drm_fb_helper_sysrq,
-	.help_msg = "force-fb(V)",
+	.help_msg = "force-fb(v)",
 	.action_msg = "Restore framebuffer console",
 };
 #else
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index a8e39b2cdd55..959f9e121cc6 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -19,6 +19,7 @@
 #include <linux/sched/rt.h>
 #include <linux/sched/debug.h>
 #include <linux/sched/task.h>
+#include <linux/ctype.h>
 #include <linux/interrupt.h>
 #include <linux/mm.h>
 #include <linux/fs.h>
@@ -440,7 +441,7 @@ static const struct sysrq_key_op sysrq_unrt_op = {
 /* Key Operations table and lock */
 static DEFINE_SPINLOCK(sysrq_key_table_lock);
 
-static const struct sysrq_key_op *sysrq_key_table[36] = {
+static const struct sysrq_key_op *sysrq_key_table[62] = {
 	&sysrq_loglevel_op,		/* 0 */
 	&sysrq_loglevel_op,		/* 1 */
 	&sysrq_loglevel_op,		/* 2 */
@@ -497,6 +498,32 @@ static const struct sysrq_key_op *sysrq_key_table[36] = {
 	/* y: May be registered on sparc64 for global register dump */
 	NULL,				/* y */
 	&sysrq_ftrace_dump_op,		/* z */
+	NULL,				/* A */
+	NULL,				/* B */
+	NULL,				/* C */
+	NULL,				/* D */
+	NULL,				/* E */
+	NULL,				/* F */
+	NULL,				/* G */
+	NULL,				/* H */
+	NULL,				/* I */
+	NULL,				/* J */
+	NULL,				/* K */
+	NULL,				/* L */
+	NULL,				/* M */
+	NULL,				/* N */
+	NULL,				/* O */
+	NULL,				/* P */
+	NULL,				/* Q */
+	NULL,				/* R */
+	NULL,				/* S */
+	NULL,				/* T */
+	NULL,				/* U */
+	NULL,				/* V */
+	NULL,				/* W */
+	NULL,				/* X */
+	NULL,				/* Y */
+	NULL,				/* Z */
 };
 
 /* key2index calculation, -1 on invalid index */
@@ -508,6 +535,8 @@ static int sysrq_key_table_key2index(int key)
 		retval = key - '0';
 	else if ((key >= 'a') && (key <= 'z'))
 		retval = key + 10 - 'a';
+	else if ((key >= 'A') && (key <= 'Z'))
+		retval = key + 36 - 'A';
 	else
 		retval = -1;
 	return retval;
@@ -621,6 +650,8 @@ struct sysrq_state {
 	unsigned long key_down[BITS_TO_LONGS(KEY_CNT)];
 	unsigned int alt;
 	unsigned int alt_use;
+	unsigned int shift;
+	unsigned int shift_use;
 	bool active;
 	bool need_reinject;
 	bool reinjecting;
@@ -805,10 +836,20 @@ static bool sysrq_handle_keypress(struct sysrq_state *sysrq,
 		}
 		break;
 
+	case KEY_LEFTSHIFT:
+	case KEY_RIGHTSHIFT:
+		if (!value)
+			sysrq->shift = KEY_RESERVED;
+		else if (value != 2)
+			sysrq->shift = code;
+		break;
+
 	case KEY_SYSRQ:
 		if (value == 1 && sysrq->alt != KEY_RESERVED) {
 			sysrq->active = true;
 			sysrq->alt_use = sysrq->alt;
+			/* either RESERVED (for released) or actual code */
+			sysrq->shift_use = sysrq->shift;
 			/*
 			 * If nothing else will be pressed we'll need
 			 * to re-inject Alt-SysRq keysroke.
@@ -831,8 +872,12 @@ static bool sysrq_handle_keypress(struct sysrq_state *sysrq,
 
 	default:
 		if (sysrq->active && value && value != 2) {
+			unsigned char c = sysrq_xlate[code];
+
 			sysrq->need_reinject = false;
-			__handle_sysrq(sysrq_xlate[code], true);
+			if (sysrq->shift_use != KEY_RESERVED)
+				c = toupper(c);
+			__handle_sysrq(c, true);
 		}
 		break;
 	}
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 2/2] tty/sysrq: Add configurable handler to execute a compound action
  2020-08-17 13:27 ` Andrzej Pietrasiewicz
@ 2020-08-17 13:27   ` Andrzej Pietrasiewicz
  -1 siblings, 0 replies; 10+ messages in thread
From: Andrzej Pietrasiewicz @ 2020-08-17 13:27 UTC (permalink / raw)
  To: linux-kernel
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Daniel Vetter, Greg Kroah-Hartman, Jiri Slaby,
	Dmitry Torokhov, Andrzej Pietrasiewicz, linux-input, dri-devel,
	kernel

Userland might want to execute e.g. 'w' (show blocked tasks), followed
by 's' (sync), followed by 1000 ms delay and then followed by 'c' (crash)
upon a single magic SysRq. Or one might want to execute the famous "Raising
Elephants Is So Utterly Boring" action. This patch adds a configurable
handler, triggered with 'C', for this exact purpose. The user specifies the
composition of the compound action using syntax similar to getopt, where
each letter corresponds to an individual action and a colon followed by a
number corresponds to a delay of that many milliseconds, e.g.:

ws:1000c

or

r:100eis:1000ub

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
---
 Documentation/admin-guide/sysrq.rst |  9 ++++
 drivers/tty/sysrq.c                 | 82 ++++++++++++++++++++++++++++-
 include/linux/sysrq.h               |  1 +
 3 files changed, 91 insertions(+), 1 deletion(-)

diff --git a/Documentation/admin-guide/sysrq.rst b/Documentation/admin-guide/sysrq.rst
index 67dfa4c29093..80bdd8bf9636 100644
--- a/Documentation/admin-guide/sysrq.rst
+++ b/Documentation/admin-guide/sysrq.rst
@@ -32,6 +32,7 @@ to 1. Here is the list of possible values in /proc/sys/kernel/sysrq:
          64 =  0x40 - enable signalling of processes (term, kill, oom-kill)
         128 =  0x80 - allow reboot/poweroff
         256 = 0x100 - allow nicing of all RT tasks
+        512 = 0x200 - allow compound action
 
 You can set the value in the file by the following command::
 
@@ -148,6 +149,14 @@ Command	    Function
 
 ``z``	    Dump the ftrace buffer
 
+``C``	    Execute a predefined, compound action. The action is defined with
+	    sysrq.sysrq_compound_action module parameter, whose value contains known
+	    command keys (except ``C`` to prevent recursion). The command keys can
+	    be optionally followed by a colon and a number of milliseconds to wait
+	    after executing the last action. For example:
+
+	    sysrq.sysrq_compound_action=r:100eis:1000ub
+
 ``0``-``9`` Sets the console log level, controlling which kernel messages
             will be printed to your console. (``0``, for example would make
             it so that only emergency messages like PANICs or OOPSes would
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 959f9e121cc6..fec770de325b 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -20,6 +20,7 @@
 #include <linux/sched/debug.h>
 #include <linux/sched/task.h>
 #include <linux/ctype.h>
+#include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/mm.h>
 #include <linux/fs.h>
@@ -438,6 +439,15 @@ static const struct sysrq_key_op sysrq_unrt_op = {
 	.enable_mask	= SYSRQ_ENABLE_RTNICE,
 };
 
+static void sysrq_action_compound(int key);
+
+static struct sysrq_key_op sysrq_action_compound_op = {
+	.handler	= sysrq_action_compound,
+	.help_msg	= "execute-compound-action(C)",
+	.action_msg	= "Execute compound action",
+	.enable_mask	= SYSRQ_ENABLE_COMPOUND,
+};
+
 /* Key Operations table and lock */
 static DEFINE_SPINLOCK(sysrq_key_table_lock);
 
@@ -500,7 +510,7 @@ static const struct sysrq_key_op *sysrq_key_table[62] = {
 	&sysrq_ftrace_dump_op,		/* z */
 	NULL,				/* A */
 	NULL,				/* B */
-	NULL,				/* C */
+	&sysrq_action_compound_op,	/* C */
 	NULL,				/* D */
 	NULL,				/* E */
 	NULL,				/* F */
@@ -633,6 +643,7 @@ EXPORT_SYMBOL(handle_sysrq);
 
 #ifdef CONFIG_INPUT
 static int sysrq_reset_downtime_ms;
+static char *sysrq_compound_action;
 
 /* Simple translation table for the SysRq keys */
 static const unsigned char sysrq_xlate[KEY_CNT] =
@@ -786,6 +797,62 @@ static void sysrq_of_get_keyreset_config(void)
 {
 }
 #endif
+#define SYSRQ_COMPOUND_ACTION_VALIDATE	0
+#define SYSRQ_COMPOUND_ACTION_RUN	1
+
+static int sysrq_process_compound_action(int pass)
+{
+	const char *action = sysrq_compound_action;
+	const struct sysrq_key_op *op_p;
+	int ret;
+	unsigned int delay;
+
+	while (*action) {
+		op_p = __sysrq_get_key_op(*action);
+		if (!op_p)
+			return -EINVAL;
+
+		/* Don't allow calling ourselves recursively */
+		if (op_p == &sysrq_action_compound_op)
+			return -EINVAL;
+
+		if (pass == SYSRQ_COMPOUND_ACTION_RUN)
+			__handle_sysrq(*action, false);
+
+		if (*++action == ':') {
+			ret = sscanf(action++, ":%u", &delay);
+			if (ret < 1) /* we want at least ":[0-9]" => 1 item */
+				return -EINVAL;
+
+			while (*action >= '0' && *action <= '9')
+				++action;
+			if (pass == SYSRQ_COMPOUND_ACTION_RUN)
+				mdelay(delay);
+		}
+	}
+
+	return 0;
+}
+
+static void sysrq_action_compound(int key)
+{
+	if (!sysrq_compound_action) {
+		pr_err("Unconfigured compound action for %s\n",
+		       sysrq_action_compound_op.help_msg);
+
+		return;
+	}
+
+	if (sysrq_process_compound_action(SYSRQ_COMPOUND_ACTION_VALIDATE)) {
+		pr_err("Incorrect compound action %s for %s\n",
+		       sysrq_compound_action,
+		       sysrq_action_compound_op.help_msg);
+
+		return;
+	}
+
+	sysrq_process_compound_action(SYSRQ_COMPOUND_ACTION_RUN);
+}
 
 static void sysrq_reinject_alt_sysrq(struct work_struct *work)
 {
@@ -1077,8 +1144,21 @@ module_param_array_named(reset_seq, sysrq_reset_seq, sysrq_reset_seq,
 
 module_param_named(sysrq_downtime_ms, sysrq_reset_downtime_ms, int, 0644);
 
+module_param(sysrq_compound_action, charp, 0644);
+MODULE_PARM_DESC(sysrq_compound_action,
+	"\tCompound sysrq action to be executed on Alt-Shift-SysRq-C\n"
+	"\tThe compound action definition consists of known SysRq action letters except 'C',\n"
+	"\teach letter can be optionally followed by a colon and a number of milliseconds to wait\n"
+	"\tafter executing the last action.\n"
+	"\tExample:\n"
+	"\tTo unRaw, wait 100ms, tErminate, kIll, Sync, wait 1000ms, Unmount, Boot\n"
+	"\tsysrq.sysrq_compound_action=r:100eis:1000ub");
 #else
 
+{
+}
+
+static void sysrq_action_compound(int key)
 static inline void sysrq_register_handler(void)
 {
 }
diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h
index 3a582ec7a2f1..6df4442f12a9 100644
--- a/include/linux/sysrq.h
+++ b/include/linux/sysrq.h
@@ -28,6 +28,7 @@
 #define SYSRQ_ENABLE_SIGNAL	0x0040
 #define SYSRQ_ENABLE_BOOT	0x0080
 #define SYSRQ_ENABLE_RTNICE	0x0100
+#define SYSRQ_ENABLE_COMPOUND	0x0200
 
 struct sysrq_key_op {
 	void (* const handler)(int);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 2/2] tty/sysrq: Add configurable handler to execute a compound action
@ 2020-08-17 13:27   ` Andrzej Pietrasiewicz
  0 siblings, 0 replies; 10+ messages in thread
From: Andrzej Pietrasiewicz @ 2020-08-17 13:27 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-input, Thomas Zimmermann, David Airlie, Greg Kroah-Hartman,
	Dmitry Torokhov, Andrzej Pietrasiewicz, dri-devel, Jiri Slaby,
	kernel

Userland might want to execute e.g. 'w' (show blocked tasks), followed
by 's' (sync), followed by 1000 ms delay and then followed by 'c' (crash)
upon a single magic SysRq. Or one might want to execute the famous "Raising
Elephants Is So Utterly Boring" action. This patch adds a configurable
handler, triggered with 'C', for this exact purpose. The user specifies the
composition of the compound action using syntax similar to getopt, where
each letter corresponds to an individual action and a colon followed by a
number corresponds to a delay of that many milliseconds, e.g.:

ws:1000c

or

r:100eis:1000ub

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
---
 Documentation/admin-guide/sysrq.rst |  9 ++++
 drivers/tty/sysrq.c                 | 82 ++++++++++++++++++++++++++++-
 include/linux/sysrq.h               |  1 +
 3 files changed, 91 insertions(+), 1 deletion(-)

diff --git a/Documentation/admin-guide/sysrq.rst b/Documentation/admin-guide/sysrq.rst
index 67dfa4c29093..80bdd8bf9636 100644
--- a/Documentation/admin-guide/sysrq.rst
+++ b/Documentation/admin-guide/sysrq.rst
@@ -32,6 +32,7 @@ to 1. Here is the list of possible values in /proc/sys/kernel/sysrq:
          64 =  0x40 - enable signalling of processes (term, kill, oom-kill)
         128 =  0x80 - allow reboot/poweroff
         256 = 0x100 - allow nicing of all RT tasks
+        512 = 0x200 - allow compound action
 
 You can set the value in the file by the following command::
 
@@ -148,6 +149,14 @@ Command	    Function
 
 ``z``	    Dump the ftrace buffer
 
+``C``	    Execute a predefined, compound action. The action is defined with
+	    sysrq.sysrq_compound_action module parameter, whose value contains known
+	    command keys (except ``C`` to prevent recursion). The command keys can
+	    be optionally followed by a colon and a number of milliseconds to wait
+	    after executing the last action. For example:
+
+	    sysrq.sysrq_compound_action=r:100eis:1000ub
+
 ``0``-``9`` Sets the console log level, controlling which kernel messages
             will be printed to your console. (``0``, for example would make
             it so that only emergency messages like PANICs or OOPSes would
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 959f9e121cc6..fec770de325b 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -20,6 +20,7 @@
 #include <linux/sched/debug.h>
 #include <linux/sched/task.h>
 #include <linux/ctype.h>
+#include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/mm.h>
 #include <linux/fs.h>
@@ -438,6 +439,15 @@ static const struct sysrq_key_op sysrq_unrt_op = {
 	.enable_mask	= SYSRQ_ENABLE_RTNICE,
 };
 
+static void sysrq_action_compound(int key);
+
+static struct sysrq_key_op sysrq_action_compound_op = {
+	.handler	= sysrq_action_compound,
+	.help_msg	= "execute-compound-action(C)",
+	.action_msg	= "Execute compound action",
+	.enable_mask	= SYSRQ_ENABLE_COMPOUND,
+};
+
 /* Key Operations table and lock */
 static DEFINE_SPINLOCK(sysrq_key_table_lock);
 
@@ -500,7 +510,7 @@ static const struct sysrq_key_op *sysrq_key_table[62] = {
 	&sysrq_ftrace_dump_op,		/* z */
 	NULL,				/* A */
 	NULL,				/* B */
-	NULL,				/* C */
+	&sysrq_action_compound_op,	/* C */
 	NULL,				/* D */
 	NULL,				/* E */
 	NULL,				/* F */
@@ -633,6 +643,7 @@ EXPORT_SYMBOL(handle_sysrq);
 
 #ifdef CONFIG_INPUT
 static int sysrq_reset_downtime_ms;
+static char *sysrq_compound_action;
 
 /* Simple translation table for the SysRq keys */
 static const unsigned char sysrq_xlate[KEY_CNT] =
@@ -786,6 +797,62 @@ static void sysrq_of_get_keyreset_config(void)
 {
 }
 #endif
+#define SYSRQ_COMPOUND_ACTION_VALIDATE	0
+#define SYSRQ_COMPOUND_ACTION_RUN	1
+
+static int sysrq_process_compound_action(int pass)
+{
+	const char *action = sysrq_compound_action;
+	const struct sysrq_key_op *op_p;
+	int ret;
+	unsigned int delay;
+
+	while (*action) {
+		op_p = __sysrq_get_key_op(*action);
+		if (!op_p)
+			return -EINVAL;
+
+		/* Don't allow calling ourselves recursively */
+		if (op_p == &sysrq_action_compound_op)
+			return -EINVAL;
+
+		if (pass == SYSRQ_COMPOUND_ACTION_RUN)
+			__handle_sysrq(*action, false);
+
+		if (*++action == ':') {
+			ret = sscanf(action++, ":%u", &delay);
+			if (ret < 1) /* we want at least ":[0-9]" => 1 item */
+				return -EINVAL;
+
+			while (*action >= '0' && *action <= '9')
+				++action;
+			if (pass == SYSRQ_COMPOUND_ACTION_RUN)
+				mdelay(delay);
+		}
+	}
+
+	return 0;
+}
+
+static void sysrq_action_compound(int key)
+{
+	if (!sysrq_compound_action) {
+		pr_err("Unconfigured compound action for %s\n",
+		       sysrq_action_compound_op.help_msg);
+
+		return;
+	}
+
+	if (sysrq_process_compound_action(SYSRQ_COMPOUND_ACTION_VALIDATE)) {
+		pr_err("Incorrect compound action %s for %s\n",
+		       sysrq_compound_action,
+		       sysrq_action_compound_op.help_msg);
+
+		return;
+	}
+
+	sysrq_process_compound_action(SYSRQ_COMPOUND_ACTION_RUN);
+}
 
 static void sysrq_reinject_alt_sysrq(struct work_struct *work)
 {
@@ -1077,8 +1144,21 @@ module_param_array_named(reset_seq, sysrq_reset_seq, sysrq_reset_seq,
 
 module_param_named(sysrq_downtime_ms, sysrq_reset_downtime_ms, int, 0644);
 
+module_param(sysrq_compound_action, charp, 0644);
+MODULE_PARM_DESC(sysrq_compound_action,
+	"\tCompound sysrq action to be executed on Alt-Shift-SysRq-C\n"
+	"\tThe compound action definition consists of known SysRq action letters except 'C',\n"
+	"\teach letter can be optionally followed by a colon and a number of milliseconds to wait\n"
+	"\tafter executing the last action.\n"
+	"\tExample:\n"
+	"\tTo unRaw, wait 100ms, tErminate, kIll, Sync, wait 1000ms, Unmount, Boot\n"
+	"\tsysrq.sysrq_compound_action=r:100eis:1000ub");
 #else
 
+{
+}
+
+static void sysrq_action_compound(int key)
 static inline void sysrq_register_handler(void)
 {
 }
diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h
index 3a582ec7a2f1..6df4442f12a9 100644
--- a/include/linux/sysrq.h
+++ b/include/linux/sysrq.h
@@ -28,6 +28,7 @@
 #define SYSRQ_ENABLE_SIGNAL	0x0040
 #define SYSRQ_ENABLE_BOOT	0x0080
 #define SYSRQ_ENABLE_RTNICE	0x0100
+#define SYSRQ_ENABLE_COMPOUND	0x0200
 
 struct sysrq_key_op {
 	void (* const handler)(int);
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/2] tty/sysrq: Add configurable handler to execute a compound action
  2020-08-17 13:27   ` Andrzej Pietrasiewicz
@ 2020-08-17 20:09     ` kernel test robot
  -1 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2020-08-17 20:09 UTC (permalink / raw)
  To: Andrzej Pietrasiewicz, linux-kernel
  Cc: kbuild-all, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Daniel Vetter, Greg Kroah-Hartman, Jiri Slaby,
	Dmitry Torokhov, Andrzej Pietrasiewicz

[-- Attachment #1: Type: text/plain, Size: 32419 bytes --]

Hi Andrzej,

I love your patch! Yet something to improve:

[auto build test ERROR on 9123e3a74ec7b934a4a099e98af6a61c2f80bbf5]

url:    https://github.com/0day-ci/linux/commits/Andrzej-Pietrasiewicz/Add-configurable-handler-to-execute-a-compound-action/20200817-212944
base:    9123e3a74ec7b934a4a099e98af6a61c2f80bbf5
config: powerpc-tqm8xx_defconfig (attached as .config)
compiler: powerpc-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

>> drivers/tty/sysrq.c:1158:1: error: expected identifier or '(' before '{' token
    1158 | {
         | ^
   drivers/tty/sysrq.c: In function 'sysrq_action_compound':
>> drivers/tty/sysrq.c:1163:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    1163 | {
         | ^
   drivers/tty/sysrq.c:1167:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    1167 | {
         | ^
   drivers/tty/sysrq.c:1173:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    1173 | {
         | ^
   In file included from include/linux/linkage.h:7,
                    from include/linux/kernel.h:8,
                    from include/linux/list.h:9,
                    from include/linux/rculist.h:10,
                    from include/linux/sched/signal.h:5,
                    from drivers/tty/sysrq.c:18:
>> drivers/tty/sysrq.c:1187:19: error: storage class specified for parameter 'sysrq_toggle_support'
    1187 | EXPORT_SYMBOL_GPL(sysrq_toggle_support);
         |                   ^~~~~~~~~~~~~~~~~~~~
   include/linux/export.h:98:21: note: in definition of macro '___EXPORT_SYMBOL'
      98 |  extern typeof(sym) sym;       \
         |                     ^~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
     159 | #define EXPORT_SYMBOL_GPL(sym)  _EXPORT_SYMBOL(sym, "_gpl")
         |                                 ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1187:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    1187 | EXPORT_SYMBOL_GPL(sysrq_toggle_support);
         | ^~~~~~~~~~~~~~~~~
>> include/linux/export.h:99:20: error: storage class specified for parameter '__kstrtab_sysrq_toggle_support'
      99 |  extern const char __kstrtab_##sym[];     \
         |                    ^~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
     159 | #define EXPORT_SYMBOL_GPL(sym)  _EXPORT_SYMBOL(sym, "_gpl")
         |                                 ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1187:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    1187 | EXPORT_SYMBOL_GPL(sysrq_toggle_support);
         | ^~~~~~~~~~~~~~~~~
>> include/linux/export.h:100:20: error: storage class specified for parameter '__kstrtabns_sysrq_toggle_support'
     100 |  extern const char __kstrtabns_##sym[];     \
         |                    ^~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
     159 | #define EXPORT_SYMBOL_GPL(sym)  _EXPORT_SYMBOL(sym, "_gpl")
         |                                 ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1187:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    1187 | EXPORT_SYMBOL_GPL(sysrq_toggle_support);
         | ^~~~~~~~~~~~~~~~~
>> include/linux/export.h:101:24: error: expected declaration specifiers before ';' token
     101 |  __CRC_SYMBOL(sym, sec);       \
         |                        ^
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
     159 | #define EXPORT_SYMBOL_GPL(sym)  _EXPORT_SYMBOL(sym, "_gpl")
         |                                 ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1187:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    1187 | EXPORT_SYMBOL_GPL(sysrq_toggle_support);
         | ^~~~~~~~~~~~~~~~~
>> include/linux/export.h:102:2: error: expected declaration specifiers before 'asm'
     102 |  asm(" .section \"__ksymtab_strings\",\"aMS\",%progbits,1 \n" \
         |  ^~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
     159 | #define EXPORT_SYMBOL_GPL(sym)  _EXPORT_SYMBOL(sym, "_gpl")
         |                                 ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1187:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    1187 | EXPORT_SYMBOL_GPL(sysrq_toggle_support);
         | ^~~~~~~~~~~~~~~~~
   include/linux/export.h:67:36: error: storage class specified for parameter '__ksymtab_sysrq_toggle_support'
      67 |  static const struct kernel_symbol __ksymtab_##sym  \
         |                                    ^~~~~~~~~~
   include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
     108 |  __KSYMTAB_ENTRY(sym, sec)
         |  ^~~~~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
     159 | #define EXPORT_SYMBOL_GPL(sym)  _EXPORT_SYMBOL(sym, "_gpl")
         |                                 ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1187:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    1187 | EXPORT_SYMBOL_GPL(sysrq_toggle_support);
         | ^~~~~~~~~~~~~~~~~
>> include/linux/export.h:67:22: error: parameter '__ksymtab_sysrq_toggle_support' is initialized
      67 |  static const struct kernel_symbol __ksymtab_##sym  \
         |                      ^~~~~~~~~~~~~
   include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
     108 |  __KSYMTAB_ENTRY(sym, sec)
         |  ^~~~~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
     159 | #define EXPORT_SYMBOL_GPL(sym)  _EXPORT_SYMBOL(sym, "_gpl")
         |                                 ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1187:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    1187 | EXPORT_SYMBOL_GPL(sysrq_toggle_support);
         | ^~~~~~~~~~~~~~~~~
>> include/linux/export.h:67:36: error: section attribute not allowed for '__ksymtab_sysrq_toggle_support'
      67 |  static const struct kernel_symbol __ksymtab_##sym  \
         |                                    ^~~~~~~~~~
   include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
     108 |  __KSYMTAB_ENTRY(sym, sec)
         |  ^~~~~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
     159 | #define EXPORT_SYMBOL_GPL(sym)  _EXPORT_SYMBOL(sym, "_gpl")
         |                                 ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1187:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    1187 | EXPORT_SYMBOL_GPL(sysrq_toggle_support);
         | ^~~~~~~~~~~~~~~~~
>> include/linux/export.h:67:22: warning: 'used' attribute ignored [-Wattributes]
      67 |  static const struct kernel_symbol __ksymtab_##sym  \
         |                      ^~~~~~~~~~~~~
   include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
     108 |  __KSYMTAB_ENTRY(sym, sec)
         |  ^~~~~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
     159 | #define EXPORT_SYMBOL_GPL(sym)  _EXPORT_SYMBOL(sym, "_gpl")
         |                                 ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1187:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    1187 | EXPORT_SYMBOL_GPL(sysrq_toggle_support);
         | ^~~~~~~~~~~~~~~~~
>> include/linux/export.h:67:36: error: alignment may not be specified for '__ksymtab_sysrq_toggle_support'
      67 |  static const struct kernel_symbol __ksymtab_##sym  \
         |                                    ^~~~~~~~~~
   include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
     108 |  __KSYMTAB_ENTRY(sym, sec)
         |  ^~~~~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
     159 | #define EXPORT_SYMBOL_GPL(sym)  _EXPORT_SYMBOL(sym, "_gpl")
         |                                 ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1187:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    1187 | EXPORT_SYMBOL_GPL(sysrq_toggle_support);
         | ^~~~~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1191:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    1191 | {
         | ^
   drivers/tty/sysrq.c:1214:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    1214 | {
         | ^
   In file included from include/linux/linkage.h:7,
                    from include/linux/kernel.h:8,
                    from include/linux/list.h:9,
                    from include/linux/rculist.h:10,
                    from include/linux/sched/signal.h:5,
                    from drivers/tty/sysrq.c:18:
>> drivers/tty/sysrq.c:1217:15: error: storage class specified for parameter 'register_sysrq_key'
    1217 | EXPORT_SYMBOL(register_sysrq_key);
         |               ^~~~~~~~~~~~~~~~~~
   include/linux/export.h:98:21: note: in definition of macro '___EXPORT_SYMBOL'
      98 |  extern typeof(sym) sym;       \
         |                     ^~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1217:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1217 | EXPORT_SYMBOL(register_sysrq_key);
         | ^~~~~~~~~~~~~
>> include/linux/export.h:99:20: error: storage class specified for parameter '__kstrtab_register_sysrq_key'
      99 |  extern const char __kstrtab_##sym[];     \
         |                    ^~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1217:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1217 | EXPORT_SYMBOL(register_sysrq_key);
         | ^~~~~~~~~~~~~
>> include/linux/export.h:100:20: error: storage class specified for parameter '__kstrtabns_register_sysrq_key'
     100 |  extern const char __kstrtabns_##sym[];     \
         |                    ^~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1217:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1217 | EXPORT_SYMBOL(register_sysrq_key);
         | ^~~~~~~~~~~~~
>> include/linux/export.h:101:24: error: expected declaration specifiers before ';' token
     101 |  __CRC_SYMBOL(sym, sec);       \
         |                        ^
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1217:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1217 | EXPORT_SYMBOL(register_sysrq_key);
         | ^~~~~~~~~~~~~
>> include/linux/export.h:102:2: error: expected declaration specifiers before 'asm'
     102 |  asm(" .section \"__ksymtab_strings\",\"aMS\",%progbits,1 \n" \
         |  ^~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1217:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1217 | EXPORT_SYMBOL(register_sysrq_key);
         | ^~~~~~~~~~~~~
   include/linux/export.h:67:36: error: storage class specified for parameter '__ksymtab_register_sysrq_key'
      67 |  static const struct kernel_symbol __ksymtab_##sym  \
         |                                    ^~~~~~~~~~
   include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
     108 |  __KSYMTAB_ENTRY(sym, sec)
         |  ^~~~~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1217:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1217 | EXPORT_SYMBOL(register_sysrq_key);
         | ^~~~~~~~~~~~~
>> include/linux/export.h:67:22: error: parameter '__ksymtab_register_sysrq_key' is initialized
      67 |  static const struct kernel_symbol __ksymtab_##sym  \
         |                      ^~~~~~~~~~~~~
   include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
     108 |  __KSYMTAB_ENTRY(sym, sec)
         |  ^~~~~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1217:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1217 | EXPORT_SYMBOL(register_sysrq_key);
         | ^~~~~~~~~~~~~
>> include/linux/export.h:67:36: error: section attribute not allowed for '__ksymtab_register_sysrq_key'
      67 |  static const struct kernel_symbol __ksymtab_##sym  \
         |                                    ^~~~~~~~~~
   include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
     108 |  __KSYMTAB_ENTRY(sym, sec)
         |  ^~~~~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1217:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1217 | EXPORT_SYMBOL(register_sysrq_key);
         | ^~~~~~~~~~~~~
>> include/linux/export.h:67:22: warning: 'used' attribute ignored [-Wattributes]
      67 |  static const struct kernel_symbol __ksymtab_##sym  \
         |                      ^~~~~~~~~~~~~
   include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
     108 |  __KSYMTAB_ENTRY(sym, sec)
         |  ^~~~~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1217:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1217 | EXPORT_SYMBOL(register_sysrq_key);
         | ^~~~~~~~~~~~~
>> include/linux/export.h:67:36: error: alignment may not be specified for '__ksymtab_register_sysrq_key'
      67 |  static const struct kernel_symbol __ksymtab_##sym  \
         |                                    ^~~~~~~~~~
   include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
     108 |  __KSYMTAB_ENTRY(sym, sec)
         |  ^~~~~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1217:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1217 | EXPORT_SYMBOL(register_sysrq_key);
         | ^~~~~~~~~~~~~
   drivers/tty/sysrq.c:1220:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    1220 | {
         | ^
   In file included from include/linux/linkage.h:7,
                    from include/linux/kernel.h:8,
                    from include/linux/list.h:9,
                    from include/linux/rculist.h:10,
                    from include/linux/sched/signal.h:5,
                    from drivers/tty/sysrq.c:18:
   drivers/tty/sysrq.c:1223:15: error: storage class specified for parameter 'unregister_sysrq_key'
    1223 | EXPORT_SYMBOL(unregister_sysrq_key);
         |               ^~~~~~~~~~~~~~~~~~~~
   include/linux/export.h:98:21: note: in definition of macro '___EXPORT_SYMBOL'
      98 |  extern typeof(sym) sym;       \
         |                     ^~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1223:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1223 | EXPORT_SYMBOL(unregister_sysrq_key);
         | ^~~~~~~~~~~~~
   include/linux/export.h:99:20: error: storage class specified for parameter '__kstrtab_unregister_sysrq_key'
      99 |  extern const char __kstrtab_##sym[];     \
         |                    ^~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1223:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1223 | EXPORT_SYMBOL(unregister_sysrq_key);
         | ^~~~~~~~~~~~~
   include/linux/export.h:100:20: error: storage class specified for parameter '__kstrtabns_unregister_sysrq_key'
     100 |  extern const char __kstrtabns_##sym[];     \
         |                    ^~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1223:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1223 | EXPORT_SYMBOL(unregister_sysrq_key);
         | ^~~~~~~~~~~~~
   include/linux/export.h:101:24: error: expected declaration specifiers before ';' token
     101 |  __CRC_SYMBOL(sym, sec);       \
         |                        ^
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1223:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1223 | EXPORT_SYMBOL(unregister_sysrq_key);
         | ^~~~~~~~~~~~~
   include/linux/export.h:102:2: error: expected declaration specifiers before 'asm'
     102 |  asm(" .section \"__ksymtab_strings\",\"aMS\",%progbits,1 \n" \
         |  ^~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1223:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1223 | EXPORT_SYMBOL(unregister_sysrq_key);

# https://github.com/0day-ci/linux/commit/1e30be974437c14ffdccaf1af02f5b6911ec1468
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andrzej-Pietrasiewicz/Add-configurable-handler-to-execute-a-compound-action/20200817-212944
git checkout 1e30be974437c14ffdccaf1af02f5b6911ec1468
vim +1158 drivers/tty/sysrq.c

  1157	
> 1158	{
  1159	}
  1160	
> 1161	static void sysrq_action_compound(int key)
  1162	static inline void sysrq_register_handler(void)
> 1163	{
  1164	}
  1165	
  1166	static inline void sysrq_unregister_handler(void)
  1167	{
  1168	}
  1169	
  1170	#endif /* CONFIG_INPUT */
  1171	
  1172	int sysrq_toggle_support(int enable_mask)
  1173	{
  1174		bool was_enabled = sysrq_on();
  1175	
  1176		sysrq_enabled = enable_mask;
  1177	
  1178		if (was_enabled != sysrq_on()) {
  1179			if (sysrq_on())
  1180				sysrq_register_handler();
  1181			else
  1182				sysrq_unregister_handler();
  1183		}
  1184	
  1185		return 0;
  1186	}
> 1187	EXPORT_SYMBOL_GPL(sysrq_toggle_support);
  1188	
  1189	static int __sysrq_swap_key_ops(int key, const struct sysrq_key_op *insert_op_p,
  1190	                                const struct sysrq_key_op *remove_op_p)
  1191	{
  1192		int retval;
  1193	
  1194		spin_lock(&sysrq_key_table_lock);
  1195		if (__sysrq_get_key_op(key) == remove_op_p) {
  1196			__sysrq_put_key_op(key, insert_op_p);
  1197			retval = 0;
  1198		} else {
  1199			retval = -1;
  1200		}
  1201		spin_unlock(&sysrq_key_table_lock);
  1202	
  1203		/*
  1204		 * A concurrent __handle_sysrq either got the old op or the new op.
  1205		 * Wait for it to go away before returning, so the code for an old
  1206		 * op is not freed (eg. on module unload) while it is in use.
  1207		 */
  1208		synchronize_rcu();
  1209	
  1210		return retval;
  1211	}
  1212	
  1213	int register_sysrq_key(int key, const struct sysrq_key_op *op_p)
  1214	{
  1215		return __sysrq_swap_key_ops(key, op_p, NULL);
  1216	}
> 1217	EXPORT_SYMBOL(register_sysrq_key);
  1218	
  1219	int unregister_sysrq_key(int key, const struct sysrq_key_op *op_p)
  1220	{
  1221		return __sysrq_swap_key_ops(key, NULL, op_p);
  1222	}
> 1223	EXPORT_SYMBOL(unregister_sysrq_key);
  1224	
  1225	#ifdef CONFIG_PROC_FS
  1226	/*
  1227	 * writing 'C' to /proc/sysrq-trigger is like sysrq-C
  1228	 */
  1229	static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
  1230					   size_t count, loff_t *ppos)
  1231	{
  1232		if (count) {
  1233			char c;
  1234	
  1235			if (get_user(c, buf))
  1236				return -EFAULT;
  1237			__handle_sysrq(c, false);
  1238		}
  1239	
  1240		return count;
  1241	}
  1242	
> 1243	static const struct proc_ops sysrq_trigger_proc_ops = {
> 1244		.proc_write	= write_sysrq_trigger,
  1245		.proc_lseek	= noop_llseek,
  1246	};
  1247	
  1248	static void sysrq_init_procfs(void)
  1249	{
  1250		if (!proc_create("sysrq-trigger", S_IWUSR, NULL,
  1251				 &sysrq_trigger_proc_ops))
  1252			pr_err("Failed to register proc interface\n");
  1253	}
  1254	
  1255	#else
  1256	
  1257	static inline void sysrq_init_procfs(void)
  1258	{
  1259	}
  1260	
  1261	#endif /* CONFIG_PROC_FS */
  1262	
  1263	static int __init sysrq_init(void)
  1264	{
  1265		sysrq_init_procfs();
  1266	
  1267		if (sysrq_on())
  1268			sysrq_register_handler();
  1269	
  1270		return 0;
  1271	}
> 1272	device_initcall(sysrq_init);

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 10791 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/2] tty/sysrq: Add configurable handler to execute a compound action
@ 2020-08-17 20:09     ` kernel test robot
  0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2020-08-17 20:09 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 33013 bytes --]

Hi Andrzej,

I love your patch! Yet something to improve:

[auto build test ERROR on 9123e3a74ec7b934a4a099e98af6a61c2f80bbf5]

url:    https://github.com/0day-ci/linux/commits/Andrzej-Pietrasiewicz/Add-configurable-handler-to-execute-a-compound-action/20200817-212944
base:    9123e3a74ec7b934a4a099e98af6a61c2f80bbf5
config: powerpc-tqm8xx_defconfig (attached as .config)
compiler: powerpc-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

>> drivers/tty/sysrq.c:1158:1: error: expected identifier or '(' before '{' token
    1158 | {
         | ^
   drivers/tty/sysrq.c: In function 'sysrq_action_compound':
>> drivers/tty/sysrq.c:1163:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    1163 | {
         | ^
   drivers/tty/sysrq.c:1167:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    1167 | {
         | ^
   drivers/tty/sysrq.c:1173:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    1173 | {
         | ^
   In file included from include/linux/linkage.h:7,
                    from include/linux/kernel.h:8,
                    from include/linux/list.h:9,
                    from include/linux/rculist.h:10,
                    from include/linux/sched/signal.h:5,
                    from drivers/tty/sysrq.c:18:
>> drivers/tty/sysrq.c:1187:19: error: storage class specified for parameter 'sysrq_toggle_support'
    1187 | EXPORT_SYMBOL_GPL(sysrq_toggle_support);
         |                   ^~~~~~~~~~~~~~~~~~~~
   include/linux/export.h:98:21: note: in definition of macro '___EXPORT_SYMBOL'
      98 |  extern typeof(sym) sym;       \
         |                     ^~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
     159 | #define EXPORT_SYMBOL_GPL(sym)  _EXPORT_SYMBOL(sym, "_gpl")
         |                                 ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1187:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    1187 | EXPORT_SYMBOL_GPL(sysrq_toggle_support);
         | ^~~~~~~~~~~~~~~~~
>> include/linux/export.h:99:20: error: storage class specified for parameter '__kstrtab_sysrq_toggle_support'
      99 |  extern const char __kstrtab_##sym[];     \
         |                    ^~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
     159 | #define EXPORT_SYMBOL_GPL(sym)  _EXPORT_SYMBOL(sym, "_gpl")
         |                                 ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1187:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    1187 | EXPORT_SYMBOL_GPL(sysrq_toggle_support);
         | ^~~~~~~~~~~~~~~~~
>> include/linux/export.h:100:20: error: storage class specified for parameter '__kstrtabns_sysrq_toggle_support'
     100 |  extern const char __kstrtabns_##sym[];     \
         |                    ^~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
     159 | #define EXPORT_SYMBOL_GPL(sym)  _EXPORT_SYMBOL(sym, "_gpl")
         |                                 ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1187:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    1187 | EXPORT_SYMBOL_GPL(sysrq_toggle_support);
         | ^~~~~~~~~~~~~~~~~
>> include/linux/export.h:101:24: error: expected declaration specifiers before ';' token
     101 |  __CRC_SYMBOL(sym, sec);       \
         |                        ^
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
     159 | #define EXPORT_SYMBOL_GPL(sym)  _EXPORT_SYMBOL(sym, "_gpl")
         |                                 ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1187:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    1187 | EXPORT_SYMBOL_GPL(sysrq_toggle_support);
         | ^~~~~~~~~~~~~~~~~
>> include/linux/export.h:102:2: error: expected declaration specifiers before 'asm'
     102 |  asm(" .section \"__ksymtab_strings\",\"aMS\",%progbits,1 \n" \
         |  ^~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
     159 | #define EXPORT_SYMBOL_GPL(sym)  _EXPORT_SYMBOL(sym, "_gpl")
         |                                 ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1187:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    1187 | EXPORT_SYMBOL_GPL(sysrq_toggle_support);
         | ^~~~~~~~~~~~~~~~~
   include/linux/export.h:67:36: error: storage class specified for parameter '__ksymtab_sysrq_toggle_support'
      67 |  static const struct kernel_symbol __ksymtab_##sym  \
         |                                    ^~~~~~~~~~
   include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
     108 |  __KSYMTAB_ENTRY(sym, sec)
         |  ^~~~~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
     159 | #define EXPORT_SYMBOL_GPL(sym)  _EXPORT_SYMBOL(sym, "_gpl")
         |                                 ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1187:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    1187 | EXPORT_SYMBOL_GPL(sysrq_toggle_support);
         | ^~~~~~~~~~~~~~~~~
>> include/linux/export.h:67:22: error: parameter '__ksymtab_sysrq_toggle_support' is initialized
      67 |  static const struct kernel_symbol __ksymtab_##sym  \
         |                      ^~~~~~~~~~~~~
   include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
     108 |  __KSYMTAB_ENTRY(sym, sec)
         |  ^~~~~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
     159 | #define EXPORT_SYMBOL_GPL(sym)  _EXPORT_SYMBOL(sym, "_gpl")
         |                                 ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1187:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    1187 | EXPORT_SYMBOL_GPL(sysrq_toggle_support);
         | ^~~~~~~~~~~~~~~~~
>> include/linux/export.h:67:36: error: section attribute not allowed for '__ksymtab_sysrq_toggle_support'
      67 |  static const struct kernel_symbol __ksymtab_##sym  \
         |                                    ^~~~~~~~~~
   include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
     108 |  __KSYMTAB_ENTRY(sym, sec)
         |  ^~~~~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
     159 | #define EXPORT_SYMBOL_GPL(sym)  _EXPORT_SYMBOL(sym, "_gpl")
         |                                 ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1187:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    1187 | EXPORT_SYMBOL_GPL(sysrq_toggle_support);
         | ^~~~~~~~~~~~~~~~~
>> include/linux/export.h:67:22: warning: 'used' attribute ignored [-Wattributes]
      67 |  static const struct kernel_symbol __ksymtab_##sym  \
         |                      ^~~~~~~~~~~~~
   include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
     108 |  __KSYMTAB_ENTRY(sym, sec)
         |  ^~~~~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
     159 | #define EXPORT_SYMBOL_GPL(sym)  _EXPORT_SYMBOL(sym, "_gpl")
         |                                 ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1187:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    1187 | EXPORT_SYMBOL_GPL(sysrq_toggle_support);
         | ^~~~~~~~~~~~~~~~~
>> include/linux/export.h:67:36: error: alignment may not be specified for '__ksymtab_sysrq_toggle_support'
      67 |  static const struct kernel_symbol __ksymtab_##sym  \
         |                                    ^~~~~~~~~~
   include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
     108 |  __KSYMTAB_ENTRY(sym, sec)
         |  ^~~~~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL'
     159 | #define EXPORT_SYMBOL_GPL(sym)  _EXPORT_SYMBOL(sym, "_gpl")
         |                                 ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1187:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    1187 | EXPORT_SYMBOL_GPL(sysrq_toggle_support);
         | ^~~~~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1191:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    1191 | {
         | ^
   drivers/tty/sysrq.c:1214:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    1214 | {
         | ^
   In file included from include/linux/linkage.h:7,
                    from include/linux/kernel.h:8,
                    from include/linux/list.h:9,
                    from include/linux/rculist.h:10,
                    from include/linux/sched/signal.h:5,
                    from drivers/tty/sysrq.c:18:
>> drivers/tty/sysrq.c:1217:15: error: storage class specified for parameter 'register_sysrq_key'
    1217 | EXPORT_SYMBOL(register_sysrq_key);
         |               ^~~~~~~~~~~~~~~~~~
   include/linux/export.h:98:21: note: in definition of macro '___EXPORT_SYMBOL'
      98 |  extern typeof(sym) sym;       \
         |                     ^~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1217:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1217 | EXPORT_SYMBOL(register_sysrq_key);
         | ^~~~~~~~~~~~~
>> include/linux/export.h:99:20: error: storage class specified for parameter '__kstrtab_register_sysrq_key'
      99 |  extern const char __kstrtab_##sym[];     \
         |                    ^~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1217:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1217 | EXPORT_SYMBOL(register_sysrq_key);
         | ^~~~~~~~~~~~~
>> include/linux/export.h:100:20: error: storage class specified for parameter '__kstrtabns_register_sysrq_key'
     100 |  extern const char __kstrtabns_##sym[];     \
         |                    ^~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1217:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1217 | EXPORT_SYMBOL(register_sysrq_key);
         | ^~~~~~~~~~~~~
>> include/linux/export.h:101:24: error: expected declaration specifiers before ';' token
     101 |  __CRC_SYMBOL(sym, sec);       \
         |                        ^
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1217:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1217 | EXPORT_SYMBOL(register_sysrq_key);
         | ^~~~~~~~~~~~~
>> include/linux/export.h:102:2: error: expected declaration specifiers before 'asm'
     102 |  asm(" .section \"__ksymtab_strings\",\"aMS\",%progbits,1 \n" \
         |  ^~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1217:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1217 | EXPORT_SYMBOL(register_sysrq_key);
         | ^~~~~~~~~~~~~
   include/linux/export.h:67:36: error: storage class specified for parameter '__ksymtab_register_sysrq_key'
      67 |  static const struct kernel_symbol __ksymtab_##sym  \
         |                                    ^~~~~~~~~~
   include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
     108 |  __KSYMTAB_ENTRY(sym, sec)
         |  ^~~~~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1217:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1217 | EXPORT_SYMBOL(register_sysrq_key);
         | ^~~~~~~~~~~~~
>> include/linux/export.h:67:22: error: parameter '__ksymtab_register_sysrq_key' is initialized
      67 |  static const struct kernel_symbol __ksymtab_##sym  \
         |                      ^~~~~~~~~~~~~
   include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
     108 |  __KSYMTAB_ENTRY(sym, sec)
         |  ^~~~~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1217:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1217 | EXPORT_SYMBOL(register_sysrq_key);
         | ^~~~~~~~~~~~~
>> include/linux/export.h:67:36: error: section attribute not allowed for '__ksymtab_register_sysrq_key'
      67 |  static const struct kernel_symbol __ksymtab_##sym  \
         |                                    ^~~~~~~~~~
   include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
     108 |  __KSYMTAB_ENTRY(sym, sec)
         |  ^~~~~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1217:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1217 | EXPORT_SYMBOL(register_sysrq_key);
         | ^~~~~~~~~~~~~
>> include/linux/export.h:67:22: warning: 'used' attribute ignored [-Wattributes]
      67 |  static const struct kernel_symbol __ksymtab_##sym  \
         |                      ^~~~~~~~~~~~~
   include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
     108 |  __KSYMTAB_ENTRY(sym, sec)
         |  ^~~~~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1217:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1217 | EXPORT_SYMBOL(register_sysrq_key);
         | ^~~~~~~~~~~~~
>> include/linux/export.h:67:36: error: alignment may not be specified for '__ksymtab_register_sysrq_key'
      67 |  static const struct kernel_symbol __ksymtab_##sym  \
         |                                    ^~~~~~~~~~
   include/linux/export.h:108:2: note: in expansion of macro '__KSYMTAB_ENTRY'
     108 |  __KSYMTAB_ENTRY(sym, sec)
         |  ^~~~~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1217:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1217 | EXPORT_SYMBOL(register_sysrq_key);
         | ^~~~~~~~~~~~~
   drivers/tty/sysrq.c:1220:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    1220 | {
         | ^
   In file included from include/linux/linkage.h:7,
                    from include/linux/kernel.h:8,
                    from include/linux/list.h:9,
                    from include/linux/rculist.h:10,
                    from include/linux/sched/signal.h:5,
                    from drivers/tty/sysrq.c:18:
   drivers/tty/sysrq.c:1223:15: error: storage class specified for parameter 'unregister_sysrq_key'
    1223 | EXPORT_SYMBOL(unregister_sysrq_key);
         |               ^~~~~~~~~~~~~~~~~~~~
   include/linux/export.h:98:21: note: in definition of macro '___EXPORT_SYMBOL'
      98 |  extern typeof(sym) sym;       \
         |                     ^~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1223:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1223 | EXPORT_SYMBOL(unregister_sysrq_key);
         | ^~~~~~~~~~~~~
   include/linux/export.h:99:20: error: storage class specified for parameter '__kstrtab_unregister_sysrq_key'
      99 |  extern const char __kstrtab_##sym[];     \
         |                    ^~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1223:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1223 | EXPORT_SYMBOL(unregister_sysrq_key);
         | ^~~~~~~~~~~~~
   include/linux/export.h:100:20: error: storage class specified for parameter '__kstrtabns_unregister_sysrq_key'
     100 |  extern const char __kstrtabns_##sym[];     \
         |                    ^~~~~~~~~~~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1223:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1223 | EXPORT_SYMBOL(unregister_sysrq_key);
         | ^~~~~~~~~~~~~
   include/linux/export.h:101:24: error: expected declaration specifiers before ';' token
     101 |  __CRC_SYMBOL(sym, sec);       \
         |                        ^
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1223:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1223 | EXPORT_SYMBOL(unregister_sysrq_key);
         | ^~~~~~~~~~~~~
   include/linux/export.h:102:2: error: expected declaration specifiers before 'asm'
     102 |  asm(" .section \"__ksymtab_strings\",\"aMS\",%progbits,1 \n" \
         |  ^~~
   include/linux/export.h:147:39: note: in expansion of macro '___EXPORT_SYMBOL'
     147 | #define __EXPORT_SYMBOL(sym, sec, ns) ___EXPORT_SYMBOL(sym, sec, ns)
         |                                       ^~~~~~~~~~~~~~~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
     155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
         |                                  ^~~~~~~~~~~~~~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
     158 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
         |                             ^~~~~~~~~~~~~~
   drivers/tty/sysrq.c:1223:1: note: in expansion of macro 'EXPORT_SYMBOL'
    1223 | EXPORT_SYMBOL(unregister_sysrq_key);

# https://github.com/0day-ci/linux/commit/1e30be974437c14ffdccaf1af02f5b6911ec1468
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andrzej-Pietrasiewicz/Add-configurable-handler-to-execute-a-compound-action/20200817-212944
git checkout 1e30be974437c14ffdccaf1af02f5b6911ec1468
vim +1158 drivers/tty/sysrq.c

  1157	
> 1158	{
  1159	}
  1160	
> 1161	static void sysrq_action_compound(int key)
  1162	static inline void sysrq_register_handler(void)
> 1163	{
  1164	}
  1165	
  1166	static inline void sysrq_unregister_handler(void)
  1167	{
  1168	}
  1169	
  1170	#endif /* CONFIG_INPUT */
  1171	
  1172	int sysrq_toggle_support(int enable_mask)
  1173	{
  1174		bool was_enabled = sysrq_on();
  1175	
  1176		sysrq_enabled = enable_mask;
  1177	
  1178		if (was_enabled != sysrq_on()) {
  1179			if (sysrq_on())
  1180				sysrq_register_handler();
  1181			else
  1182				sysrq_unregister_handler();
  1183		}
  1184	
  1185		return 0;
  1186	}
> 1187	EXPORT_SYMBOL_GPL(sysrq_toggle_support);
  1188	
  1189	static int __sysrq_swap_key_ops(int key, const struct sysrq_key_op *insert_op_p,
  1190	                                const struct sysrq_key_op *remove_op_p)
  1191	{
  1192		int retval;
  1193	
  1194		spin_lock(&sysrq_key_table_lock);
  1195		if (__sysrq_get_key_op(key) == remove_op_p) {
  1196			__sysrq_put_key_op(key, insert_op_p);
  1197			retval = 0;
  1198		} else {
  1199			retval = -1;
  1200		}
  1201		spin_unlock(&sysrq_key_table_lock);
  1202	
  1203		/*
  1204		 * A concurrent __handle_sysrq either got the old op or the new op.
  1205		 * Wait for it to go away before returning, so the code for an old
  1206		 * op is not freed (eg. on module unload) while it is in use.
  1207		 */
  1208		synchronize_rcu();
  1209	
  1210		return retval;
  1211	}
  1212	
  1213	int register_sysrq_key(int key, const struct sysrq_key_op *op_p)
  1214	{
  1215		return __sysrq_swap_key_ops(key, op_p, NULL);
  1216	}
> 1217	EXPORT_SYMBOL(register_sysrq_key);
  1218	
  1219	int unregister_sysrq_key(int key, const struct sysrq_key_op *op_p)
  1220	{
  1221		return __sysrq_swap_key_ops(key, NULL, op_p);
  1222	}
> 1223	EXPORT_SYMBOL(unregister_sysrq_key);
  1224	
  1225	#ifdef CONFIG_PROC_FS
  1226	/*
  1227	 * writing 'C' to /proc/sysrq-trigger is like sysrq-C
  1228	 */
  1229	static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
  1230					   size_t count, loff_t *ppos)
  1231	{
  1232		if (count) {
  1233			char c;
  1234	
  1235			if (get_user(c, buf))
  1236				return -EFAULT;
  1237			__handle_sysrq(c, false);
  1238		}
  1239	
  1240		return count;
  1241	}
  1242	
> 1243	static const struct proc_ops sysrq_trigger_proc_ops = {
> 1244		.proc_write	= write_sysrq_trigger,
  1245		.proc_lseek	= noop_llseek,
  1246	};
  1247	
  1248	static void sysrq_init_procfs(void)
  1249	{
  1250		if (!proc_create("sysrq-trigger", S_IWUSR, NULL,
  1251				 &sysrq_trigger_proc_ops))
  1252			pr_err("Failed to register proc interface\n");
  1253	}
  1254	
  1255	#else
  1256	
  1257	static inline void sysrq_init_procfs(void)
  1258	{
  1259	}
  1260	
  1261	#endif /* CONFIG_PROC_FS */
  1262	
  1263	static int __init sysrq_init(void)
  1264	{
  1265		sysrq_init_procfs();
  1266	
  1267		if (sysrq_on())
  1268			sysrq_register_handler();
  1269	
  1270		return 0;
  1271	}
> 1272	device_initcall(sysrq_init);

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 10791 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/2] tty/sysrq: Add configurable handler to execute a compound action
  2020-08-17 20:09     ` kernel test robot
@ 2020-08-18 11:29       ` Andrzej Pietrasiewicz
  -1 siblings, 0 replies; 10+ messages in thread
From: Andrzej Pietrasiewicz @ 2020-08-18 11:29 UTC (permalink / raw)
  To: kernel test robot, linux-kernel
  Cc: kbuild-all, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Daniel Vetter, Greg Kroah-Hartman, Jiri Slaby,
	Dmitry Torokhov

W dniu 17.08.2020 o 22:09, kernel test robot pisze:
> Hi Andrzej,
> 
> I love your patch! Yet something to improve:
> 
> [auto build test ERROR on 9123e3a74ec7b934a4a099e98af6a61c2f80bbf5]
> 
> url:    https://github.com/0day-ci/linux/commits/Andrzej-Pietrasiewicz/Add-configurable-handler-to-execute-a-compound-action/20200817-212944
> base:    9123e3a74ec7b934a4a099e98af6a61c2f80bbf5
> config: powerpc-tqm8xx_defconfig (attached as .config)
> compiler: powerpc-linux-gcc (GCC) 9.3.0
> reproduce (this is a W=1 build):
>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # save the attached .config to linux build tree
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All error/warnings (new ones prefixed by >>):
> 
>>> drivers/tty/sysrq.c:1158:1: error: expected identifier or '(' before '{' token

Corrected in v3.

Andrzej

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/2] tty/sysrq: Add configurable handler to execute a compound action
@ 2020-08-18 11:29       ` Andrzej Pietrasiewicz
  0 siblings, 0 replies; 10+ messages in thread
From: Andrzej Pietrasiewicz @ 2020-08-18 11:29 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1119 bytes --]

W dniu 17.08.2020 o 22:09, kernel test robot pisze:
> Hi Andrzej,
> 
> I love your patch! Yet something to improve:
> 
> [auto build test ERROR on 9123e3a74ec7b934a4a099e98af6a61c2f80bbf5]
> 
> url:    https://github.com/0day-ci/linux/commits/Andrzej-Pietrasiewicz/Add-configurable-handler-to-execute-a-compound-action/20200817-212944
> base:    9123e3a74ec7b934a4a099e98af6a61c2f80bbf5
> config: powerpc-tqm8xx_defconfig (attached as .config)
> compiler: powerpc-linux-gcc (GCC) 9.3.0
> reproduce (this is a W=1 build):
>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # save the attached .config to linux build tree
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All error/warnings (new ones prefixed by >>):
> 
>>> drivers/tty/sysrq.c:1158:1: error: expected identifier or '(' before '{' token

Corrected in v3.

Andrzej

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-08-18 11:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-17 13:27 [PATCH v2 0/2] Add configurable handler to execute a compound action Andrzej Pietrasiewicz
2020-08-17 13:27 ` Andrzej Pietrasiewicz
2020-08-17 13:27 ` [PATCH v2 1/2] tty/sysrq: Extend the sysrq_key_table to cover capital letters Andrzej Pietrasiewicz
2020-08-17 13:27   ` Andrzej Pietrasiewicz
2020-08-17 13:27 ` [PATCH v2 2/2] tty/sysrq: Add configurable handler to execute a compound action Andrzej Pietrasiewicz
2020-08-17 13:27   ` Andrzej Pietrasiewicz
2020-08-17 20:09   ` kernel test robot
2020-08-17 20:09     ` kernel test robot
2020-08-18 11:29     ` Andrzej Pietrasiewicz
2020-08-18 11:29       ` Andrzej Pietrasiewicz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.