[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] keyhandler: Do not serialise keyhandlers; increase scratch array size.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1265966517 0
# Node ID a4ddf47a1e912d18f982fded29539a69e9ac1b0c
# Parent  27f5ff8c0aa09695285fd9846aa67ccfda238f8b
keyhandler: Do not serialise keyhandlers; increase scratch array size.

Although serialising keyhandlers is safer, and in particular
protects access to shared heyhandler_scratch[], in debug scenarios it
is probably better to 'have a go' when requested - and assume the user
knows what they are doing.

Meanwhile, increase scratch array size to 1024. That's enough for more
than a dozen lines of 80-column text, and should be plenty in any
practical situation.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/common/keyhandler.c      |   12 +-----------
 xen/include/xen/keyhandler.h |    2 +-
 2 files changed, 2 insertions(+), 12 deletions(-)

diff -r 27f5ff8c0aa0 -r a4ddf47a1e91 xen/common/keyhandler.c
--- a/xen/common/keyhandler.c   Fri Feb 12 09:16:10 2010 +0000
+++ b/xen/common/keyhandler.c   Fri Feb 12 09:21:57 2010 +0000
@@ -20,7 +20,7 @@ static struct keyhandler *key_table[256]
 static struct keyhandler *key_table[256];
 static unsigned char keypress_key;
 
-char keyhandler_scratch[100];
+char keyhandler_scratch[1024];
 
 static void keypress_action(unsigned long unused)
 {
@@ -31,7 +31,6 @@ static DECLARE_TASKLET(keypress_tasklet,
 
 void handle_keypress(unsigned char key, struct cpu_user_regs *regs)
 {
-    static bool_t executing_handler;
     struct keyhandler *h;
 
     if ( (h = key_table[key]) == NULL )
@@ -39,18 +38,9 @@ void handle_keypress(unsigned char key, 
 
     if ( !in_irq() || h->irq_callback )
     {
-        /*
-         * No concurrent handler execution: prevents garbled console and
-         * protects keyhandler_scratch[].
-         */
-        if ( test_and_set_bool(executing_handler) )
-            return;
-        wmb();
         console_start_log_everything();
         h->irq_callback ? (*h->u.irq_fn)(key, regs) : (*h->u.fn)(key);
         console_end_log_everything();
-        wmb();
-        executing_handler = 0;
     }
     else
     {
diff -r 27f5ff8c0aa0 -r a4ddf47a1e91 xen/include/xen/keyhandler.h
--- a/xen/include/xen/keyhandler.h      Fri Feb 12 09:16:10 2010 +0000
+++ b/xen/include/xen/keyhandler.h      Fri Feb 12 09:21:57 2010 +0000
@@ -53,6 +53,6 @@ extern void handle_keypress(unsigned cha
 extern void handle_keypress(unsigned char key, struct cpu_user_regs *regs);
 
 /* Scratch space is available for use of any keyhandler. */
-extern char keyhandler_scratch[100];
+extern char keyhandler_scratch[1024];
 
 #endif /* __XEN_KEYHANDLER_H__ */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.