hv: sched: decouple idle stuff from schedule module

Let init thread end with run_idle_thread(), then idle thread take over and
start to do scheduling.
Change enter_guest_mode() to init_guest_mode() as run_idle_thread() is removed
out of it. Also add run_thread() in schedule module to run
thread_object's thread loop directly.

rename: switch_to_idle -> run_idle_thread

Tracked-On: #3813
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Shuo A Liu
2019-10-16 19:16:37 +08:00
committed by ACRN System Integration
parent 27163df9b1
commit 0f70a5ca3a
5 changed files with 36 additions and 32 deletions

View File

@@ -611,7 +611,7 @@ static uint64_t build_stack_frame(struct acrn_vcpu *vcpu)
frame -= 1;
frame->magic = SP_BOTTOM_MAGIC;
frame->rip = (uint64_t)run_sched_thread; /*return address*/
frame->rip = (uint64_t)vcpu->thread_obj.thread_entry; /*return address*/
frame->rflag = 0UL;
frame->rbx = 0UL;
frame->rbp = 0UL;

View File

@@ -49,16 +49,11 @@ static void init_debug_post(uint16_t pcpu_id)
}
/*TODO: move into guest-vcpu module */
static void enter_guest_mode(uint16_t pcpu_id)
static void init_guest_mode(uint16_t pcpu_id)
{
vmx_on();
launch_vms(pcpu_id);
switch_to_idle(default_idle);
/* Control should not come here */
cpu_dead();
}
static void init_primary_pcpu_post(void)
@@ -71,7 +66,9 @@ static void init_primary_pcpu_post(void)
init_debug_post(BOOT_CPU_ID);
enter_guest_mode(BOOT_CPU_ID);
init_guest_mode(BOOT_CPU_ID);
run_idle_thread();
}
/* NOTE: this function is using temp stack, and after SWITCH_TO(runtime_sp, to)
@@ -101,5 +98,7 @@ void init_secondary_pcpu(void)
init_debug_post(pcpu_id);
enter_guest_mode(pcpu_id);
init_guest_mode(pcpu_id);
run_idle_thread();
}