hv: sched: add yield support

Add yield support for schedule, which can give up pcpu proactively.

Tracked-On: #4178
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-18 18:15:12 +08:00 committed by wenlingz
parent 6554437cc0
commit 6a144e6e3e
2 changed files with 6 additions and 0 deletions

View File

@ -240,6 +240,11 @@ void kick_thread(const struct thread_object *obj)
release_schedule_lock(pcpu_id, rflag); release_schedule_lock(pcpu_id, rflag);
} }
void yield_current(void)
{
make_reschedule_request(get_pcpu_id(), DEL_MODE_IPI);
}
void run_thread(struct thread_object *obj) void run_thread(struct thread_object *obj)
{ {
uint64_t rflag; uint64_t rflag;

View File

@ -109,6 +109,7 @@ void run_thread(struct thread_object *obj);
void sleep_thread(struct thread_object *obj); void sleep_thread(struct thread_object *obj);
void wake_thread(struct thread_object *obj); void wake_thread(struct thread_object *obj);
void kick_thread(const struct thread_object *obj); void kick_thread(const struct thread_object *obj);
void yield_current(void);
void schedule(void); void schedule(void);
void arch_switch_to(void *prev_sp, void *next_sp); void arch_switch_to(void *prev_sp, void *next_sp);