PERFORCE change 58484 for review

John Baldwin jhb at FreeBSD.org
Thu Jul 29 14:07:01 PDT 2004


On Thursday 29 July 2004 04:38 pm, Julian Elischer wrote:
> John Baldwin wrote:
> >http://perforce.freebsd.org/chv.cgi?CH=58484
> >
> >Change 58484 by jhb at jhb_slimer on 2004/07/29 20:35:13
> >
> >	Try to optimize intr_disable/restore by avoiding cli/sti like the
> >	plague.
>
> shouldn't one of these tests be reversed?

Nope.

If interrupts are enabled then we want to disable them in intr_disable().  If 
the saved state of interrupts is that they were enabled then we want to 
re-enable them in intr_restore().  If interrupts are disabled already, then 
we just leave everything alone.

> >Affected files ...
> >
> >.. //depot/projects/smpng/sys/i386/include/cpufunc.h#28 edit
> >
> >Differences ...
> >
> >==== //depot/projects/smpng/sys/i386/include/cpufunc.h#28 (text+ko) ====
> >
> >@@ -611,14 +611,16 @@
> > 	register_t eflags;
> >
> > 	eflags = read_eflags();
> >-	disable_intr();
> >+	if (eflags & PSL_I)
> >+		disable_intr();
> > 	return (eflags);
> > }
> >
> > static __inline void
> > intr_restore(register_t eflags)
> > {
> >-	write_eflags(eflags);
> >+	if (eflags & PSL_I)
> >+		enable_intr();
> > }
> >
> > #else /* !(__GNUC__ || __INTEL_COMPILER) */

-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the p4-projects mailing list