diff --git a/hypervisor/arch/x86/lapic.c b/hypervisor/arch/x86/lapic.c index 1774dd708..df76348d1 100644 --- a/hypervisor/arch/x86/lapic.c +++ b/hypervisor/arch/x86/lapic.c @@ -254,7 +254,7 @@ void send_dest_ipi_mask(uint32_t dest_mask, uint32_t vector) pcpu_id = ffs64(mask); - while (pcpu_id != INVALID_BIT_INDEX) { + while (pcpu_id < CONFIG_MAX_PCPU_NUM) { bitmap32_clear_nolock(pcpu_id, &mask); if (bitmap_test(pcpu_id, &pcpu_active_bitmap)) { icr.value_32.hi_32 = per_cpu(lapic_id, pcpu_id); diff --git a/hypervisor/arch/x86/notify.c b/hypervisor/arch/x86/notify.c index 7e3ef679d..820a51aec 100644 --- a/hypervisor/arch/x86/notify.c +++ b/hypervisor/arch/x86/notify.c @@ -37,7 +37,7 @@ void smp_call_function(uint64_t mask, smp_call_func_t func, void *data) /* wait for previous smp call complete, which may run on other cpus */ while (atomic_cmpxchg64(&smp_call_mask, 0UL, mask & INVALID_BIT_INDEX) != 0UL); pcpu_id = ffs64(mask); - while (pcpu_id != INVALID_BIT_INDEX) { + while (pcpu_id < CONFIG_MAX_PCPU_NUM) { bitmap_clear_nolock(pcpu_id, &mask); if (bitmap_test(pcpu_id, &pcpu_active_bitmap)) { smp_call = &per_cpu(smp_call_info, pcpu_id);