git: kernel - Fix live lock in vfs_conf.c mountroot>

Matthew Dillon dillon at crater.dragonflybsd.org
Tue Jul 14 13:46:46 PDT 2015


commit ce7866b815cc808c6c038daf3ba274cc8bcf68f7
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Tue Jul 14 13:33:49 2015 -0700

    kernel - Fix live lock in vfs_conf.c mountroot>
    
    * The mountroot> prompt calls cngetc() to process user input.  However, this
      function hard loops and can prevent other kernel threads from running on
      the current cpu.
    
    * Rearrange the code to use cncheckc() and a 1/25 second tsleep().
    
    * Fix a bug in the syscons code where NOKEY was not being properly returned
      as documented.  Modify all use cases to handle NOKEY.  This allows us to
      differentiate between a keyboard present but not key pressed and a keyboard
      not present.
    
    * Pull the automatic polling mode code out of cncheckc() (or more precisely,
      out of sccncheckc()) and add a new cnpoll() API function to set it manually.
    
      This fixes issues in vfs_conf when normal keyboard processing interrupts
      are operational and cncheckc() is used with a tsleep() delay.  The normal
      processing interrupt wound up eating the keystrokes so the cncheckc()
      basically always failed.
    
      cncheckc() in general also always had a small window of opportunity where
      a keystroke could be lost due loops on it.
    
    * Call cnpoll() in various places, such as when entering the debugger,
      asking for input in vfs_conf, and a few other places.

Summary of changes:
 sys/ddb/db_command.c                        |  2 ++
 sys/dev/misc/dcons/dcons_os.c               |  2 +-
 sys/dev/misc/syscons/syscons.c              | 29 ++++++++++++++++++++++++++---
 sys/dev/serial/sio/sio.c                    |  2 +-
 sys/kern/kern_ktr.c                         | 16 +++++++++++-----
 sys/kern/kern_shutdown.c                    |  5 ++++-
 sys/kern/tty_cons.c                         | 11 ++++++++++-
 sys/kern/vfs_conf.c                         | 16 +++++++++++++---
 sys/platform/pc64/isa/clock.c               | 14 ++++++++++----
 sys/platform/pc64/x86_64/dump_machdep.c     | 12 +++++++++---
 sys/platform/pc64/x86_64/minidump_machdep.c |  6 +++++-
 sys/platform/pc64/x86_64/mp_machdep.c       |  2 ++
 sys/platform/vkernel64/platform/console.c   |  2 +-
 sys/sys/cons.h                              |  8 ++++++--
 14 files changed, 101 insertions(+), 26 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/ce7866b815cc808c6c038daf3ba274cc8bcf68f7


-- 
DragonFly BSD source repository


More information about the Commits mailing list