From 8aae0dff87f0d97dc1cfd7788a6d22c0af62716a Mon Sep 17 00:00:00 2001 From: Jason Chen CJ Date: Thu, 20 Dec 2018 13:09:58 +0800 Subject: [PATCH] scheduler: refine make_reschedule_request just use pcpu_id for make_reschedule_request is enough Tracked-On: #1842 Signed-off-by: Jason Chen CJ Acked-by: Anthony Xu Acked-by: Eddie Dong --- hypervisor/arch/x86/guest/vcpu.c | 6 +++--- hypervisor/common/schedule.c | 8 ++++---- hypervisor/include/common/schedule.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hypervisor/arch/x86/guest/vcpu.c b/hypervisor/arch/x86/guest/vcpu.c index 0de0ce70f..b22097981 100644 --- a/hypervisor/arch/x86/guest/vcpu.c +++ b/hypervisor/arch/x86/guest/vcpu.c @@ -573,7 +573,7 @@ void pause_vcpu(struct acrn_vcpu *vcpu, enum vcpu_state new_state) if (atomic_load32(&vcpu->running) == 1U) { remove_from_cpu_runqueue(&vcpu->sched_obj, vcpu->pcpu_id); - make_reschedule_request(vcpu); + make_reschedule_request(vcpu->pcpu_id); release_schedule_lock(vcpu->pcpu_id); if (vcpu->pcpu_id != pcpu_id) { @@ -595,7 +595,7 @@ void resume_vcpu(struct acrn_vcpu *vcpu) if (vcpu->state == VCPU_RUNNING) { add_to_cpu_runqueue(&vcpu->sched_obj, vcpu->pcpu_id); - make_reschedule_request(vcpu); + make_reschedule_request(vcpu->pcpu_id); } release_schedule_lock(vcpu->pcpu_id); } @@ -607,7 +607,7 @@ void schedule_vcpu(struct acrn_vcpu *vcpu) get_schedule_lock(vcpu->pcpu_id); add_to_cpu_runqueue(&vcpu->sched_obj, vcpu->pcpu_id); - make_reschedule_request(vcpu); + make_reschedule_request(vcpu->pcpu_id); release_schedule_lock(vcpu->pcpu_id); } diff --git a/hypervisor/common/schedule.c b/hypervisor/common/schedule.c index 01af5acab..b9cbb534f 100644 --- a/hypervisor/common/schedule.c +++ b/hypervisor/common/schedule.c @@ -106,13 +106,13 @@ static struct acrn_vcpu *select_next_vcpu(uint16_t pcpu_id) return vcpu; } -void make_reschedule_request(const struct acrn_vcpu *vcpu) +void make_reschedule_request(uint16_t pcpu_id) { - struct sched_context *ctx = &per_cpu(sched_ctx, vcpu->pcpu_id); + struct sched_context *ctx = &per_cpu(sched_ctx, pcpu_id); bitmap_set_lock(NEED_RESCHEDULE, &ctx->flags); - if (get_cpu_id() != vcpu->pcpu_id) { - send_single_ipi(vcpu->pcpu_id, VECTOR_NOTIFY_VCPU); + if (get_cpu_id() != pcpu_id) { + send_single_ipi(pcpu_id, VECTOR_NOTIFY_VCPU); } } diff --git a/hypervisor/include/common/schedule.h b/hypervisor/include/common/schedule.h index 004775b84..d33afd2d6 100644 --- a/hypervisor/include/common/schedule.h +++ b/hypervisor/include/common/schedule.h @@ -35,7 +35,7 @@ void remove_from_cpu_runqueue(struct sched_object *obj, uint16_t pcpu_id); void default_idle(void); -void make_reschedule_request(const struct acrn_vcpu *vcpu); +void make_reschedule_request(uint16_t pcpu_id); int32_t need_reschedule(uint16_t pcpu_id); void make_pcpu_offline(uint16_t pcpu_id); int32_t need_offline(uint16_t pcpu_id);