hv: sched: use get_running_vcpu to replace per_cpu vcpu with cpu sharing

With cpu sharing enabled, per_cpu vcpu cannot work properly as we might
has multiple vcpus running on one pcpu.
Add a schedule API sched_get_current to get current thread_object on
specific pcpu, also add a vcpu API get_running_vcpu to get corresponding
vcpu of the thread_object.

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:
Shuo A Liu
2019-06-10 14:49:57 +08:00
committed by ACRN System Integration
parent 891e46453d
commit 7e66c0d4fa
8 changed files with 30 additions and 6 deletions

View File

@@ -14,6 +14,7 @@
#include <vlapic.h>
#include <lapic.h>
#include <per_cpu.h>
#include <guest/vm.h>
#include <multiboot.h>
#include <deprivilege_boot.h>

View File

@@ -270,7 +270,7 @@ static int32_t init_general_vm_boot_info(struct acrn_vm *vm)
static void depri_boot_spurious_handler(uint32_t vector)
{
if (get_pcpu_id() == BOOT_CPU_ID) {
struct acrn_vcpu *vcpu = per_cpu(vcpu, BOOT_CPU_ID);
struct acrn_vcpu *vcpu = vcpu_from_vid(get_sos_vm(), BOOT_CPU_ID);
if (vcpu != NULL) {
vlapic_set_intr(vcpu, vector, LAPIC_TRIG_EDGE);