mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 09:47:44 +00:00
hv: move pcpu offline request and vm shutdown request from schedule
From modulization perspective, it's not suitable to put pcpu and vm related request operations in schedule. So move them to pcpu and vm module respectively. Also change need_offline return value to bool. Tracked-On: #3663 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>
This commit is contained in:
@@ -126,40 +126,6 @@ bool need_reschedule(uint16_t pcpu_id)
|
||||
return bitmap_test(NEED_RESCHEDULE, &ctx->flags);
|
||||
}
|
||||
|
||||
void make_pcpu_offline(uint16_t pcpu_id)
|
||||
{
|
||||
struct sched_context *ctx = &per_cpu(sched_ctx, pcpu_id);
|
||||
|
||||
bitmap_set_lock(NEED_OFFLINE, &ctx->flags);
|
||||
if (get_pcpu_id() != pcpu_id) {
|
||||
send_single_ipi(pcpu_id, VECTOR_NOTIFY_VCPU);
|
||||
}
|
||||
}
|
||||
|
||||
bool need_offline(uint16_t pcpu_id)
|
||||
{
|
||||
struct sched_context *ctx = &per_cpu(sched_ctx, pcpu_id);
|
||||
|
||||
return bitmap_test_and_clear_lock(NEED_OFFLINE, &ctx->flags);
|
||||
}
|
||||
|
||||
void make_shutdown_vm_request(uint16_t pcpu_id)
|
||||
{
|
||||
struct sched_context *ctx = &per_cpu(sched_ctx, pcpu_id);
|
||||
|
||||
bitmap_set_lock(NEED_SHUTDOWN_VM, &ctx->flags);
|
||||
if (get_pcpu_id() != pcpu_id) {
|
||||
send_single_ipi(pcpu_id, VECTOR_NOTIFY_VCPU);
|
||||
}
|
||||
}
|
||||
|
||||
bool need_shutdown_vm(uint16_t pcpu_id)
|
||||
{
|
||||
struct sched_context *ctx = &per_cpu(sched_ctx, pcpu_id);
|
||||
|
||||
return bitmap_test_and_clear_lock(NEED_SHUTDOWN_VM, &ctx->flags);
|
||||
}
|
||||
|
||||
static void prepare_switch(struct sched_object *prev, struct sched_object *next)
|
||||
{
|
||||
if ((prev != NULL) && (prev->prepare_switch_out != NULL)) {
|
||||
|
Reference in New Issue
Block a user