mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-22 01:07:57 +00:00
hv: sched: decouple scheduler from schedule framework
This patch decouple some scheduling logic and abstract into a scheduler. Then we have scheduler, schedule framework. From modulization perspective, schedule framework provides some APIs for other layers to use, also interact with scheduler through scheduler interaces. Tracked-On: #3813 Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com> Signed-off-by: Yu Wang <yu1.wang@intel.com> Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -409,6 +409,7 @@ void cpu_dead(void)
|
||||
int32_t halt = 1;
|
||||
uint16_t pcpu_id = get_pcpu_id();
|
||||
|
||||
deinit_sched(pcpu_id);
|
||||
if (bitmap_test(pcpu_id, &pcpu_active_bitmap)) {
|
||||
/* clean up native stuff */
|
||||
vmx_off();
|
||||
|
@@ -729,17 +729,14 @@ static void context_switch_in(struct thread_object *next)
|
||||
vcpu->running = true;
|
||||
}
|
||||
|
||||
void schedule_vcpu(struct acrn_vcpu *vcpu)
|
||||
void launch_vcpu(struct acrn_vcpu *vcpu)
|
||||
{
|
||||
uint16_t pcpu_id = pcpuid_from_vcpu(vcpu);
|
||||
|
||||
vcpu->state = VCPU_RUNNING;
|
||||
pr_dbg("vcpu%hu scheduled on pcpu%hu", vcpu->vcpu_id, pcpu_id);
|
||||
|
||||
get_schedule_lock(pcpu_id);
|
||||
insert_thread_obj(&vcpu->thread_obj, pcpu_id);
|
||||
make_reschedule_request(pcpu_id, DEL_MODE_IPI);
|
||||
release_schedule_lock(pcpu_id);
|
||||
wake_thread(&vcpu->thread_obj);
|
||||
}
|
||||
|
||||
/* help function for vcpu create */
|
||||
@@ -761,6 +758,7 @@ int32_t prepare_vcpu(struct acrn_vm *vm, uint16_t pcpu_id)
|
||||
vcpu->thread_obj.host_sp = build_stack_frame(vcpu);
|
||||
vcpu->thread_obj.switch_out = context_switch_out;
|
||||
vcpu->thread_obj.switch_in = context_switch_in;
|
||||
init_thread_data(&vcpu->thread_obj);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@@ -1172,7 +1172,7 @@ vlapic_process_init_sipi(struct acrn_vcpu* target_vcpu, uint32_t mode, uint32_t
|
||||
set_vcpu_startup_entry(target_vcpu, (icr_low & APIC_VECTOR_MASK) << 12U);
|
||||
/* init vmcs after set_vcpu_startup_entry */
|
||||
init_vmcs(target_vcpu);
|
||||
schedule_vcpu(target_vcpu);
|
||||
launch_vcpu(target_vcpu);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@@ -642,7 +642,7 @@ void start_vm(struct acrn_vm *vm)
|
||||
/* Only start BSP (vid = 0) and let BSP start other APs */
|
||||
bsp = vcpu_from_vid(vm, BOOT_CPU_ID);
|
||||
init_vmcs(bsp);
|
||||
schedule_vcpu(bsp);
|
||||
launch_vcpu(bsp);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -766,7 +766,7 @@ void resume_vm_from_s3(struct acrn_vm *vm, uint32_t wakeup_vec)
|
||||
set_vcpu_startup_entry(bsp, wakeup_vec);
|
||||
|
||||
init_vmcs(bsp);
|
||||
schedule_vcpu(bsp);
|
||||
launch_vcpu(bsp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user