hv: remove unused pcpu assignment functions

As we introduced vcpu_affinity[] to assign vcpus to different pcpus, the
old policy and functions are not needed. Remove them.

Tracked-On: #3663
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Shuo A Liu 2019-09-03 14:11:59 +08:00 committed by ACRN System Integration
parent 1c526e6d16
commit 9a23ec6b5a
3 changed files with 2 additions and 49 deletions

View File

@ -365,21 +365,9 @@ void set_vcpu_startup_entry(struct acrn_vcpu *vcpu, uint64_t entry)
vcpu_set_rip(vcpu, 0UL);
}
/***********************************************************************
*
/*
* @pre vm != NULL && rtn_vcpu_handle != NULL
*
* vcpu_id/pcpu_id mapping table:
*
* if
* SOS_VM_CPUS[2] = {0, 2} , VM1_CPUS[2] = {3, 1};
* then
* for physical CPU 0 : vcpu->pcpu_id = 0, vcpu->vcpu_id = 0, vmid = 0;
* for physical CPU 2 : vcpu->pcpu_id = 2, vcpu->vcpu_id = 1, vmid = 0;
* for physical CPU 3 : vcpu->pcpu_id = 3, vcpu->vcpu_id = 0, vmid = 1;
* for physical CPU 1 : vcpu->pcpu_id = 1, vcpu->vcpu_id = 1, vmid = 1;
*
***********************************************************************/
*/
int32_t create_vcpu(uint16_t pcpu_id, struct acrn_vm *vm, struct acrn_vcpu **rtn_vcpu_handle)
{
struct acrn_vcpu *vcpu;
@ -599,7 +587,6 @@ void offline_vcpu(struct acrn_vcpu *vcpu)
{
vlapic_free(vcpu);
per_cpu(ever_run_vcpu, vcpu->pcpu_id) = NULL;
free_pcpu(vcpu->pcpu_id);
vcpu->state = VCPU_OFFLINE;
}
@ -761,8 +748,6 @@ int32_t prepare_vcpu(struct acrn_vm *vm, uint16_t pcpu_id)
ret = create_vcpu(pcpu_id, vm, &vcpu);
if (ret == 0) {
set_pcpu_used(pcpu_id);
INIT_LIST_HEAD(&vcpu->sched_obj.run_list);
snprintf(thread_name, 16U, "vm%hu:vcpu%hu", vm->vm_id, vcpu->vcpu_id);
(void)strncpy_s(vcpu->sched_obj.name, 16U, thread_name, 16U);

View File

@ -13,8 +13,6 @@
#include <schedule.h>
#include <sprintf.h>
static uint64_t pcpu_used_bitmap;
void init_scheduler(void)
{
struct sched_context *ctx;
@ -43,32 +41,6 @@ void release_schedule_lock(uint16_t pcpu_id)
spinlock_release(&ctx->scheduler_lock);
}
uint16_t allocate_pcpu(void)
{
uint16_t i;
uint16_t ret = INVALID_CPU_ID;
uint16_t pcpu_nums = get_pcpu_nums();
for (i = 0U; i < pcpu_nums; i++) {
if (bitmap_test_and_set_lock(i, &pcpu_used_bitmap) == 0) {
ret = i;
break;
}
}
return ret;
}
void set_pcpu_used(uint16_t pcpu_id)
{
bitmap_set_lock(pcpu_id, &pcpu_used_bitmap);
}
void free_pcpu(uint16_t pcpu_id)
{
bitmap_clear_lock(pcpu_id, &pcpu_used_bitmap);
}
void add_to_cpu_runqueue(struct sched_object *obj, uint16_t pcpu_id)
{
struct sched_context *ctx = &per_cpu(sched_ctx, pcpu_id);

View File

@ -37,10 +37,6 @@ void switch_to_idle(run_thread_t idle_thread);
void get_schedule_lock(uint16_t pcpu_id);
void release_schedule_lock(uint16_t pcpu_id);
void set_pcpu_used(uint16_t pcpu_id);
uint16_t allocate_pcpu(void);
void free_pcpu(uint16_t pcpu_id);
void add_to_cpu_runqueue(struct sched_object *obj, uint16_t pcpu_id);
void remove_from_cpu_runqueue(struct sched_object *obj);