kernel - Refactor tty_token, fix SMP performance issues
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 4 Oct 2018 17:22:35 +0000 (10:22 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 4 Oct 2018 22:29:49 +0000 (15:29 -0700)
commit2efb75f3055c1746efc358d68dbc2bf526faaf61
tree28a2e42f84abc80162f2c7220c92f562b8186923
parentba59fa7650ff2f210db5f38168ab9d7a1e925937
kernel - Refactor tty_token, fix SMP performance issues

* Remove most uses of tty_token in favor of per-tty tp->t_token.
  This is particularly important for removing bottlenecks related to PTYs,
  which are used all over the place.  tty_token remains in a few places
  managing overall registration and global list manipulation.

* tty structures are now required to be persistent.  Implement a sepearate
  ttyinit() function.  Continue to allow ttyregister() and ttyunregister()
  calls, but these no longer presume destruction of the structure.

* Refactor ttymalloc() to take a **tty pointer and interlock allocations.
  Allocations are intended to be one-time.  ttymalloc() only requires the
  tty_token for initial allocations.

* Remove all critical section use that was combined with tty_token and
  tp->t_token.  Leave only the tokens.  The critical sections were
  hold-overs going all the way back to pre-SMP days.

* syscons now gets its own token, vga_token.  The ISA VGA code and
  the framebuffer code also now use this token instead of tty_token.

* The keyboard subsystem now uses kbd_token instead of tty_token.

* A few remaining serial-like devices (snp, nmdm) also get their own
  tokens, as well as use the now required tp->t_token.

* Remove use of tty_token in the session management code.  This fixes
  a niggling performance path since sessions almost universally go
  hand-in-hand with fork/exec/exit sequences.  Instead we use the
  already-existing per-hash session token.
30 files changed:
sys/bus/isa/vga_isa.c
sys/bus/u4b/serial/usb_serial.c
sys/dev/misc/atkbd/atkbd_isa.c
sys/dev/misc/atkbdc_layer/atkbdc_isa.c
sys/dev/misc/dcons/dcons_os.c
sys/dev/misc/kbd/kbd.c
sys/dev/misc/nmdm/nmdm.c
sys/dev/misc/snp/snp.c
sys/dev/misc/syscons/scvgarndr.c
sys/dev/misc/syscons/scvidctl.c
sys/dev/misc/syscons/syscons.c
sys/dev/serial/sio/sio.c
sys/dev/video/fb/bmp/splash_bmp.c
sys/dev/video/fb/fb.c
sys/dev/video/fb/fbreg.h
sys/dev/video/fb/vga.c
sys/kern/kern_proc.c
sys/kern/lwkt_token.c
sys/kern/tty.c
sys/kern/tty_cons.c
sys/kern/tty_pty.c
sys/kern/tty_subr.c
sys/net/sl/if_sl.c
sys/netgraph/tty/ng_tty.c
sys/netgraph7/bluetooth/drivers/h4/ng_h4.c
sys/netgraph7/tty/ng_tty.c
sys/platform/vkernel64/platform/console.c
sys/sys/proc.h
sys/sys/thread.h
sys/sys/tty.h