Page MenuHomeFreeBSD

D39806.diff
No OneTemporary

D39806.diff

diff --git a/sys/amd64/include/kdb.h b/sys/amd64/include/kdb.h
--- a/sys/amd64/include/kdb.h
+++ b/sys/amd64/include/kdb.h
@@ -34,8 +34,6 @@
#include <machine/frame.h>
#include <machine/psl.h>
-#define KDB_STOPPEDPCB(pc) &stoppcbs[pc->pc_cpuid]
-
int kdb_cpu_set_watchpoint(vm_offset_t addr, vm_size_t size, int access);
int kdb_cpu_clr_watchpoint(vm_offset_t addr, vm_size_t size);
diff --git a/sys/arm/arm/mp_machdep.c b/sys/arm/arm/mp_machdep.c
--- a/sys/arm/arm/mp_machdep.c
+++ b/sys/arm/arm/mp_machdep.c
@@ -64,7 +64,6 @@
/* used to hold the AP's until we are ready to release them */
struct mtx ap_boot_mtx;
-struct pcb stoppcbs[MAXCPU];
/* # of Applications processors */
volatile int mp_naps;
diff --git a/sys/arm/include/kdb.h b/sys/arm/include/kdb.h
--- a/sys/arm/include/kdb.h
+++ b/sys/arm/include/kdb.h
@@ -36,8 +36,6 @@
#include <machine/frame.h>
#include <machine/psl.h>
-#define KDB_STOPPEDPCB(pc) &stoppcbs[pc->pc_cpuid]
-
extern void kdb_cpu_clear_singlestep(void);
extern void kdb_cpu_set_singlestep(void);
boolean_t kdb_cpu_pc_is_singlestep(db_addr_t);
diff --git a/sys/arm/include/smp.h b/sys/arm/include/smp.h
--- a/sys/arm/include/smp.h
+++ b/sys/arm/include/smp.h
@@ -29,7 +29,4 @@
void platform_mp_setmaxid(void);
void platform_mp_start_ap(void);
-/* global data in mp_machdep.c */
-extern struct pcb stoppcbs[];
-
#endif /* !_MACHINE_SMP_H_ */
diff --git a/sys/arm64/arm64/mp_machdep.c b/sys/arm64/arm64/mp_machdep.c
--- a/sys/arm64/arm64/mp_machdep.c
+++ b/sys/arm64/arm64/mp_machdep.c
@@ -126,8 +126,6 @@
static void ipi_rendezvous(void *);
static void ipi_stop(void *);
-struct pcb stoppcbs[MAXCPU];
-
#ifdef FDT
static u_int fdt_cpuid;
#endif
diff --git a/sys/arm64/include/smp.h b/sys/arm64/include/smp.h
--- a/sys/arm64/include/smp.h
+++ b/sys/arm64/include/smp.h
@@ -49,7 +49,4 @@
void ipi_cpu(int cpu, u_int ipi);
void ipi_selected(cpuset_t cpus, u_int ipi);
-/* global data in mp_machdep.c */
-extern struct pcb stoppcbs[];
-
#endif /* !_MACHINE_SMP_H_ */
diff --git a/sys/i386/include/kdb.h b/sys/i386/include/kdb.h
--- a/sys/i386/include/kdb.h
+++ b/sys/i386/include/kdb.h
@@ -34,8 +34,6 @@
#include <machine/frame.h>
#include <machine/psl.h>
-#define KDB_STOPPEDPCB(pc) &stoppcbs[pc->pc_cpuid]
-
int kdb_cpu_set_watchpoint(vm_offset_t addr, vm_size_t size, int access);
int kdb_cpu_clr_watchpoint(vm_offset_t addr, vm_size_t size);
diff --git a/sys/kern/subr_kdb.c b/sys/kern/subr_kdb.c
--- a/sys/kern/subr_kdb.c
+++ b/sys/kern/subr_kdb.c
@@ -627,18 +627,18 @@
struct pcb *
kdb_thr_ctx(struct thread *thr)
{
-#if defined(SMP) && defined(KDB_STOPPEDPCB)
+#ifdef SMP
struct pcpu *pc;
#endif
if (thr == curthread)
return (&kdb_pcb);
-#if defined(SMP) && defined(KDB_STOPPEDPCB)
+#ifdef SMP
STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
if (pc->pc_curthread == thr &&
CPU_ISSET(pc->pc_cpuid, &stopped_cpus))
- return (KDB_STOPPEDPCB(pc));
+ return (&stoppcbs[pc->pc_cpuid]);
}
#endif
return (thr->td_pcb);
diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c
--- a/sys/kern/subr_smp.c
+++ b/sys/kern/subr_smp.c
@@ -48,6 +48,7 @@
#include <sys/sysctl.h>
#include <machine/cpu.h>
+#include <machine/pcb.h>
#include <machine/smp.h>
#include "opt_sched.h"
@@ -76,6 +77,9 @@
volatile int smp_started;
u_int mp_maxid;
+/* Array of CPU contexts saved during a panic. */
+struct pcb *stoppcbs;
+
static SYSCTL_NODE(_kern, OID_AUTO, smp,
CTLFLAG_RD | CTLFLAG_CAPRD | CTLFLAG_MPSAFE, NULL,
"Kernel SMP");
@@ -178,6 +182,9 @@
if (mp_ncores < 0)
mp_ncores = mp_ncpus;
+ stoppcbs = mallocarray(mp_maxid + 1, sizeof(struct pcb), M_DEVBUF,
+ M_WAITOK | M_ZERO);
+
cpu_mp_announce();
}
SYSINIT(cpu_mp, SI_SUB_CPU, SI_ORDER_THIRD, mp_start, NULL);
diff --git a/sys/powerpc/include/kdb.h b/sys/powerpc/include/kdb.h
--- a/sys/powerpc/include/kdb.h
+++ b/sys/powerpc/include/kdb.h
@@ -40,8 +40,6 @@
void kdb_cpu_clear_singlestep(void);
void kdb_cpu_set_singlestep(void);
-#define KDB_STOPPEDPCB(pc) &stoppcbs[pc->pc_cpuid]
-
static __inline void
kdb_cpu_sync_icache(unsigned char *addr, size_t size)
{
diff --git a/sys/powerpc/include/smp.h b/sys/powerpc/include/smp.h
--- a/sys/powerpc/include/smp.h
+++ b/sys/powerpc/include/smp.h
@@ -61,8 +61,6 @@
void cpudep_ap_setup(void);
void machdep_ap_bootstrap(void);
-extern struct pcb stoppcbs[];
-
#endif /* !LOCORE */
#endif /* _KERNEL */
#endif /* !_MACHINE_SMP_H */
diff --git a/sys/powerpc/powerpc/mp_machdep.c b/sys/powerpc/powerpc/mp_machdep.c
--- a/sys/powerpc/powerpc/mp_machdep.c
+++ b/sys/powerpc/powerpc/mp_machdep.c
@@ -66,7 +66,6 @@
volatile static u_int ap_letgo;
volatile static u_quad_t ap_timebase;
static struct mtx ap_boot_mtx;
-struct pcb stoppcbs[MAXCPU];
void
machdep_ap_bootstrap(void)
diff --git a/sys/riscv/include/kdb.h b/sys/riscv/include/kdb.h
--- a/sys/riscv/include/kdb.h
+++ b/sys/riscv/include/kdb.h
@@ -31,8 +31,6 @@
#include <machine/cpufunc.h>
-#define KDB_STOPPEDPCB(pc) &stoppcbs[pc->pc_cpuid]
-
static __inline void
kdb_cpu_clear_singlestep(void)
{
diff --git a/sys/riscv/include/smp.h b/sys/riscv/include/smp.h
--- a/sys/riscv/include/smp.h
+++ b/sys/riscv/include/smp.h
@@ -52,6 +52,4 @@
void ipi_cpu(int cpu, u_int ipi);
void ipi_selected(cpuset_t cpus, u_int ipi);
-extern struct pcb stoppcbs[];
-
#endif /* !_MACHINE_SMP_H_ */
diff --git a/sys/riscv/riscv/mp_machdep.c b/sys/riscv/riscv/mp_machdep.c
--- a/sys/riscv/riscv/mp_machdep.c
+++ b/sys/riscv/riscv/mp_machdep.c
@@ -88,8 +88,6 @@
static int ipi_handler(void *);
-struct pcb stoppcbs[MAXCPU];
-
extern uint32_t boot_hart;
extern cpuset_t all_harts;
diff --git a/sys/sys/param.h b/sys/sys/param.h
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -76,7 +76,7 @@
* cannot include sys/param.h and should only be updated here.
*/
#undef __FreeBSD_version
-#define __FreeBSD_version 1400088
+#define __FreeBSD_version 1400089
/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
diff --git a/sys/sys/smp.h b/sys/sys/smp.h
--- a/sys/sys/smp.h
+++ b/sys/sys/smp.h
@@ -178,6 +178,9 @@
extern cpuset_t all_cpus;
extern cpuset_t cpuset_domain[MAXMEMDOM]; /* CPUs in each NUMA domain. */
+struct pcb;
+extern struct pcb *stoppcbs;
+
/*
* Macro allowing us to determine whether a CPU is absent at any given
* time, thus permitting us to configure sparse maps of cpuid-dependent
diff --git a/sys/x86/include/x86_smp.h b/sys/x86/include/x86_smp.h
--- a/sys/x86/include/x86_smp.h
+++ b/sys/x86/include/x86_smp.h
@@ -30,7 +30,6 @@
/* global data in mp_x86.c */
extern int mp_naps;
extern int boot_cpu_id;
-extern struct pcb stoppcbs[];
extern int cpu_apic_ids[];
extern int bootAP;
extern void *dpcpu;
diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c
--- a/sys/x86/x86/mp_x86.c
+++ b/sys/x86/x86/mp_x86.c
@@ -99,7 +99,6 @@
void *bootstacks[MAXCPU];
void *dpcpu;
-struct pcb stoppcbs[MAXCPU];
struct susppcb **susppcbs;
#ifdef COUNT_IPIS

File Metadata

Mime Type
text/plain
Expires
Thu, Sep 26, 7:25 PM (22 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
12856877
Default Alt Text
D39806.diff (6 KB)

Event Timeline