git: kernel - Refactor the kernel message buffer code

Matthew Dillon dillon at crater.dragonflybsd.org
Mon Mar 2 18:24:55 PST 2015


commit 5608ef175917eaf5aa7542d9f872baca87d94a1c
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Mon Mar 2 17:55:51 2015 -0800

    kernel - Refactor the kernel message buffer code
    
    * Add a separate tracking index for /dev/klog (syslog) so it does not eat
      the base index for the in-memory buffer.
    
    * Change the way the FIFO indexes work.  The indexes are no longer stored
      as modulo size values.  Instead they are simply adjusted without a modulo,
      making calculations easier.
    
    * When the FIFO is full we now add around ~1KB of slop to reduce instances
      where SMP collisions implode the buffer.  This also required adjusting
      the kern.msgbuf sysctl to avoid dumping the 'slop' area (it used to just
      dump the entire buffer).
    
    * Adjust dmesg to operate more consistently, and to modulo the indices when
      making calculations.
    
    * The dmesg -a option now dumps the <num> prefix for syslog / console output
      messages.  Before it tried to strip them out, which created problems in
      distinguishing kprintf()d output from syslog output.
    
    * Adjust the console tty support thread (which copies the dmesg buffer to the
      console) as well as /dev/klog to use the new index methodology.
    
    * It is now possible for the indexes to wrap the buffer multiple times
      (between e.g. bufl and bufx), and it obviously makes no sense to try to
      dump the overwritten data over and over again, so if indexes get totally
      out of whack we reset bufr and bufl as needed to the size of the buffer.

Summary of changes:
 sbin/dmesg/dmesg.c                       |  58 +++++++----
 sys/kern/subr_log.c                      | 106 ++++++++++++++------
 sys/kern/subr_prf.c                      | 166 ++++++++++++++++++++++---------
 sys/platform/vkernel/i386/cpu_regs.c     |  46 ---------
 sys/platform/vkernel64/x86_64/cpu_regs.c |  46 ---------
 sys/sys/msgbuf.h                         |  15 ++-
 6 files changed, 240 insertions(+), 197 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/5608ef175917eaf5aa7542d9f872baca87d94a1c


-- 
DragonFly BSD source repository



More information about the Commits mailing list