Date: Mon, 28 Jul 1997 19:19:18 +1000 From: Bruce Evans <bde@zeta.org.au> To: cvs-all@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, cvs-sys@FreeBSD.ORG, msmith@FreeBSD.ORG Subject: Re: cvs commit: src/sys/i386/isa isa.c Message-ID: <199707280919.TAA10322@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>msmith 1997/07/28 00:49:41 PDT > > Modified files: > sys/i386/isa isa.c > Log: > Use disable_intr() / read/write_eflags() to ensure that interrupt > handlers don't skew the results of isa_dmastatus. The function can be > safely called with interrupts disabled. > > Submitted by: Stephen McKay <syssgm@dtir.qld.gov.au> Erm, it already used splhigh() to ensure this. Rule 1: No function can be called safely with CPU interrupts disabled. (A few are called, with various amounts of unsafety. E.g., mcount is called from interrupt handler entry points. This is necessary for accurate profiling, but takes too long on slow machines.) splhigh() wouldn't be enough if isa_dmastatus() were called from a fast interrupt handler, but this shouldn't happen - see rule 1 :-). It would be particularly unsafe to call it, since the fast interrupt might be interrupting isa_dmastart() or other programming of the DMA registers that should be atomic. isa_dmastart() doesn't even use splhigh(). This seems to be more broken than I thought :-(. Concurrent calls from interrupt handlers can happen because interrupt handlers that used DMA don't all run at the same ipl. Only ipl = splhigh() would be common, and that would be too high. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199707280919.TAA10322>