io_emul: remove pending_pre_work

Now we do not need pending_pre_work anymore, as we can make sure IO request
VCPU resume from where it paused.

Now only three fixed points will try to do schedule:
- vcpu_thread: before vm entry, will check reschedule flag and to it if needed
- default_idle: loop check reschedule flag to see if need switch out
- io request: if IO REQ need DM's handle, it will schedule out

Tracked-On: #2394
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Xu, Anthony <anthony.xu@intel.com>
This commit is contained in:
Jason Chen CJ
2019-01-21 14:08:39 +08:00
committed by wenlingz
parent 4fc54f952e
commit fb41ea5cfb
5 changed files with 3 additions and 43 deletions

View File

@@ -8,23 +8,12 @@
#include <schedule.h>
#include <softirq.h>
static void run_vcpu_pre_work(struct acrn_vcpu *vcpu)
{
uint64_t *pending_pre_work = &vcpu->pending_pre_work;
if (bitmap_test_and_clear_lock(ACRN_VCPU_MMIO_COMPLETE, pending_pre_work)) {
dm_emulate_mmio_post(vcpu);
}
}
void vcpu_thread(struct sched_object *obj)
{
struct acrn_vcpu *vcpu = list_entry(obj, struct acrn_vcpu, sched_obj);
uint32_t basic_exit_reason = 0U;
int32_t ret = 0;
run_vcpu_pre_work(vcpu);
do {
/* If vcpu is not launched, we need to do init_vmcs first */
if (!vcpu->launched) {
@@ -46,15 +35,7 @@ void vcpu_thread(struct sched_object *obj)
}
if (need_reschedule(vcpu->pcpu_id)) {
/*
* In extrem case, schedule() could return. Which
* means the vcpu resume happens before schedule()
* triggered by vcpu suspend. In this case, we need
* to do pre work and continue vcpu loop after
* schedule() is return.
*/
schedule();
run_vcpu_pre_work(vcpu);
continue;
}

View File

@@ -154,6 +154,8 @@ int32_t acrn_insert_request_wait(struct acrn_vcpu *vcpu, const struct io_request
}
asm_pause();
}
} else if (need_reschedule(vcpu->pcpu_id)) {
schedule();
}
ret = 0;
} else {