svn commit: r222507 - in projects/pseries: i386/pci ia64/ia64 kern
mips/mips net powerpc/booke powerpc/powerpc sparc64/sparc64 sys
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Mon May 30 19:16:59 UTC 2011
Author: nwhitehorn
Date: Mon May 30 19:16:58 2011
New Revision: 222507
URL: http://svn.freebsd.org/changeset/base/222507
Log:
Follow up r222356 by converting the PCPU list from an SLIST to an STAILQ,
which is a cleaner solution.
Modified:
projects/pseries/i386/pci/pci_cfgreg.c
projects/pseries/ia64/ia64/machdep.c
projects/pseries/ia64/ia64/mp_machdep.c
projects/pseries/ia64/ia64/pmap.c
projects/pseries/kern/kern_idle.c
projects/pseries/kern/sched_4bsd.c
projects/pseries/kern/subr_kdb.c
projects/pseries/kern/subr_pcpu.c
projects/pseries/mips/mips/mp_machdep.c
projects/pseries/net/netisr.c
projects/pseries/powerpc/booke/pmap.c
projects/pseries/powerpc/powerpc/mp_machdep.c
projects/pseries/sparc64/sparc64/mp_machdep.c
projects/pseries/sparc64/sparc64/pmap.c
projects/pseries/sys/pcpu.h
Modified: projects/pseries/i386/pci/pci_cfgreg.c
==============================================================================
--- projects/pseries/i386/pci/pci_cfgreg.c Mon May 30 18:57:31 2011 (r222506)
+++ projects/pseries/i386/pci/pci_cfgreg.c Mon May 30 19:16:58 2011 (r222507)
@@ -553,7 +553,7 @@ pcie_cfgregopen(uint64_t base, uint8_t m
(uintmax_t)base);
#ifdef SMP
- SLIST_FOREACH(pc, &cpuhead, pc_allcpu)
+ STAILQ_FOREACH(pc, &cpuhead, pc_allcpu)
#endif
{
Modified: projects/pseries/ia64/ia64/machdep.c
==============================================================================
--- projects/pseries/ia64/ia64/machdep.c Mon May 30 18:57:31 2011 (r222506)
+++ projects/pseries/ia64/ia64/machdep.c Mon May 30 19:16:58 2011 (r222507)
@@ -316,7 +316,7 @@ cpu_startup(void *dummy)
/*
* Create sysctl tree for per-CPU information.
*/
- SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
+ STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
snprintf(nodename, sizeof(nodename), "%u", pc->pc_cpuid);
sysctl_ctx_init(&pc->pc_md.sysctl_ctx);
pc->pc_md.sysctl_tree = SYSCTL_ADD_NODE(&pc->pc_md.sysctl_ctx,
Modified: projects/pseries/ia64/ia64/mp_machdep.c
==============================================================================
--- projects/pseries/ia64/ia64/mp_machdep.c Mon May 30 18:57:31 2011 (r222506)
+++ projects/pseries/ia64/ia64/mp_machdep.c Mon May 30 19:16:58 2011 (r222507)
@@ -357,7 +357,7 @@ cpu_mp_start()
/* Keep 'em spinning until we unleash them... */
ia64_ap_state.as_spin = 1;
- SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
+ STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
pc->pc_md.current_pmap = kernel_pmap;
pc->pc_other_cpus = all_cpus & ~pc->pc_cpumask;
/* The BSP is obviously running already. */
@@ -424,7 +424,7 @@ cpu_mp_unleash(void *dummy)
cpus = 0;
smp_cpus = 0;
- SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
+ STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
cpus++;
if (pc->pc_md.awake) {
kproc_create(ia64_store_mca_state, pc, NULL, 0, 0,
@@ -462,7 +462,7 @@ ipi_selected(cpumask_t cpus, int ipi)
{
struct pcpu *pc;
- SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
+ STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
if (cpus & pc->pc_cpumask)
ipi_send(pc, ipi);
}
@@ -486,7 +486,7 @@ ipi_all_but_self(int ipi)
{
struct pcpu *pc;
- SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
+ STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
if (pc != pcpup)
ipi_send(pc, ipi);
}
Modified: projects/pseries/ia64/ia64/pmap.c
==============================================================================
--- projects/pseries/ia64/ia64/pmap.c Mon May 30 18:57:31 2011 (r222506)
+++ projects/pseries/ia64/ia64/pmap.c Mon May 30 19:16:58 2011 (r222507)
@@ -535,7 +535,7 @@ pmap_invalidate_page(vm_offset_t va)
critical_enter();
vhpt_ofs = ia64_thash(va) - PCPU_GET(md.vhpt);
tag = ia64_ttag(va);
- SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
+ STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
pte = (struct ia64_lpte *)(pc->pc_md.vhpt + vhpt_ofs);
atomic_cmpset_64(&pte->tag, tag, 1UL << 63);
}
Modified: projects/pseries/kern/kern_idle.c
==============================================================================
--- projects/pseries/kern/kern_idle.c Mon May 30 18:57:31 2011 (r222506)
+++ projects/pseries/kern/kern_idle.c Mon May 30 19:16:58 2011 (r222507)
@@ -60,7 +60,7 @@ idle_setup(void *dummy)
p = NULL; /* start with no idle process */
#ifdef SMP
- SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
+ STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
#endif
#ifdef SMP
error = kproc_kthread_add(sched_idletd, NULL, &p, &td,
Modified: projects/pseries/kern/sched_4bsd.c
==============================================================================
--- projects/pseries/kern/sched_4bsd.c Mon May 30 18:57:31 2011 (r222506)
+++ projects/pseries/kern/sched_4bsd.c Mon May 30 19:16:58 2011 (r222507)
@@ -1081,7 +1081,7 @@ forward_wakeup(int cpunum)
dontuse = me | stopped_cpus | hlt_cpus_mask;
map2 = 0;
if (forward_wakeup_use_loop) {
- SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
+ STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
id = pc->pc_cpumask;
if ((id & dontuse) == 0 &&
pc->pc_curthread == pc->pc_idlethread) {
@@ -1112,7 +1112,7 @@ forward_wakeup(int cpunum)
}
if (map) {
forward_wakeups_delivered++;
- SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
+ STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
id = pc->pc_cpumask;
if ((map & id) == 0)
continue;
Modified: projects/pseries/kern/subr_kdb.c
==============================================================================
--- projects/pseries/kern/subr_kdb.c Mon May 30 18:57:31 2011 (r222506)
+++ projects/pseries/kern/subr_kdb.c Mon May 30 19:16:58 2011 (r222507)
@@ -412,7 +412,7 @@ kdb_thr_ctx(struct thread *thr)
return (&kdb_pcb);
#if defined(SMP) && defined(KDB_STOPPEDPCB)
- SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
+ STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
if (pc->pc_curthread == thr && (stopped_cpus & pc->pc_cpumask))
return (KDB_STOPPEDPCB(pc));
}
Modified: projects/pseries/kern/subr_pcpu.c
==============================================================================
--- projects/pseries/kern/subr_pcpu.c Mon May 30 18:57:31 2011 (r222506)
+++ projects/pseries/kern/subr_pcpu.c Mon May 30 19:16:58 2011 (r222507)
@@ -74,7 +74,7 @@ static TAILQ_HEAD(, dpcpu_free) dpcpu_he
static struct sx dpcpu_lock;
uintptr_t dpcpu_off[MAXCPU];
struct pcpu *cpuid_to_pcpu[MAXCPU];
-struct cpuhead cpuhead = SLIST_HEAD_INITIALIZER(cpuhead);
+struct cpuhead cpuhead = STAILQ_HEAD_INITIALIZER(cpuhead);
/*
* Initialize the MI portions of a struct pcpu.
@@ -82,7 +82,6 @@ struct cpuhead cpuhead = SLIST_HEAD_INIT
void
pcpu_init(struct pcpu *pcpu, int cpuid, size_t size)
{
- struct pcpu *tail;
bzero(pcpu, size);
KASSERT(cpuid >= 0 && cpuid < MAXCPU,
@@ -90,17 +89,7 @@ pcpu_init(struct pcpu *pcpu, int cpuid,
pcpu->pc_cpuid = cpuid;
pcpu->pc_cpumask = 1 << cpuid;
cpuid_to_pcpu[cpuid] = pcpu;
- /*
- * It may be important that the CPU list stay ordered, so try to
- * install this PCPU at the end of the list instead of the beginning.
- */
- for (tail = SLIST_FIRST(&cpuhead); tail != NULL &&
- SLIST_NEXT(tail, pc_allcpu) != NULL;
- tail = SLIST_NEXT(tail, pc_allcpu)) {}
- if (tail != NULL)
- SLIST_INSERT_AFTER(tail, pcpu, pc_allcpu);
- else
- SLIST_INSERT_HEAD(&cpuhead, pcpu, pc_allcpu);
+ STAILQ_INSERT_TAIL(&cpuhead, pcpu, pc_allcpu);
cpu_pcpu_init(pcpu, cpuid, size);
pcpu->pc_rm_queue.rmq_next = &pcpu->pc_rm_queue;
pcpu->pc_rm_queue.rmq_prev = &pcpu->pc_rm_queue;
@@ -256,7 +245,7 @@ void
pcpu_destroy(struct pcpu *pcpu)
{
- SLIST_REMOVE(&cpuhead, pcpu, pcpu, pc_allcpu);
+ STAILQ_REMOVE(&cpuhead, pcpu, pcpu, pc_allcpu);
cpuid_to_pcpu[pcpu->pc_cpuid] = NULL;
dpcpu_off[pcpu->pc_cpuid] = 0;
}
Modified: projects/pseries/mips/mips/mp_machdep.c
==============================================================================
--- projects/pseries/mips/mips/mp_machdep.c Mon May 30 18:57:31 2011 (r222506)
+++ projects/pseries/mips/mips/mp_machdep.c Mon May 30 19:16:58 2011 (r222507)
@@ -86,7 +86,7 @@ ipi_selected(cpumask_t cpus, int ipi)
CTR3(KTR_SMP, "%s: cpus: %x, ipi: %x\n", __func__, cpus, ipi);
- SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
+ STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
if ((cpus & pc->pc_cpumask) != 0)
ipi_send(pc, ipi);
}
Modified: projects/pseries/net/netisr.c
==============================================================================
--- projects/pseries/net/netisr.c Mon May 30 18:57:31 2011 (r222506)
+++ projects/pseries/net/netisr.c Mon May 30 19:16:58 2011 (r222507)
@@ -1221,7 +1221,7 @@ netisr_start(void *arg)
{
struct pcpu *pc;
- SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
+ STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
if (nws_count >= netisr_maxthreads)
break;
/* XXXRW: Is skipping absent CPUs still required here? */
Modified: projects/pseries/powerpc/booke/pmap.c
==============================================================================
--- projects/pseries/powerpc/booke/pmap.c Mon May 30 18:57:31 2011 (r222506)
+++ projects/pseries/powerpc/booke/pmap.c Mon May 30 19:16:58 2011 (r222507)
@@ -393,7 +393,7 @@ tlb_miss_lock(void)
if (!smp_started)
return;
- SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
+ STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
if (pc != pcpup) {
CTR3(KTR_PMAP, "%s: tlb miss LOCK of CPU=%d, "
@@ -419,7 +419,7 @@ tlb_miss_unlock(void)
if (!smp_started)
return;
- SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
+ STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
if (pc != pcpup) {
CTR2(KTR_PMAP, "%s: tlb miss UNLOCK of CPU=%d",
__func__, pc->pc_cpuid);
Modified: projects/pseries/powerpc/powerpc/mp_machdep.c
==============================================================================
--- projects/pseries/powerpc/powerpc/mp_machdep.c Mon May 30 18:57:31 2011 (r222506)
+++ projects/pseries/powerpc/powerpc/mp_machdep.c Mon May 30 19:16:58 2011 (r222507)
@@ -212,7 +212,7 @@ cpu_mp_unleash(void *dummy)
cpus = 0;
smp_cpus = 0;
- SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
+ STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
cpus++;
pc->pc_other_cpus = all_cpus & ~pc->pc_cpumask;
if (!pc->pc_bsp) {
@@ -347,7 +347,7 @@ ipi_selected(cpumask_t cpus, int ipi)
{
struct pcpu *pc;
- SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
+ STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
if (cpus & pc->pc_cpumask)
ipi_send(pc, ipi);
}
@@ -367,7 +367,7 @@ ipi_all_but_self(int ipi)
{
struct pcpu *pc;
- SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
+ STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
if (pc != pcpup)
ipi_send(pc, ipi);
}
Modified: projects/pseries/sparc64/sparc64/mp_machdep.c
==============================================================================
--- projects/pseries/sparc64/sparc64/mp_machdep.c Mon May 30 18:57:31 2011 (r222506)
+++ projects/pseries/sparc64/sparc64/mp_machdep.c Mon May 30 19:16:58 2011 (r222507)
@@ -383,7 +383,7 @@ cpu_mp_unleash(void *v)
ctx_inc = (TLB_CTX_USER_MAX - 1) / mp_ncpus;
csa = &cpu_start_args;
csa->csa_count = mp_ncpus;
- SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
+ STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
pc->pc_tlb_ctx = ctx_min;
pc->pc_tlb_ctx_min = ctx_min;
pc->pc_tlb_ctx_max = ctx_min + ctx_inc;
Modified: projects/pseries/sparc64/sparc64/pmap.c
==============================================================================
--- projects/pseries/sparc64/sparc64/pmap.c Mon May 30 18:57:31 2011 (r222506)
+++ projects/pseries/sparc64/sparc64/pmap.c Mon May 30 19:16:58 2011 (r222507)
@@ -1278,7 +1278,7 @@ pmap_release(pmap_t pm)
* to a kernel thread, leaving the pmap pointer unchanged.
*/
mtx_lock_spin(&sched_lock);
- SLIST_FOREACH(pc, &cpuhead, pc_allcpu)
+ STAILQ_FOREACH(pc, &cpuhead, pc_allcpu)
if (pc->pc_pmap == pm)
pc->pc_pmap = NULL;
mtx_unlock_spin(&sched_lock);
Modified: projects/pseries/sys/pcpu.h
==============================================================================
--- projects/pseries/sys/pcpu.h Mon May 30 18:57:31 2011 (r222506)
+++ projects/pseries/sys/pcpu.h Mon May 30 19:16:58 2011 (r222507)
@@ -164,7 +164,7 @@ struct pcpu {
u_int pc_cpuid; /* This cpu number */
cpumask_t pc_cpumask; /* This cpu mask */
cpumask_t pc_other_cpus; /* Mask of all other cpus */
- SLIST_ENTRY(pcpu) pc_allcpu;
+ STAILQ_ENTRY(pcpu) pc_allcpu;
struct lock_list_entry *pc_spinlocks;
#ifdef KTR
char pc_name[PCPU_NAME_LEN]; /* String name for KTR */
@@ -201,7 +201,7 @@ struct pcpu {
#ifdef _KERNEL
-SLIST_HEAD(cpuhead, pcpu);
+STAILQ_HEAD(cpuhead, pcpu);
extern struct cpuhead cpuhead;
extern struct pcpu *cpuid_to_pcpu[MAXCPU];
More information about the svn-src-projects
mailing list