debuggers.hg

changeset 20982:a4ddf47a1e91

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@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Feb 12 09:21:57 2010 +0000 (2010-02-12)
parents 27f5ff8c0aa0
children a948403c8f99
files xen/common/keyhandler.c xen/include/xen/keyhandler.h
line diff
     1.1 --- a/xen/common/keyhandler.c	Fri Feb 12 09:16:10 2010 +0000
     1.2 +++ b/xen/common/keyhandler.c	Fri Feb 12 09:21:57 2010 +0000
     1.3 @@ -20,7 +20,7 @@
     1.4  static struct keyhandler *key_table[256];
     1.5  static unsigned char keypress_key;
     1.6  
     1.7 -char keyhandler_scratch[100];
     1.8 +char keyhandler_scratch[1024];
     1.9  
    1.10  static void keypress_action(unsigned long unused)
    1.11  {
    1.12 @@ -31,7 +31,6 @@ static DECLARE_TASKLET(keypress_tasklet,
    1.13  
    1.14  void handle_keypress(unsigned char key, struct cpu_user_regs *regs)
    1.15  {
    1.16 -    static bool_t executing_handler;
    1.17      struct keyhandler *h;
    1.18  
    1.19      if ( (h = key_table[key]) == NULL )
    1.20 @@ -39,18 +38,9 @@ void handle_keypress(unsigned char key, 
    1.21  
    1.22      if ( !in_irq() || h->irq_callback )
    1.23      {
    1.24 -        /*
    1.25 -         * No concurrent handler execution: prevents garbled console and
    1.26 -         * protects keyhandler_scratch[].
    1.27 -         */
    1.28 -        if ( test_and_set_bool(executing_handler) )
    1.29 -            return;
    1.30 -        wmb();
    1.31          console_start_log_everything();
    1.32          h->irq_callback ? (*h->u.irq_fn)(key, regs) : (*h->u.fn)(key);
    1.33          console_end_log_everything();
    1.34 -        wmb();
    1.35 -        executing_handler = 0;
    1.36      }
    1.37      else
    1.38      {
     2.1 --- a/xen/include/xen/keyhandler.h	Fri Feb 12 09:16:10 2010 +0000
     2.2 +++ b/xen/include/xen/keyhandler.h	Fri Feb 12 09:21:57 2010 +0000
     2.3 @@ -53,6 +53,6 @@ extern void register_keyhandler(unsigned
     2.4  extern void handle_keypress(unsigned char key, struct cpu_user_regs *regs);
     2.5  
     2.6  /* Scratch space is available for use of any keyhandler. */
     2.7 -extern char keyhandler_scratch[100];
     2.8 +extern char keyhandler_scratch[1024];
     2.9  
    2.10  #endif /* __XEN_KEYHANDLER_H__ */