hv: remove kick_thread from scheduler module

kick_thread function is only used by kick_vcpu to kick vcpu out of
non-root mode, the implementation in it is sending IPI to target CPU if
target obj is running and target PCPU is not current one; while for
runnable obj, it will just make reschedule request. So the kick_thread
is not actually belong to scheduler module, we can drop it and just do
the cpu notification in kick_vcpu.

Tracked-On: #5057
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Conghui Chen
2020-07-17 22:24:31 +08:00
committed by wenlingz
parent b6422f8985
commit 53d4a7169b
4 changed files with 14 additions and 37 deletions

View File

@@ -24,11 +24,6 @@ static inline bool is_blocked(const struct thread_object *obj)
return obj->status == THREAD_STS_BLOCKED;
}
static inline bool is_runnable(const struct thread_object *obj)
{
return obj->status == THREAD_STS_RUNNABLE;
}
static inline bool is_running(const struct thread_object *obj)
{
return obj->status == THREAD_STS_RUNNING;
@@ -239,34 +234,6 @@ void wake_thread(struct thread_object *obj)
release_schedule_lock(pcpu_id, rflag);
}
void kick_thread(const struct thread_object *obj)
{
uint16_t pcpu_id = obj->pcpu_id;
uint64_t rflag;
obtain_schedule_lock(pcpu_id, &rflag);
if (is_running(obj)) {
if (get_pcpu_id() != pcpu_id) {
if (obj->notify_mode == SCHED_NOTIFY_IPI) {
send_single_ipi(pcpu_id, NOTIFY_VCPU_VECTOR);
} else {
/* For lapic-pt vCPUs */
send_single_nmi(pcpu_id);
}
}
} else if (is_runnable(obj)) {
if (obj->notify_mode == SCHED_NOTIFY_IPI) {
make_reschedule_request(pcpu_id, DEL_MODE_IPI);
} else {
/* For lapic-pt vCPUs */
make_reschedule_request(pcpu_id, DEL_MODE_NMI);
}
} else {
/* do nothing */
}
release_schedule_lock(pcpu_id, rflag);
}
void yield_current(void)
{
make_reschedule_request(get_pcpu_id(), DEL_MODE_IPI);