Skip to contentSkip to conversation

sysrq is half-enabled by default V2

PATCH In review Andy Whitcroft 3 participants 4 messages Jan 24, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover sysrq is half-enabled by default V2

It seems that recent cleanups to sysrq handling have lead to us having two copies of the sysrq enable status. At boot these are currently inconsistently specified leading to sysrq actually being enabled but reported as not enabled in sysfs. Following this email is a patch to link both of these copies to a common header define to prevent them becoming out of sync again.

-apw

Andy Whitcroft (1):
Input: sysrq -- ensure sysrq_enabled and __sysrq_enabled are
consistent

 drivers/tty/sysrq.c   |    2 +-
 include/linux/sysrq.h |    3 +++
 kernel/sysctl.c       |    3 ++-
 3 files changed, 6 insertions(+), 2 deletions(-)
#1 lore raw

PATCH 1/1 Input: sysrq -- ensure sysrq_enabled and __sysrq_enabled are consistent

Currently sysrq_enabled and __sysrq_enabled are initialised separatly and inconsitantly, leading to sysrq being actually enabled by reported as not enabled in sysfs. The first change to the sysfs configurable synchronises these two:

    static int __read_mostly sysrq_enabled = 1;
    static int __sysrq_enabled;

Add a common define to carry the default for these preventing them becoming out of sync again. Default this to 1 to mirror previous behaviour.

---
 drivers/tty/sysrq.c   |    2 +-
 include/linux/sysrq.h |    3 +++
 kernel/sysctl.c       |    3 ++-
 3 files changed, 6 insertions(+), 2 deletions(-)
drivers/tty/sysrq.c +1 -1
index c556ed9..8e0dd25 100644
@@ -46,7 +46,7 @@
 #include <asm/irq_regs.h>
 
 /* Whether we react on sysrq keys or just ignore them */
-static int __read_mostly sysrq_enabled = 1;
+static int __read_mostly sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
 static bool __read_mostly sysrq_always_enabled;
 
 static bool sysrq_on(void)
include/linux/sysrq.h +3 -0
index 387fa7d..7faf933 100644
@@ -17,6 +17,9 @@
 #include <linux/errno.h>
 #include <linux/types.h>
 
+/* Enable/disable SYSRQ support by default (0==no, 1==yes). */
+#define SYSRQ_DEFAULT_ENABLE	1
+
 /* Possible values of bitmask for enabling sysrq functions */
 /* 0x0001 is reserved for enable everything */
 #define SYSRQ_ENABLE_LOG	0x0002
kernel/sysctl.c +2 -1
index bc86bb3..0f1bd83 100644
@@ -170,7 +170,8 @@ static int proc_taint(struct ctl_table *table, int write,
 #endif
 
 #ifdef CONFIG_MAGIC_SYSRQ
-static int __sysrq_enabled; /* Note: sysrq code ises it's own private copy */
+/* Note: sysrq code uses it's own private copy */
+static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
 
 static int sysrq_sysctl_handler(ctl_table *table, int write,
 				void __user *buffer, size_t *lenp,
Signature · 1 line
1.7.1
#2 lore raw

Re: [PATCH 1/1] Input: sysrq -- ensure sysrq_enabled and __sysrq_enabled are consistent

Quoted 50 lines · On Mon, 24 Jan 2011 14:06:12 +0000 Andy Whitcroft wrote:

Currently sysrq_enabled and __sysrq_enabled are initialised separatly and inconsitantly, leading to sysrq being actually enabled by reported as not enabled in sysfs. The first change to the sysfs configurable synchronises these two:

    static int __read_mostly sysrq_enabled = 1;
    static int __sysrq_enabled;

Add a common define to carry the default for these preventing them becoming out of sync again. Default this to 1 to mirror previous behaviour.

---
 drivers/tty/sysrq.c   |    2 +-
 include/linux/sysrq.h |    3 +++
 kernel/sysctl.c       |    3 ++-
 3 files changed, 6 insertions(+), 2 deletions(-)
drivers/tty/sysrq.c +1 -1
index c556ed9..8e0dd25 100644
@@ -46,7 +46,7 @@
 #include <asm/irq_regs.h>
 
 /* Whether we react on sysrq keys or just ignore them */
-static int __read_mostly sysrq_enabled = 1;
+static int __read_mostly sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
 static bool __read_mostly sysrq_always_enabled;
 
 static bool sysrq_on(void)
include/linux/sysrq.h +3 -0
index 387fa7d..7faf933 100644
@@ -17,6 +17,9 @@
 #include <linux/errno.h>
 #include <linux/types.h>
 
+/* Enable/disable SYSRQ support by default (0==no, 1==yes). */
+#define SYSRQ_DEFAULT_ENABLE	1
+
 /* Possible values of bitmask for enabling sysrq functions */
 /* 0x0001 is reserved for enable everything */
 #define SYSRQ_ENABLE_LOG	0x0002
kernel/sysctl.c +0 -0
index bc86bb3..0f1bd83 100644

kernel/sysctl.c static int proc_taint(struct ctl_table *table, int write, · line 173

Quoted 5 lines
kernel/sysctl.c +1 -1
@@ -170,7 +170,8 @@ static int proc_taint(struct ctl_table *table, int write,
 #endif
 
 #ifdef CONFIG_MAGIC_SYSRQ
-static int __sysrq_enabled; /* Note: sysrq code ises it's own private copy */
+/* Note: sysrq code uses it's own private copy */

its

Meta-comment: There's no good reason to have patch 0/1. Just put all of the patch description in patch 1/1.

kernel/sysctl.c static int proc_taint(struct ctl_table *table, int write, · line 177

Quoted 5 lines
kernel/sysctl.c +1 -0
+static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
 
 static int sysrq_sysctl_handler(ctl_table *table, int write,
 				void __user *buffer, size_t *lenp,

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

#3 lore raw

Re: [PATCH 1/1] Input: sysrq -- ensure sysrq_enabled and __sysrq_enabled are consistent

In reply to Andy Whitcroft
Quoted 5 lines · Andy Whitcroft

Currently sysrq_enabled and __sysrq_enabled are initialised separatly and inconsitantly, leading to sysrq being actually enabled by reported as not enabled in sysfs. The first change to the sysfs configurable synchronises these two:

Quoted 7 lines
    static int __read_mostly sysrq_enabled = 1;
    static int __sysrq_enabled;

Add a common define to carry the default for these preventing them becoming out of sync again. Default this to 1 to mirror previous behaviour.

Applied and will also tag for stable. Thank you Andy.

Signature · 1 line
Dmitry