From owner-cvs-all@FreeBSD.ORG Sun Sep 7 07:23:09 2003 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B4DE116A4BF; Sun, 7 Sep 2003 07:23:09 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 487B743FAF; Sun, 7 Sep 2003 07:23:09 -0700 (PDT) (envelope-from bde@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h87EN80U053575; Sun, 7 Sep 2003 07:23:09 -0700 (PDT) (envelope-from bde@repoman.freebsd.org) Received: (from bde@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h87EN8uf053574; Sun, 7 Sep 2003 07:23:08 -0700 (PDT) Message-Id: <200309071423.h87EN8uf053574@repoman.freebsd.org> From: Bruce Evans Date: Sun, 7 Sep 2003 07:23:08 -0700 (PDT) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/i386/i386 machdep.c src/sys/i386/isa clock.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Sep 2003 14:23:09 -0000 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