From: visa Date: Sat, 24 Jul 2021 08:21:13 +0000 (+0000) Subject: Replace cpus_running with CPU_IS_RUNNING(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f016eb6377a451cc975f0ec2341063807e1e2c31;p=openbsd Replace cpus_running with CPU_IS_RUNNING(). --- diff --git a/sys/arch/loongson/loongson/generic3a_machdep.c b/sys/arch/loongson/loongson/generic3a_machdep.c index 63e29efc4dd..28d09905bc3 100644 --- a/sys/arch/loongson/loongson/generic3a_machdep.c +++ b/sys/arch/loongson/loongson/generic3a_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: generic3a_machdep.c,v 1.10 2020/07/21 05:56:02 visa Exp $ */ +/* $OpenBSD: generic3a_machdep.c,v 1.11 2021/07/24 08:21:13 visa Exp $ */ /* * Copyright (c) 2009, 2010, 2012 Miodrag Vallat. @@ -317,8 +317,8 @@ generic3a_boot_secondary_cpu(struct cpu_info *ci) REGVAL64(ls3_ipi_base[ci->ci_cpuid] + LS3_IPI_MBOX0) = (uint64_t)hw_cpu_spinup_trampoline; /* pc */ - while (!cpuset_isset(&cpus_running, ci)) - continue; + while (!CPU_IS_RUNNING(ci)) + membar_sync(); } int diff --git a/sys/arch/loongson/loongson/machdep.c b/sys/arch/loongson/loongson/machdep.c index 073fd407364..536110279ad 100644 --- a/sys/arch/loongson/loongson/machdep.c +++ b/sys/arch/loongson/loongson/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.98 2021/07/12 09:32:37 visa Exp $ */ +/* $OpenBSD: machdep.c,v 1.99 2021/07/24 08:21:13 visa Exp $ */ /* * Copyright (c) 2009, 2010, 2014 Miodrag Vallat. @@ -1308,7 +1308,6 @@ hw_cpu_hatch(struct cpu_info *ci) membar_sync(); ncpus++; - cpuset_add(&cpus_running, ci); spl0(); (void)updateimask(0); diff --git a/sys/arch/mips64/include/cpu.h b/sys/arch/mips64/include/cpu.h index 57aa201089a..d3831070284 100644 --- a/sys/arch/mips64/include/cpu.h +++ b/sys/arch/mips64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.135 2021/07/06 09:34:06 kettenis Exp $ */ +/* $OpenBSD: cpu.h,v 1.136 2021/07/24 08:21:13 visa Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -228,7 +228,6 @@ extern struct cpu_info *get_cpu_info(int); #define CPU_IS_RUNNING(ci) ((ci)->ci_flags & CPUF_RUNNING) #define cpu_number() (curcpu()->ci_cpuid) -extern struct cpuset cpus_running; void cpu_unidle(struct cpu_info *); void cpu_boot_secondary_processors(void); #define cpu_boot_secondary(ci) hw_cpu_boot_secondary(ci) diff --git a/sys/arch/mips64/mips64/cpu.c b/sys/arch/mips64/mips64/cpu.c index 2d1998c1165..9b818c040c3 100644 --- a/sys/arch/mips64/mips64/cpu.c +++ b/sys/arch/mips64/mips64/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.79 2021/05/28 16:33:36 visa Exp $ */ +/* $OpenBSD: cpu.c,v 1.80 2021/07/24 08:21:13 visa Exp $ */ /* * Copyright (c) 1997-2004 Opsycon AB (www.opsycon.se) @@ -45,9 +45,6 @@ void cpuattach(struct device *, struct device *, void *); struct cpu_info cpu_info_primary; struct cpu_info *cpu_info_list = &cpu_info_primary; struct cpu_info *cpu_info_secondaries; -#ifdef MULTIPROCESSOR -struct cpuset cpus_running; -#endif extern void cpu_idle_cycle_nop(void); extern void cpu_idle_cycle_wait(void); @@ -90,7 +87,6 @@ cpuattach(struct device *parent, struct device *dev, void *aux) ci = &cpu_info_primary; #ifdef MULTIPROCESSOR ci->ci_flags |= CPUF_RUNNING | CPUF_PRESENT | CPUF_PRIMARY; - cpuset_add(&cpus_running, ci); if (ncpusfound > 1) { cpu_info_secondaries = (struct cpu_info *) alloc_contiguous_pages(sizeof(struct cpu_info) * diff --git a/sys/arch/mips64/mips64/ipifuncs.c b/sys/arch/mips64/mips64/ipifuncs.c index c23a12948d4..ea0eb72abaa 100644 --- a/sys/arch/mips64/mips64/ipifuncs.c +++ b/sys/arch/mips64/mips64/ipifuncs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipifuncs.c,v 1.23 2021/07/20 07:53:39 visa Exp $ */ +/* $OpenBSD: ipifuncs.c,v 1.24 2021/07/24 08:21:13 visa Exp $ */ /* $NetBSD: ipifuncs.c,v 1.40 2008/04/28 20:23:10 martin Exp $ */ /*- @@ -130,8 +130,8 @@ do_send_ipi(unsigned int cpuid, unsigned int ipimask) if (ci == NULL) panic("mips_send_ipi: bogus cpu_id"); - if (!cpuset_isset(&cpus_running, ci)) - panic("mips_send_ipi: CPU %u not running", cpuid); + if (!CPU_IS_RUNNING(ci)) + panic("mips_send_ipi: CPU %u not running", cpuid); #endif atomic_setbits_int(&ipi_mailbox[cpuid], ipimask); @@ -172,8 +172,7 @@ mips64_multicast_ipi(unsigned int cpumask, unsigned int ipimask) membar_producer(); CPU_INFO_FOREACH(cii, ci) { - if (!(cpumask & (1UL << ci->ci_cpuid)) || - !cpuset_isset(&cpus_running, ci)) + if (!(cpumask & (1UL << ci->ci_cpuid)) || !CPU_IS_RUNNING(ci)) continue; do_send_ipi(ci->ci_cpuid, ipimask); } diff --git a/sys/arch/mips64/mips64/pmap.c b/sys/arch/mips64/mips64/pmap.c index 986bea417df..23fbd162bd2 100644 --- a/sys/arch/mips64/mips64/pmap.c +++ b/sys/arch/mips64/mips64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.118 2021/05/05 15:29:19 visa Exp $ */ +/* $OpenBSD: pmap.c,v 1.119 2021/07/24 08:21:13 visa Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -250,7 +250,7 @@ pmap_invalidate_icache(pmap_t pmap, vaddr_t va, pt_entry_t entry) pmap_swlock(pmap); CPU_INFO_FOREACH(cii, ci) { - if (cpuset_isset(&cpus_running, ci) && + if (CPU_IS_RUNNING(ci) && pmap->pm_asid[ci->ci_cpuid].pma_asidgen != 0) cpumask |= 1ul << ci->ci_cpuid; } @@ -293,7 +293,7 @@ pmap_shootdown_range(pmap_t pmap, vaddr_t sva, vaddr_t eva, int needisync) CPU_INFO_FOREACH(cii, ci) { if (ci == self) continue; - if (!cpuset_isset(&cpus_running, ci)) + if (!CPU_IS_RUNNING(ci)) continue; if (pmap != pmap_kernel()) { if (pmap->pm_asid[ci->ci_cpuid].pma_asidgen != diff --git a/sys/arch/octeon/octeon/machdep.c b/sys/arch/octeon/octeon/machdep.c index efe28175601..188d66edefe 100644 --- a/sys/arch/octeon/octeon/machdep.c +++ b/sys/arch/octeon/octeon/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.133 2021/07/12 09:32:37 visa Exp $ */ +/* $OpenBSD: machdep.c,v 1.134 2021/07/24 08:21:13 visa Exp $ */ /* * Copyright (c) 2009, 2010 Miodrag Vallat. @@ -1296,8 +1296,8 @@ hw_cpu_boot_secondary(struct cpu_info *ci) cpu_spinup_mask = (uint32_t)ci->ci_cpuid; - while (!cpuset_isset(&cpus_running, ci)) - ; + while (!CPU_IS_RUNNING(ci)) + membar_sync(); } void @@ -1338,7 +1338,6 @@ hw_cpu_hatch(struct cpu_info *ci) membar_sync(); ncpus++; - cpuset_add(&cpus_running, ci); spl0(); (void)updateimask(0);