Skip to content

Commit d2bac7c

Browse files
JasonChenCJwenlingz
authored andcommitted
cpu_dead should only run on current pcpu
no need for input param pcpu_id. Tracked-On: #1842 Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent d2627ec commit d2bac7c

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

hypervisor/arch/x86/cpu.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,12 +598,16 @@ void cpu_do_idle(void)
598598
__asm __volatile("pause" ::: "memory");
599599
}
600600

601-
void cpu_dead(uint16_t pcpu_id)
601+
/**
602+
* only run on current pcpu
603+
*/
604+
void cpu_dead(void)
602605
{
603606
/* For debug purposes, using a stack variable in the while loop enables
604607
* us to modify the value using a JTAG probe and resume if needed.
605608
*/
606609
int32_t halt = 1;
610+
uint16_t pcpu_id = get_cpu_id();
607611

608612
if (bitmap_test_and_clear_lock(pcpu_id, &pcpu_active_bitmap)) {
609613
/* clean up native stuff */

hypervisor/arch/x86/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static void enter_guest_mode(uint16_t pcpu_id)
7272
default_idle();
7373

7474
/* Control should not come here */
75-
cpu_dead(pcpu_id);
75+
cpu_dead();
7676
}
7777

7878
static void bsp_boot_post(void)

hypervisor/arch/x86/irq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ void dispatch_exception(struct intr_excp_ctx *ctx)
376376
spinlock_release(&exception_spinlock);
377377

378378
/* Halt the CPU */
379-
cpu_dead(pcpu_id);
379+
cpu_dead();
380380
}
381381

382382
#ifdef CONFIG_PARTITION_MODE

hypervisor/common/schedule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ void default_idle(void)
175175
if (need_reschedule(pcpu_id) != 0) {
176176
schedule();
177177
} else if (need_offline(pcpu_id) != 0) {
178-
cpu_dead(pcpu_id);
178+
cpu_dead();
179179
} else {
180180
CPU_IRQ_ENABLE();
181181
handle_complete_ioreq(pcpu_id);

hypervisor/include/arch/x86/cpu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ extern struct cpuinfo_x86 boot_cpu_data;
306306

307307
/* Function prototypes */
308308
void cpu_do_idle(void);
309-
void cpu_dead(uint16_t pcpu_id);
309+
void cpu_dead(void);
310310
void trampoline_start16(void);
311311
bool is_apicv_reg_virtualization_supported(void);
312312
bool is_apicv_intr_delivery_supported(void);

0 commit comments

Comments
 (0)