Revert "cpuset(9): Add CPU_FOREACH_IS(SET|CLR) and modify consumers to use it"
This reverts commit 9068f6ea69
.
The underlying macro needs to be reworked to avoid problems with control
flow statements.
Reported by: rlibby
This commit is contained in:
parent
2e79a21632
commit
bcdc599dc2
@ -618,7 +618,7 @@ static void
|
||||
smp_targeted_tlb_shootdown(cpuset_t mask, pmap_t pmap, vm_offset_t addr1,
|
||||
vm_offset_t addr2, smp_invl_cb_t curcpu_cb, enum invl_op_codes op)
|
||||
{
|
||||
cpuset_t other_cpus;
|
||||
cpuset_t other_cpus, mask1;
|
||||
uint32_t generation, *p_cpudone;
|
||||
int cpu;
|
||||
bool is_all;
|
||||
@ -662,7 +662,10 @@ smp_targeted_tlb_shootdown(cpuset_t mask, pmap_t pmap, vm_offset_t addr1,
|
||||
/* Fence between filling smp_tlb fields and clearing scoreboard. */
|
||||
atomic_thread_fence_rel();
|
||||
|
||||
CPU_FOREACH_ISSET(cpu, &mask) {
|
||||
mask1 = mask;
|
||||
while ((cpu = CPU_FFS(&mask1)) != 0) {
|
||||
cpu--;
|
||||
CPU_CLR(cpu, &mask1);
|
||||
KASSERT(*invl_scoreboard_slot(cpu) != 0,
|
||||
("IPI scoreboard is zero, initiator %d target %d",
|
||||
PCPU_GET(cpuid), cpu));
|
||||
@ -683,7 +686,9 @@ smp_targeted_tlb_shootdown(cpuset_t mask, pmap_t pmap, vm_offset_t addr1,
|
||||
ipi_selected(mask, IPI_INVLOP);
|
||||
}
|
||||
curcpu_cb(pmap, addr1, addr2);
|
||||
CPU_FOREACH_ISSET(cpu, &other_cpus) {
|
||||
while ((cpu = CPU_FFS(&other_cpus)) != 0) {
|
||||
cpu--;
|
||||
CPU_CLR(cpu, &other_cpus);
|
||||
p_cpudone = invl_scoreboard_slot(cpu);
|
||||
while (atomic_load_int(p_cpudone) != generation)
|
||||
ia32_pause();
|
||||
|
@ -860,7 +860,10 @@ vlapic_calcdest(struct vm *vm, cpuset_t *dmask, uint32_t dest, bool phys,
|
||||
*/
|
||||
CPU_ZERO(dmask);
|
||||
amask = vm_active_cpus(vm);
|
||||
CPU_FOREACH_ISSET(vcpuid, &amask) {
|
||||
while ((vcpuid = CPU_FFS(&amask)) != 0) {
|
||||
vcpuid--;
|
||||
CPU_CLR(vcpuid, &amask);
|
||||
|
||||
vlapic = vm_lapic(vm, vcpuid);
|
||||
dfr = vlapic->apic_page->dfr;
|
||||
ldr = vlapic->apic_page->ldr;
|
||||
@ -1000,7 +1003,9 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool *retu)
|
||||
break;
|
||||
}
|
||||
|
||||
CPU_FOREACH_ISSET(i, &dmask) {
|
||||
while ((i = CPU_FFS(&dmask)) != 0) {
|
||||
i--;
|
||||
CPU_CLR(i, &dmask);
|
||||
if (mode == APIC_DELMODE_FIXED) {
|
||||
lapic_intr_edge(vlapic->vm, i, vec);
|
||||
vmm_stat_array_incr(vlapic->vm, vlapic->vcpuid,
|
||||
@ -1549,7 +1554,9 @@ vlapic_deliver_intr(struct vm *vm, bool level, uint32_t dest, bool phys,
|
||||
*/
|
||||
vlapic_calcdest(vm, &dmask, dest, phys, lowprio, false);
|
||||
|
||||
CPU_FOREACH_ISSET(vcpuid, &dmask) {
|
||||
while ((vcpuid = CPU_FFS(&dmask)) != 0) {
|
||||
vcpuid--;
|
||||
CPU_CLR(vcpuid, &dmask);
|
||||
if (delmode == IOART_DELEXINT) {
|
||||
vm_inject_extint(vm, vcpuid);
|
||||
} else {
|
||||
|
@ -87,7 +87,9 @@ lapic_set_local_intr(struct vm *vm, int cpu, int vector)
|
||||
else
|
||||
CPU_SETOF(cpu, &dmask);
|
||||
error = 0;
|
||||
CPU_FOREACH_ISSET(cpu, &dmask) {
|
||||
while ((cpu = CPU_FFS(&dmask)) != 0) {
|
||||
cpu--;
|
||||
CPU_CLR(cpu, &dmask);
|
||||
vlapic = vm_lapic(vm, cpu);
|
||||
error = vlapic_trigger_lvt(vlapic, vector);
|
||||
if (error)
|
||||
|
@ -598,7 +598,9 @@ smp_targeted_tlb_shootdown(cpuset_t mask, u_int vector, pmap_t pmap,
|
||||
ipi_selected(mask, vector);
|
||||
}
|
||||
curcpu_cb(pmap, addr1, addr2);
|
||||
CPU_FOREACH_ISSET(cpu, &other_cpus) {
|
||||
while ((cpu = CPU_FFS(&other_cpus)) != 0) {
|
||||
cpu--;
|
||||
CPU_CLR(cpu, &other_cpus);
|
||||
p_cpudone = &cpuid_to_pcpu[cpu]->pc_smp_tlb_done;
|
||||
while (*p_cpudone != generation)
|
||||
ia32_pause();
|
||||
|
@ -66,8 +66,6 @@
|
||||
#define CPU_COPY_STORE_REL(f, t) BIT_COPY_STORE_REL(CPU_SETSIZE, f, t)
|
||||
#define CPU_FFS(p) BIT_FFS(CPU_SETSIZE, p)
|
||||
#define CPU_FLS(p) BIT_FLS(CPU_SETSIZE, p)
|
||||
#define CPU_FOREACH_ISSET(i, p) BIT_FOREACH_ISSET(CPU_SETSIZE, i, p)
|
||||
#define CPU_FOREACH_ISCLR(i, p) BIT_FOREACH_ISCLR(CPU_SETSIZE, i, p)
|
||||
#define CPU_COUNT(p) ((int)BIT_COUNT(CPU_SETSIZE, p))
|
||||
#define CPUSET_FSET BITSET_FSET(_NCPUWORDS)
|
||||
#define CPUSET_T_INITIALIZER BITSET_T_INITIALIZER
|
||||
|
@ -1290,7 +1290,9 @@ ipi_selected(cpuset_t cpus, u_int ipi)
|
||||
if (ipi == IPI_STOP_HARD)
|
||||
CPU_OR_ATOMIC(&ipi_stop_nmi_pending, &cpus);
|
||||
|
||||
CPU_FOREACH_ISSET(cpu, &cpus) {
|
||||
while ((cpu = CPU_FFS(&cpus)) != 0) {
|
||||
cpu--;
|
||||
CPU_CLR(cpu, &cpus);
|
||||
CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi);
|
||||
ipi_send_cpu(cpu, ipi);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user