mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-16 15:11:52 +00:00
Add a new variable mp_maxid. This is used so that per cpu datastructures may
be allocated as arrays indexed by the cpu id. Previously the only reliable way to know the max cpu id was through MAXCPU. mp_ncpus isn't useful here because cpu ids may be sparsely mapped, although x86 and alpha do not do this. Also, call cpu_mp_probe much earlier so the max cpu id is known before the VM starts up. This is intended to help support per cpu queues for the new allocator, but may be useful elsewhere. Reviewed by: jake Approved by: jake
This commit is contained in:
parent
11de413756
commit
88c99cfbc8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=91673
@ -307,6 +307,7 @@ cpu_mp_probe(void)
|
||||
all_cpus = 1 << boot_cpu_id;
|
||||
|
||||
mp_ncpus = 1;
|
||||
mp_maxid = 0;
|
||||
|
||||
/* Make sure we have at least one secondary CPU. */
|
||||
cpus = 0;
|
||||
@ -332,6 +333,7 @@ cpu_mp_probe(void)
|
||||
if (i > MAXCPU) {
|
||||
continue;
|
||||
}
|
||||
mp_maxid = i;
|
||||
cpus++;
|
||||
}
|
||||
return (cpus);
|
||||
|
@ -788,6 +788,7 @@ mptable_pass1(void)
|
||||
|
||||
/* fill in with defaults */
|
||||
mp_naps = 2; /* includes BSP */
|
||||
mp_maxid = 1;
|
||||
mp_nbusses = default_data[MPFPS_MPFB1 - 1][0];
|
||||
#if defined(APIC_IO)
|
||||
mp_napics = 1;
|
||||
@ -809,8 +810,10 @@ mptable_pass1(void)
|
||||
switch (type = *(u_char *) position) {
|
||||
case 0: /* processor_entry */
|
||||
if (((proc_entry_ptr)position)->cpu_flags
|
||||
& PROCENTRY_FLAG_EN)
|
||||
& PROCENTRY_FLAG_EN) {
|
||||
++mp_naps;
|
||||
mp_maxid++;
|
||||
}
|
||||
break;
|
||||
case 1: /* bus_entry */
|
||||
++mp_nbusses;
|
||||
|
@ -788,6 +788,7 @@ mptable_pass1(void)
|
||||
|
||||
/* fill in with defaults */
|
||||
mp_naps = 2; /* includes BSP */
|
||||
mp_maxid = 1;
|
||||
mp_nbusses = default_data[MPFPS_MPFB1 - 1][0];
|
||||
#if defined(APIC_IO)
|
||||
mp_napics = 1;
|
||||
@ -809,8 +810,10 @@ mptable_pass1(void)
|
||||
switch (type = *(u_char *) position) {
|
||||
case 0: /* processor_entry */
|
||||
if (((proc_entry_ptr)position)->cpu_flags
|
||||
& PROCENTRY_FLAG_EN)
|
||||
& PROCENTRY_FLAG_EN) {
|
||||
++mp_naps;
|
||||
mp_maxid++;
|
||||
}
|
||||
break;
|
||||
case 1: /* bus_entry */
|
||||
++mp_nbusses;
|
||||
|
@ -788,6 +788,7 @@ mptable_pass1(void)
|
||||
|
||||
/* fill in with defaults */
|
||||
mp_naps = 2; /* includes BSP */
|
||||
mp_maxid = 1;
|
||||
mp_nbusses = default_data[MPFPS_MPFB1 - 1][0];
|
||||
#if defined(APIC_IO)
|
||||
mp_napics = 1;
|
||||
@ -809,8 +810,10 @@ mptable_pass1(void)
|
||||
switch (type = *(u_char *) position) {
|
||||
case 0: /* processor_entry */
|
||||
if (((proc_entry_ptr)position)->cpu_flags
|
||||
& PROCENTRY_FLAG_EN)
|
||||
& PROCENTRY_FLAG_EN) {
|
||||
++mp_naps;
|
||||
mp_maxid++;
|
||||
}
|
||||
break;
|
||||
case 1: /* bus_entry */
|
||||
++mp_nbusses;
|
||||
|
@ -788,6 +788,7 @@ mptable_pass1(void)
|
||||
|
||||
/* fill in with defaults */
|
||||
mp_naps = 2; /* includes BSP */
|
||||
mp_maxid = 1;
|
||||
mp_nbusses = default_data[MPFPS_MPFB1 - 1][0];
|
||||
#if defined(APIC_IO)
|
||||
mp_napics = 1;
|
||||
@ -809,8 +810,10 @@ mptable_pass1(void)
|
||||
switch (type = *(u_char *) position) {
|
||||
case 0: /* processor_entry */
|
||||
if (((proc_entry_ptr)position)->cpu_flags
|
||||
& PROCENTRY_FLAG_EN)
|
||||
& PROCENTRY_FLAG_EN) {
|
||||
++mp_naps;
|
||||
mp_maxid++;
|
||||
}
|
||||
break;
|
||||
case 1: /* bus_entry */
|
||||
++mp_nbusses;
|
||||
|
@ -788,6 +788,7 @@ mptable_pass1(void)
|
||||
|
||||
/* fill in with defaults */
|
||||
mp_naps = 2; /* includes BSP */
|
||||
mp_maxid = 1;
|
||||
mp_nbusses = default_data[MPFPS_MPFB1 - 1][0];
|
||||
#if defined(APIC_IO)
|
||||
mp_napics = 1;
|
||||
@ -809,8 +810,10 @@ mptable_pass1(void)
|
||||
switch (type = *(u_char *) position) {
|
||||
case 0: /* processor_entry */
|
||||
if (((proc_entry_ptr)position)->cpu_flags
|
||||
& PROCENTRY_FLAG_EN)
|
||||
& PROCENTRY_FLAG_EN) {
|
||||
++mp_naps;
|
||||
mp_maxid++;
|
||||
}
|
||||
break;
|
||||
case 1: /* bus_entry */
|
||||
++mp_nbusses;
|
||||
|
@ -788,6 +788,7 @@ mptable_pass1(void)
|
||||
|
||||
/* fill in with defaults */
|
||||
mp_naps = 2; /* includes BSP */
|
||||
mp_maxid = 1;
|
||||
mp_nbusses = default_data[MPFPS_MPFB1 - 1][0];
|
||||
#if defined(APIC_IO)
|
||||
mp_napics = 1;
|
||||
@ -809,8 +810,10 @@ mptable_pass1(void)
|
||||
switch (type = *(u_char *) position) {
|
||||
case 0: /* processor_entry */
|
||||
if (((proc_entry_ptr)position)->cpu_flags
|
||||
& PROCENTRY_FLAG_EN)
|
||||
& PROCENTRY_FLAG_EN) {
|
||||
++mp_naps;
|
||||
mp_maxid++;
|
||||
}
|
||||
break;
|
||||
case 1: /* bus_entry */
|
||||
++mp_nbusses;
|
||||
|
@ -53,6 +53,7 @@ int mp_ncpus;
|
||||
|
||||
volatile int smp_started;
|
||||
u_int all_cpus;
|
||||
u_int mp_maxid;
|
||||
|
||||
SYSCTL_NODE(_kern, OID_AUTO, smp, CTLFLAG_RD, NULL, "Kernel SMP");
|
||||
|
||||
@ -79,16 +80,27 @@ 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;
|
||||
static int mp_probe_status;
|
||||
|
||||
/*
|
||||
* Initialize MI SMP variables and call the MD SMP initialization code.
|
||||
* Initialize MI SMP variables.
|
||||
*/
|
||||
static void
|
||||
mp_probe(void *dummy)
|
||||
{
|
||||
mp_probe_status = cpu_mp_probe();
|
||||
}
|
||||
SYSINIT(cpu_mp_probe, SI_SUB_TUNABLES, SI_ORDER_FIRST, mp_probe, NULL);
|
||||
|
||||
/*
|
||||
* Call the MD SMP initialization code.
|
||||
*/
|
||||
static void
|
||||
mp_start(void *dummy)
|
||||
{
|
||||
|
||||
/* Probe for MP hardware. */
|
||||
if (cpu_mp_probe() == 0)
|
||||
if (mp_probe_status == 0)
|
||||
return;
|
||||
|
||||
mtx_init(&smp_rv_mtx, "smp rendezvous", MTX_SPIN);
|
||||
|
@ -26,6 +26,7 @@ extern int smp_cpus;
|
||||
extern u_int all_cpus;
|
||||
extern volatile u_int started_cpus;
|
||||
extern volatile u_int stopped_cpus;
|
||||
extern u_int mp_maxid;
|
||||
|
||||
/*
|
||||
* Macro allowing us to determine whether a CPU is absent at any given
|
||||
|
Loading…
Reference in New Issue
Block a user