1997-04-26 11:46:25 +00:00
|
|
|
/*
|
2001-04-27 19:28:25 +00:00
|
|
|
* Copyright (c) 2001
|
|
|
|
* John Baldwin <jhb@FreeBSD.org>. All rights reserved.
|
1997-04-26 11:46:25 +00:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
2001-04-27 19:28:25 +00:00
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 4. Neither the name of the author nor the names of any co-contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
1997-04-26 11:46:25 +00:00
|
|
|
*
|
2001-04-27 19:28:25 +00:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY JOHN BALDWIN AND CONTRIBUTORS ``AS IS'' AND
|
1997-04-26 11:46:25 +00:00
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
2001-04-27 19:28:25 +00:00
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL JOHN BALDWIN OR THE VOICES IN HIS HEAD
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
|
|
* THE POSSIBILITY OF SUCH DAMAGE.
|
1997-04-26 11:46:25 +00:00
|
|
|
*
|
1999-08-28 01:08:13 +00:00
|
|
|
* $FreeBSD$
|
1997-04-26 11:46:25 +00:00
|
|
|
*/
|
|
|
|
|
2001-04-27 19:28:25 +00:00
|
|
|
/*
|
|
|
|
* This module holds the global variables and machine independent functions
|
2001-05-10 17:45:49 +00:00
|
|
|
* used for the kernel SMP support.
|
2001-04-27 19:28:25 +00:00
|
|
|
*/
|
1997-12-08 23:00:24 +00:00
|
|
|
|
1997-08-25 21:28:08 +00:00
|
|
|
#include <sys/param.h>
|
1997-04-26 11:46:25 +00:00
|
|
|
#include <sys/systm.h>
|
2001-05-10 17:45:49 +00:00
|
|
|
#include <sys/kernel.h>
|
2001-04-27 19:28:25 +00:00
|
|
|
#include <sys/ktr.h>
|
1997-08-26 18:10:38 +00:00
|
|
|
#include <sys/proc.h>
|
2001-04-27 19:28:25 +00:00
|
|
|
#include <sys/lock.h>
|
2000-10-20 07:58:15 +00:00
|
|
|
#include <sys/mutex.h>
|
2001-05-10 17:45:49 +00:00
|
|
|
#include <sys/pcpu.h>
|
2001-04-27 19:28:25 +00:00
|
|
|
#include <sys/smp.h>
|
|
|
|
#include <sys/sysctl.h>
|
1997-04-26 11:46:25 +00:00
|
|
|
|
2002-03-07 04:43:51 +00:00
|
|
|
#include <machine/smp.h>
|
|
|
|
|
2001-04-27 19:28:25 +00:00
|
|
|
volatile u_int stopped_cpus;
|
|
|
|
volatile u_int started_cpus;
|
1997-04-26 11:46:25 +00:00
|
|
|
|
2002-03-19 21:25:46 +00:00
|
|
|
void (*cpustop_restartfunc)(void);
|
2001-04-27 19:28:25 +00:00
|
|
|
int mp_ncpus;
|
1997-04-26 11:46:25 +00:00
|
|
|
|
2001-10-31 20:43:38 +00:00
|
|
|
volatile int smp_started;
|
2001-04-27 19:28:25 +00:00
|
|
|
u_int all_cpus;
|
2002-03-05 10:01:46 +00:00
|
|
|
u_int mp_maxid;
|
1997-04-26 11:46:25 +00:00
|
|
|
|
2001-04-27 19:28:25 +00:00
|
|
|
SYSCTL_NODE(_kern, OID_AUTO, smp, CTLFLAG_RD, NULL, "Kernel SMP");
|
1997-04-26 11:46:25 +00:00
|
|
|
|
2001-04-27 19:28:25 +00:00
|
|
|
int smp_active = 0; /* are the APs allowed to run? */
|
|
|
|
SYSCTL_INT(_kern_smp, OID_AUTO, active, CTLFLAG_RW, &smp_active, 0, "");
|
1997-04-26 11:46:25 +00:00
|
|
|
|
2001-04-27 19:28:25 +00:00
|
|
|
int smp_cpus = 1; /* how many cpu's running */
|
|
|
|
SYSCTL_INT(_kern_smp, OID_AUTO, cpus, CTLFLAG_RD, &smp_cpus, 0, "");
|
1997-04-26 11:46:25 +00:00
|
|
|
|
2001-04-27 19:28:25 +00:00
|
|
|
/* Enable forwarding of a signal to a process running on a different CPU */
|
|
|
|
static int forward_signal_enabled = 1;
|
|
|
|
SYSCTL_INT(_kern_smp, OID_AUTO, forward_signal_enabled, CTLFLAG_RW,
|
|
|
|
&forward_signal_enabled, 0, "");
|
1997-04-26 11:46:25 +00:00
|
|
|
|
2001-04-27 19:28:25 +00:00
|
|
|
/* Enable forwarding of roundrobin to all other cpus */
|
|
|
|
static int forward_roundrobin_enabled = 1;
|
|
|
|
SYSCTL_INT(_kern_smp, OID_AUTO, forward_roundrobin_enabled, CTLFLAG_RW,
|
|
|
|
&forward_roundrobin_enabled, 0, "");
|
1997-04-26 11:46:25 +00:00
|
|
|
|
2001-04-27 19:28:25 +00:00
|
|
|
/* Variables needed for SMP rendezvous. */
|
|
|
|
static void (*smp_rv_setup_func)(void *arg);
|
|
|
|
static void (*smp_rv_action_func)(void *arg);
|
|
|
|
static void (*smp_rv_teardown_func)(void *arg);
|
|
|
|
static void *smp_rv_func_arg;
|
|
|
|
static volatile int smp_rv_waiters[2];
|
|
|
|
static struct mtx smp_rv_mtx;
|
2002-03-05 10:01:46 +00:00
|
|
|
static int mp_probe_status;
|
1997-04-26 11:46:25 +00:00
|
|
|
|
|
|
|
/*
|
2002-03-05 10:01:46 +00:00
|
|
|
* Initialize MI SMP variables.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
mp_probe(void *dummy)
|
|
|
|
{
|
|
|
|
mp_probe_status = cpu_mp_probe();
|
|
|
|
}
|
2002-03-20 14:46:38 +00:00
|
|
|
SYSINIT(cpu_mp_probe, SI_SUB_TUNABLES, SI_ORDER_FIRST, mp_probe, NULL)
|
2002-03-05 10:01:46 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Call the MD SMP initialization code.
|
1997-04-26 11:46:25 +00:00
|
|
|
*/
|
2001-04-27 19:28:25 +00:00
|
|
|
static void
|
|
|
|
mp_start(void *dummy)
|
1997-04-26 11:46:25 +00:00
|
|
|
{
|
1997-04-28 00:25:00 +00:00
|
|
|
|
2001-04-27 19:28:25 +00:00
|
|
|
/* Probe for MP hardware. */
|
2002-03-05 10:01:46 +00:00
|
|
|
if (mp_probe_status == 0)
|
2001-04-27 19:28:25 +00:00
|
|
|
return;
|
1997-04-26 11:46:25 +00:00
|
|
|
|
2002-04-04 21:03:38 +00:00
|
|
|
mtx_init(&smp_rv_mtx, "smp rendezvous", NULL, MTX_SPIN);
|
2001-04-27 19:28:25 +00:00
|
|
|
cpu_mp_start();
|
|
|
|
printf("FreeBSD/SMP: Multiprocessor System Detected: %d CPUs\n",
|
|
|
|
mp_ncpus);
|
|
|
|
cpu_mp_announce();
|
1997-04-26 11:46:25 +00:00
|
|
|
}
|
2001-04-27 19:28:25 +00:00
|
|
|
SYSINIT(cpu_mp, SI_SUB_CPU, SI_ORDER_SECOND, mp_start, NULL)
|
1997-06-27 23:33:17 +00:00
|
|
|
|
1997-12-08 23:00:24 +00:00
|
|
|
void
|
2001-09-12 08:38:13 +00:00
|
|
|
forward_signal(struct thread *td)
|
1998-03-03 20:55:26 +00:00
|
|
|
{
|
|
|
|
int id;
|
|
|
|
|
2001-04-27 19:28:25 +00:00
|
|
|
/*
|
2002-04-05 10:00:37 +00:00
|
|
|
* signotify() has already set KEF_ASTPENDING and PS_NEEDSIGCHECK on
|
|
|
|
* this process, so all we need to do is poke it if it is currently
|
|
|
|
* executing so that it executes ast().
|
1998-03-03 20:55:26 +00:00
|
|
|
*/
|
2001-04-27 19:28:25 +00:00
|
|
|
mtx_assert(&sched_lock, MA_OWNED);
|
2002-04-05 10:00:37 +00:00
|
|
|
KASSERT(td->td_proc->p_stat == SRUN,
|
|
|
|
("forward_signal: process is not SRUN"));
|
1998-03-03 20:55:26 +00:00
|
|
|
|
2001-09-12 08:38:13 +00:00
|
|
|
CTR1(KTR_SMP, "forward_signal(%p)", td->td_proc);
|
2001-01-24 09:48:52 +00:00
|
|
|
|
2001-04-27 19:28:25 +00:00
|
|
|
if (!smp_started || cold || panicstr)
|
1998-03-03 20:55:26 +00:00
|
|
|
return;
|
|
|
|
if (!forward_signal_enabled)
|
|
|
|
return;
|
2001-04-27 19:28:25 +00:00
|
|
|
|
|
|
|
/* No need to IPI ourself. */
|
2001-09-12 08:38:13 +00:00
|
|
|
if (td == curthread)
|
2001-04-27 19:28:25 +00:00
|
|
|
return;
|
|
|
|
|
2001-09-12 08:38:13 +00:00
|
|
|
id = td->td_kse->ke_oncpu;
|
2001-04-27 19:28:25 +00:00
|
|
|
if (id == NOCPU)
|
|
|
|
return;
|
|
|
|
ipi_selected(1 << id, IPI_AST);
|
1998-03-03 20:55:26 +00:00
|
|
|
}
|
1998-03-03 22:56:30 +00:00
|
|
|
|
1998-05-17 22:12:14 +00:00
|
|
|
void
|
|
|
|
forward_roundrobin(void)
|
|
|
|
{
|
2001-12-11 23:33:44 +00:00
|
|
|
struct pcpu *pc;
|
2001-09-12 08:38:13 +00:00
|
|
|
struct thread *td;
|
2001-04-27 19:28:25 +00:00
|
|
|
u_int id, map;
|
|
|
|
|
|
|
|
mtx_assert(&sched_lock, MA_OWNED);
|
1998-05-17 22:12:14 +00:00
|
|
|
|
2001-01-24 09:48:52 +00:00
|
|
|
CTR0(KTR_SMP, "forward_roundrobin()");
|
|
|
|
|
2001-04-27 19:28:25 +00:00
|
|
|
if (!smp_started || cold || panicstr)
|
1998-05-17 22:12:14 +00:00
|
|
|
return;
|
|
|
|
if (!forward_roundrobin_enabled)
|
|
|
|
return;
|
2001-04-27 19:28:25 +00:00
|
|
|
map = 0;
|
2001-12-11 23:33:44 +00:00
|
|
|
SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
|
|
|
|
td = pc->pc_curthread;
|
2002-01-05 09:38:47 +00:00
|
|
|
id = pc->pc_cpumask;
|
|
|
|
if (id != PCPU_GET(cpumask) && (id & stopped_cpus) == 0 &&
|
2001-12-11 23:33:44 +00:00
|
|
|
td != pc->pc_idlethread) {
|
2001-09-12 08:38:13 +00:00
|
|
|
td->td_kse->ke_flags |= KEF_NEEDRESCHED;
|
2001-04-27 19:28:25 +00:00
|
|
|
map |= id;
|
1998-05-17 22:12:14 +00:00
|
|
|
}
|
|
|
|
}
|
2001-04-27 19:28:25 +00:00
|
|
|
ipi_selected(map, IPI_AST);
|
1998-05-17 22:12:14 +00:00
|
|
|
}
|
|
|
|
|
2001-01-24 09:48:52 +00:00
|
|
|
/*
|
|
|
|
* When called the executing CPU will send an IPI to all other CPUs
|
|
|
|
* requesting that they halt execution.
|
|
|
|
*
|
|
|
|
* Usually (but not necessarily) called with 'other_cpus' as its arg.
|
|
|
|
*
|
|
|
|
* - Signals all CPUs in map to stop.
|
|
|
|
* - Waits for each to stop.
|
|
|
|
*
|
|
|
|
* Returns:
|
|
|
|
* -1: error
|
|
|
|
* 0: NA
|
|
|
|
* 1: ok
|
|
|
|
*
|
|
|
|
* XXX FIXME: this is not MP-safe, needs a lock to prevent multiple CPUs
|
|
|
|
* from executing at same time.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
stop_cpus(u_int map)
|
|
|
|
{
|
2001-04-27 19:28:25 +00:00
|
|
|
int i;
|
2001-01-24 09:48:52 +00:00
|
|
|
|
|
|
|
if (!smp_started)
|
|
|
|
return 0;
|
|
|
|
|
2001-04-27 19:28:25 +00:00
|
|
|
CTR1(KTR_SMP, "stop_cpus(%x)", map);
|
|
|
|
|
|
|
|
/* send the stop IPI to all CPUs in map */
|
2001-04-11 17:06:02 +00:00
|
|
|
ipi_selected(map, IPI_STOP);
|
2001-01-24 09:48:52 +00:00
|
|
|
|
2001-04-27 19:28:25 +00:00
|
|
|
i = 0;
|
|
|
|
while ((atomic_load_acq_int(&stopped_cpus) & map) != map) {
|
|
|
|
/* spin */
|
|
|
|
i++;
|
2001-01-24 09:48:52 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
2001-04-27 19:28:25 +00:00
|
|
|
if (i == 100000) {
|
|
|
|
printf("timeout stopping cpus\n");
|
|
|
|
break;
|
|
|
|
}
|
2001-01-24 09:48:52 +00:00
|
|
|
#endif
|
2001-04-27 19:28:25 +00:00
|
|
|
}
|
2001-01-24 09:48:52 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Called by a CPU to restart stopped CPUs.
|
|
|
|
*
|
|
|
|
* Usually (but not necessarily) called with 'stopped_cpus' as its arg.
|
|
|
|
*
|
|
|
|
* - Signals all CPUs in map to restart.
|
|
|
|
* - Waits for each to restart.
|
|
|
|
*
|
|
|
|
* Returns:
|
|
|
|
* -1: error
|
|
|
|
* 0: NA
|
|
|
|
* 1: ok
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
restart_cpus(u_int map)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!smp_started)
|
|
|
|
return 0;
|
|
|
|
|
2001-04-27 19:28:25 +00:00
|
|
|
CTR1(KTR_SMP, "restart_cpus(%x)", map);
|
2001-01-24 09:48:52 +00:00
|
|
|
|
2001-04-27 19:28:25 +00:00
|
|
|
/* signal other cpus to restart */
|
|
|
|
atomic_store_rel_int(&started_cpus, map);
|
2001-01-24 09:48:52 +00:00
|
|
|
|
2001-04-27 19:28:25 +00:00
|
|
|
/* wait for each to clear its bit */
|
|
|
|
while ((atomic_load_acq_int(&stopped_cpus) & map) != 0)
|
|
|
|
; /* nothing */
|
2001-01-24 09:48:52 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
1999-07-20 06:52:35 +00:00
|
|
|
/*
|
|
|
|
* All-CPU rendezvous. CPUs are signalled, all execute the setup function
|
|
|
|
* (if specified), rendezvous, execute the action function (if specified),
|
|
|
|
* rendezvous again, execute the teardown function (if specified), and then
|
|
|
|
* resume.
|
|
|
|
*
|
|
|
|
* Note that the supplied external functions _must_ be reentrant and aware
|
|
|
|
* that they are running in parallel and in an unknown lock context.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
smp_rendezvous_action(void)
|
|
|
|
{
|
2001-04-27 19:28:25 +00:00
|
|
|
|
1999-07-20 06:52:35 +00:00
|
|
|
/* setup function */
|
|
|
|
if (smp_rv_setup_func != NULL)
|
|
|
|
smp_rv_setup_func(smp_rv_func_arg);
|
|
|
|
/* spin on entry rendezvous */
|
|
|
|
atomic_add_int(&smp_rv_waiters[0], 1);
|
2001-04-27 19:28:25 +00:00
|
|
|
while (atomic_load_acq_int(&smp_rv_waiters[0]) < mp_ncpus)
|
|
|
|
; /* nothing */
|
1999-07-20 06:52:35 +00:00
|
|
|
/* action function */
|
|
|
|
if (smp_rv_action_func != NULL)
|
|
|
|
smp_rv_action_func(smp_rv_func_arg);
|
|
|
|
/* spin on exit rendezvous */
|
|
|
|
atomic_add_int(&smp_rv_waiters[1], 1);
|
2001-04-27 19:28:25 +00:00
|
|
|
while (atomic_load_acq_int(&smp_rv_waiters[1]) < mp_ncpus)
|
|
|
|
; /* nothing */
|
1999-07-20 06:52:35 +00:00
|
|
|
/* teardown function */
|
|
|
|
if (smp_rv_teardown_func != NULL)
|
|
|
|
smp_rv_teardown_func(smp_rv_func_arg);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
smp_rendezvous(void (* setup_func)(void *),
|
|
|
|
void (* action_func)(void *),
|
|
|
|
void (* teardown_func)(void *),
|
|
|
|
void *arg)
|
|
|
|
{
|
2001-01-24 12:35:55 +00:00
|
|
|
|
2001-04-27 19:28:25 +00:00
|
|
|
if (!smp_started) {
|
|
|
|
if (setup_func != NULL)
|
|
|
|
setup_func(arg);
|
|
|
|
if (action_func != NULL)
|
|
|
|
action_func(arg);
|
|
|
|
if (teardown_func != NULL)
|
|
|
|
teardown_func(arg);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-07-20 06:52:35 +00:00
|
|
|
/* obtain rendezvous lock */
|
Change and clean the mutex lock interface.
mtx_enter(lock, type) becomes:
mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks)
mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized)
similarily, for releasing a lock, we now have:
mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN.
We change the caller interface for the two different types of locks
because the semantics are entirely different for each case, and this
makes it explicitly clear and, at the same time, it rids us of the
extra `type' argument.
The enter->lock and exit->unlock change has been made with the idea
that we're "locking data" and not "entering locked code" in mind.
Further, remove all additional "flags" previously passed to the
lock acquire/release routines with the exception of two:
MTX_QUIET and MTX_NOSWITCH
The functionality of these flags is preserved and they can be passed
to the lock/unlock routines by calling the corresponding wrappers:
mtx_{lock, unlock}_flags(lock, flag(s)) and
mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN
locks, respectively.
Re-inline some lock acq/rel code; in the sleep lock case, we only
inline the _obtain_lock()s in order to ensure that the inlined code
fits into a cache line. In the spin lock case, we inline recursion and
actually only perform a function call if we need to spin. This change
has been made with the idea that we generally tend to avoid spin locks
and that also the spin locks that we do have and are heavily used
(i.e. sched_lock) do recurse, and therefore in an effort to reduce
function call overhead for some architectures (such as alpha), we
inline recursion for this case.
Create a new malloc type for the witness code and retire from using
the M_DEV type. The new type is called M_WITNESS and is only declared
if WITNESS is enabled.
Begin cleaning up some machdep/mutex.h code - specifically updated the
"optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN
and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently
need those.
Finally, caught up to the interface changes in all sys code.
Contributors: jake, jhb, jasone (in no particular order)
2001-02-09 06:11:45 +00:00
|
|
|
mtx_lock_spin(&smp_rv_mtx);
|
1999-07-20 06:52:35 +00:00
|
|
|
|
|
|
|
/* set static function pointers */
|
|
|
|
smp_rv_setup_func = setup_func;
|
|
|
|
smp_rv_action_func = action_func;
|
|
|
|
smp_rv_teardown_func = teardown_func;
|
|
|
|
smp_rv_func_arg = arg;
|
|
|
|
smp_rv_waiters[0] = 0;
|
|
|
|
smp_rv_waiters[1] = 0;
|
|
|
|
|
2001-04-27 19:28:25 +00:00
|
|
|
/* signal other processors, which will enter the IPI with interrupts off */
|
2001-04-11 17:06:02 +00:00
|
|
|
ipi_all_but_self(IPI_RENDEZVOUS);
|
1999-07-20 06:52:35 +00:00
|
|
|
|
|
|
|
/* call executor function */
|
|
|
|
smp_rendezvous_action();
|
|
|
|
|
|
|
|
/* release lock */
|
Change and clean the mutex lock interface.
mtx_enter(lock, type) becomes:
mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks)
mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized)
similarily, for releasing a lock, we now have:
mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN.
We change the caller interface for the two different types of locks
because the semantics are entirely different for each case, and this
makes it explicitly clear and, at the same time, it rids us of the
extra `type' argument.
The enter->lock and exit->unlock change has been made with the idea
that we're "locking data" and not "entering locked code" in mind.
Further, remove all additional "flags" previously passed to the
lock acquire/release routines with the exception of two:
MTX_QUIET and MTX_NOSWITCH
The functionality of these flags is preserved and they can be passed
to the lock/unlock routines by calling the corresponding wrappers:
mtx_{lock, unlock}_flags(lock, flag(s)) and
mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN
locks, respectively.
Re-inline some lock acq/rel code; in the sleep lock case, we only
inline the _obtain_lock()s in order to ensure that the inlined code
fits into a cache line. In the spin lock case, we inline recursion and
actually only perform a function call if we need to spin. This change
has been made with the idea that we generally tend to avoid spin locks
and that also the spin locks that we do have and are heavily used
(i.e. sched_lock) do recurse, and therefore in an effort to reduce
function call overhead for some architectures (such as alpha), we
inline recursion for this case.
Create a new malloc type for the witness code and retire from using
the M_DEV type. The new type is called M_WITNESS and is only declared
if WITNESS is enabled.
Begin cleaning up some machdep/mutex.h code - specifically updated the
"optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN
and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently
need those.
Finally, caught up to the interface changes in all sys code.
Contributors: jake, jhb, jasone (in no particular order)
2001-02-09 06:11:45 +00:00
|
|
|
mtx_unlock_spin(&smp_rv_mtx);
|
1999-07-20 06:52:35 +00:00
|
|
|
}
|