summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorluoqi <luoqi@FreeBSD.org>2000-01-07 08:49:25 +0000
committerluoqi <luoqi@FreeBSD.org>2000-01-07 08:49:25 +0000
commit35b4c17c7948fded5016e651c9f3b6292e720a09 (patch)
treee1925c1031b9bc86cbff534a5b1a2955ab60de6d /sys
parente100d44d5538cc21abeba58f459ce9eb497651a9 (diff)
downloadFreeBSD-src-35b4c17c7948fded5016e651c9f3b6292e720a09.zip
FreeBSD-src-35b4c17c7948fded5016e651c9f3b6292e720a09.tar.gz
Allow SMP && NCPU == 1 to work. From now on, there's no restriction on the
value of NCPU relative to the number of cpus physically present, the actual number of cpus utilized will be the smaller of the two.
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/mp_machdep.c6
-rw-r--r--sys/amd64/amd64/mptable.c6
-rw-r--r--sys/amd64/include/mptable.h6
-rw-r--r--sys/i386/i386/mp_machdep.c6
-rw-r--r--sys/i386/i386/mptable.c6
-rw-r--r--sys/i386/include/mpapic.h2
-rw-r--r--sys/i386/include/mptable.h6
-rw-r--r--sys/kern/subr_smp.c6
8 files changed, 30 insertions, 14 deletions
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index 48d716a..ca8cfd2 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -1155,7 +1155,7 @@ static int
processor_entry(proc_entry_ptr entry, int cpu)
{
/* check for usability */
- if ((cpu >= NCPU) || !(entry->cpu_flags & PROCENTRY_FLAG_EN))
+ if (!(entry->cpu_flags & PROCENTRY_FLAG_EN))
return 0;
/* check for BSP flag */
@@ -1167,11 +1167,13 @@ processor_entry(proc_entry_ptr entry, int cpu)
}
/* add another AP to list, if less than max number of CPUs */
- else {
+ else if (cpu < NCPU) {
CPU_TO_ID(cpu) = entry->apic_id;
ID_TO_CPU(entry->apic_id) = cpu;
return 1;
}
+
+ return 0;
}
diff --git a/sys/amd64/amd64/mptable.c b/sys/amd64/amd64/mptable.c
index 48d716a..ca8cfd2 100644
--- a/sys/amd64/amd64/mptable.c
+++ b/sys/amd64/amd64/mptable.c
@@ -1155,7 +1155,7 @@ static int
processor_entry(proc_entry_ptr entry, int cpu)
{
/* check for usability */
- if ((cpu >= NCPU) || !(entry->cpu_flags & PROCENTRY_FLAG_EN))
+ if (!(entry->cpu_flags & PROCENTRY_FLAG_EN))
return 0;
/* check for BSP flag */
@@ -1167,11 +1167,13 @@ processor_entry(proc_entry_ptr entry, int cpu)
}
/* add another AP to list, if less than max number of CPUs */
- else {
+ else if (cpu < NCPU) {
CPU_TO_ID(cpu) = entry->apic_id;
ID_TO_CPU(entry->apic_id) = cpu;
return 1;
}
+
+ return 0;
}
diff --git a/sys/amd64/include/mptable.h b/sys/amd64/include/mptable.h
index 48d716a..ca8cfd2 100644
--- a/sys/amd64/include/mptable.h
+++ b/sys/amd64/include/mptable.h
@@ -1155,7 +1155,7 @@ static int
processor_entry(proc_entry_ptr entry, int cpu)
{
/* check for usability */
- if ((cpu >= NCPU) || !(entry->cpu_flags & PROCENTRY_FLAG_EN))
+ if (!(entry->cpu_flags & PROCENTRY_FLAG_EN))
return 0;
/* check for BSP flag */
@@ -1167,11 +1167,13 @@ processor_entry(proc_entry_ptr entry, int cpu)
}
/* add another AP to list, if less than max number of CPUs */
- else {
+ else if (cpu < NCPU) {
CPU_TO_ID(cpu) = entry->apic_id;
ID_TO_CPU(entry->apic_id) = cpu;
return 1;
}
+
+ return 0;
}
diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c
index 48d716a..ca8cfd2 100644
--- a/sys/i386/i386/mp_machdep.c
+++ b/sys/i386/i386/mp_machdep.c
@@ -1155,7 +1155,7 @@ static int
processor_entry(proc_entry_ptr entry, int cpu)
{
/* check for usability */
- if ((cpu >= NCPU) || !(entry->cpu_flags & PROCENTRY_FLAG_EN))
+ if (!(entry->cpu_flags & PROCENTRY_FLAG_EN))
return 0;
/* check for BSP flag */
@@ -1167,11 +1167,13 @@ processor_entry(proc_entry_ptr entry, int cpu)
}
/* add another AP to list, if less than max number of CPUs */
- else {
+ else if (cpu < NCPU) {
CPU_TO_ID(cpu) = entry->apic_id;
ID_TO_CPU(entry->apic_id) = cpu;
return 1;
}
+
+ return 0;
}
diff --git a/sys/i386/i386/mptable.c b/sys/i386/i386/mptable.c
index 48d716a..ca8cfd2 100644
--- a/sys/i386/i386/mptable.c
+++ b/sys/i386/i386/mptable.c
@@ -1155,7 +1155,7 @@ static int
processor_entry(proc_entry_ptr entry, int cpu)
{
/* check for usability */
- if ((cpu >= NCPU) || !(entry->cpu_flags & PROCENTRY_FLAG_EN))
+ if (!(entry->cpu_flags & PROCENTRY_FLAG_EN))
return 0;
/* check for BSP flag */
@@ -1167,11 +1167,13 @@ processor_entry(proc_entry_ptr entry, int cpu)
}
/* add another AP to list, if less than max number of CPUs */
- else {
+ else if (cpu < NCPU) {
CPU_TO_ID(cpu) = entry->apic_id;
ID_TO_CPU(entry->apic_id) = cpu;
return 1;
}
+
+ return 0;
}
diff --git a/sys/i386/include/mpapic.h b/sys/i386/include/mpapic.h
index a009936..4a38719 100644
--- a/sys/i386/include/mpapic.h
+++ b/sys/i386/include/mpapic.h
@@ -98,6 +98,8 @@ all_procs_ipi(int vector)
static __inline int
all_but_self_ipi(int vector)
{
+ if (mp_ncpus <= 1)
+ return 0;
return apic_ipi(APIC_DEST_ALLESELF, vector, APIC_DELMODE_FIXED);
}
diff --git a/sys/i386/include/mptable.h b/sys/i386/include/mptable.h
index 48d716a..ca8cfd2 100644
--- a/sys/i386/include/mptable.h
+++ b/sys/i386/include/mptable.h
@@ -1155,7 +1155,7 @@ static int
processor_entry(proc_entry_ptr entry, int cpu)
{
/* check for usability */
- if ((cpu >= NCPU) || !(entry->cpu_flags & PROCENTRY_FLAG_EN))
+ if (!(entry->cpu_flags & PROCENTRY_FLAG_EN))
return 0;
/* check for BSP flag */
@@ -1167,11 +1167,13 @@ processor_entry(proc_entry_ptr entry, int cpu)
}
/* add another AP to list, if less than max number of CPUs */
- else {
+ else if (cpu < NCPU) {
CPU_TO_ID(cpu) = entry->apic_id;
ID_TO_CPU(entry->apic_id) = cpu;
return 1;
}
+
+ return 0;
}
diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c
index 48d716a..ca8cfd2 100644
--- a/sys/kern/subr_smp.c
+++ b/sys/kern/subr_smp.c
@@ -1155,7 +1155,7 @@ static int
processor_entry(proc_entry_ptr entry, int cpu)
{
/* check for usability */
- if ((cpu >= NCPU) || !(entry->cpu_flags & PROCENTRY_FLAG_EN))
+ if (!(entry->cpu_flags & PROCENTRY_FLAG_EN))
return 0;
/* check for BSP flag */
@@ -1167,11 +1167,13 @@ processor_entry(proc_entry_ptr entry, int cpu)
}
/* add another AP to list, if less than max number of CPUs */
- else {
+ else if (cpu < NCPU) {
CPU_TO_ID(cpu) = entry->apic_id;
ID_TO_CPU(entry->apic_id) = cpu;
return 1;
}
+
+ return 0;
}
OpenPOWER on IntegriCloud