Deleted Added
sdiff udiff text old ( 134416 ) new ( 134591 )
full compact
1/*
2 * Copyright (c) 2001
3 * John Baldwin <jhb@FreeBSD.org>. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 19 unchanged lines hidden (view full) ---

28 */
29
30/*
31 * This module holds the global variables and machine independent functions
32 * used for the kernel SMP support.
33 */
34
35#include <sys/cdefs.h>
36__FBSDID("$FreeBSD: head/sys/kern/subr_smp.c 134416 2004-08-28 00:49:55Z obrien $");
37
38#include <sys/param.h>
39#include <sys/systm.h>
40#include <sys/kernel.h>
41#include <sys/ktr.h>
42#include <sys/proc.h>
43#include <sys/bus.h>
44#include <sys/lock.h>
45#include <sys/mutex.h>
46#include <sys/pcpu.h>
47#include <sys/smp.h>
48#include <sys/sysctl.h>
49
50#include <machine/smp.h>
51
52#ifdef SMP
53volatile cpumask_t stopped_cpus;
54volatile cpumask_t started_cpus;
55
56void (*cpustop_restartfunc)(void);
57#endif
58
59int mp_ncpus;
60/* export this for libkvm consumers. */
61int mp_maxcpus = MAXCPU;
62
63struct cpu_top *smp_topology;
64volatile int smp_started;
65cpumask_t all_cpus;
66u_int mp_maxid;
67
68SYSCTL_NODE(_kern, OID_AUTO, smp, CTLFLAG_RD, NULL, "Kernel SMP");
69
70SYSCTL_INT(_kern_smp, OID_AUTO, maxcpus, CTLFLAG_RD, &mp_maxcpus, 0,
71 "Max number of CPUs that the system was compiled for.");
72
73int smp_active = 0; /* are the APs allowed to run? */

--- 17 unchanged lines hidden (view full) ---

91 "Forwarding of a signal to a process on a different CPU");
92
93/* Enable forwarding of roundrobin to all other cpus */
94static int forward_roundrobin_enabled = 1;
95SYSCTL_INT(_kern_smp, OID_AUTO, forward_roundrobin_enabled, CTLFLAG_RW,
96 &forward_roundrobin_enabled, 0,
97 "Forwarding of roundrobin to all other CPUs");
98
99/* Variables needed for SMP rendezvous. */
100static void (*smp_rv_setup_func)(void *arg);
101static void (*smp_rv_action_func)(void *arg);
102static void (*smp_rv_teardown_func)(void *arg);
103static void *smp_rv_func_arg;
104static volatile int smp_rv_waiters[2];
105
106/*

--- 91 unchanged lines hidden (view full) ---

198 td != pc->pc_idlethread) {
199 td->td_flags |= TDF_NEEDRESCHED;
200 map |= id;
201 }
202 }
203 ipi_selected(map, IPI_AST);
204}
205
206/*
207 * When called the executing CPU will send an IPI to all other CPUs
208 * requesting that they halt execution.
209 *
210 * Usually (but not necessarily) called with 'other_cpus' as its arg.
211 *
212 * - Signals all CPUs in map to stop.
213 * - Waits for each to stop.
214 *

--- 170 unchanged lines hidden ---