Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Mar 2001 15:13:45 -0800 (PST)
From:      Matthew Jacob <mjacob@feral.com>
To:        John Baldwin <jhb@FreeBSD.ORG>
Cc:        arch@FreeBSD.ORG
Subject:   Re: Critical Regions Round II
Message-ID:  <Pine.LNX.4.21.0103221510030.14792-100000@zeppo.feral.com>
In-Reply-To: <XFMail.010322145353.jhb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

critical_enter/critical_exit seem fine, but you can save yourself some
compiler space by just having it return a void *.

What's wrong with alpha having

disable_intr()	calls	MD/platform function that disables mainbridge ints
enable_intr()	calls	MD/platform function that enables mainbridge ints

I believe that this actually is possible.

> Hopefully this will make everyone happy.
> 
> Prior to SMPng we had the following functions related to interrupts:
> 
> disable_intr()  - x86 only and just did a 'cli'
> enable_intr()   - x86 only and just did a 'sti'
> 
> With the initial SMPng commit this was added to to allow nested disabling
> of interrupts:
> 
> save_intr()     - return current interrupt state
> restore_intr()  - revert to previously read interrupt state
> 
> Thus one would do:
> 
>         u_int foo;
> 
>         foo = save_intr();
>         disable_intr();
>         ....
>         restore_intr(foo);
> 
> Also, this entire API was forced out into MI code.  After the discussion on
> the mailing list I propose the following that will hopefully make everyone
> happy:
> 
> disable_intr()  - x86 / ia64 only, just clears the IF or psr.i bit, and is
>                   a MD function
> enable_intr()   - x86 / ia64 only, just sets the IF or psr.i bit, and is a
>                   MD function
> 
> save_intr()     - gone
> restore_intr()  - gone
> 
> critical_enter() - enters a critical region of code that must not be
>                    preempted
> critical_exit()  - leaves a critical region of code
> 
> The critical_enter/exit functions use an opaque type 'critical_t' for the
> value that critical_enter() returns that must be passed to critical_exit().
> Thus, the above code now becomes:
> 
>         critical_t foo;
> 
>         foo = critical_enter();
>         ...
>         critical_exit(foo);
> 
> This API includes the same optimizations mentioned for the Alpha as the
> last proposal.  A manpage for critical_enter/exit is attached.
> 
> 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.21.0103221510030.14792-100000>