Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Sep 2003 07:23:08 -0700 (PDT)
From:      Bruce Evans <bde@FreeBSD.org>
To:        src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   cvs commit: src/sys/i386/i386 machdep.c src/sys/i386/isa clock.c
Message-ID:  <200309071423.h87EN8uf053574@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
bde         2003/09/07 07:23:08 PDT

  FreeBSD src repository

  Modified files:
    sys/i386/i386        machdep.c 
    sys/i386/isa         clock.c 
  Log:
  clock.c:
  Quick fix for calling DELAY() for ddb input in some (atkbd-based)
  console drivers.  ddb must not use any normal locks, but DELAY()
  normally calls getit() which needs clock_lock.  One problem with using
  normal locks in ddb is that deadlock is possible, but deadlock on
  clock_lock is unlikely becaluse clock_lock is bogusly recursive,
  apparently just to hide the problem of ddb using it.  The i8254 clock
  hardware has mostly write-only registers so it is important for it to
  use a lock that gives exclusive access.  (atkbd hardware is also
  unfriendly to reentrant software but that problem is more local and
  already solved.)  I mostly saw the symptoms of the bug caused by
  unlocking in getit() running cpu_unpend().  cpu_unpend() should not
  be called while in ddb and Debugger() calls for failing assertions
  about this caused a breakpoint within ddb.
  
  ddb must also not call getit() because ddb may be being used to step
  through clock initialization code that has stopped or otherwise mangled
  the clock.  If the clock is stopped, then getit() always returns the
  same value and DELAY() takes forever if it trusts getit().
  
  The quick fix is implement DELAY(n) as (n * timer_freq / 1000000)
  inb(0x84)'s if ddb is active.
  
  machdep.c:
  Don't permit recursion on clock_lock.
  
  Revision  Changes    Path
  1.570     +1 -1      src/sys/i386/i386/machdep.c
  1.204     +18 -2     src/sys/i386/isa/clock.c



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200309071423.h87EN8uf053574>