hv: schedule: NEED_RESCHEDULE flag should be set atomically

Schedule context flag may set out of schedule lock protection, like NEED_OFFLINE
or NEED_SHUTDOWN_VM. So NEED_RESCHEDULE flag should be set atomically too.

Tracked-On: #1842
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
This commit is contained in:
Li, Fei1 2019-07-16 21:31:43 +08:00 committed by ACRN System Integration
parent 7d43a93fb7
commit 1081e1000e

View File

@ -112,7 +112,7 @@ void make_reschedule_request(uint16_t pcpu_id, uint16_t delmode)
{
struct sched_context *ctx = &per_cpu(sched_ctx, pcpu_id);
bitmap_set_nolock(NEED_RESCHEDULE, &ctx->flags);
bitmap_set_lock(NEED_RESCHEDULE, &ctx->flags);
if (get_pcpu_id() != pcpu_id) {
switch (delmode) {
case DEL_MODE_IPI:
@ -192,7 +192,7 @@ void schedule(void)
get_schedule_lock(pcpu_id);
next = get_next_sched_obj(ctx);
bitmap_clear_nolock(NEED_RESCHEDULE, &ctx->flags);
bitmap_clear_lock(NEED_RESCHEDULE, &ctx->flags);
if (prev == next) {
release_schedule_lock(pcpu_id);