acrn-hypervisor/hypervisor/include/common/event.h
Yifan Liu e51837f96d hv: Add check to ensure vcpu_make_request and signal_event are
consistent

Currently the vcpu_make_request and signal_event in vcpu_lock_instr_emulation
does not check whether target VCPU is up and running. This can cause
problems because when VCPU is created but not launched,
vcpu_make_request will not trigger wait_event on target VCPU, but
signal_event may still execute to reduce the counter.

This patch adds a check before vcpu_make_request and signal_event to
make sure the request and signal are issued after target VCPU is up.

Tracked-On: #6502
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
2021-08-27 16:16:52 +08:00

17 lines
364 B
C

#ifndef EVENT_H
#define EVENT_H
#include <asm/lib/spinlock.h>
struct sched_event {
spinlock_t lock;
int32_t nqueued;
struct thread_object* waiting_thread;
};
void init_event(struct sched_event *event);
void reset_event(struct sched_event *event);
void wait_event(struct sched_event *event);
void signal_event(struct sched_event *event);
#endif /* EVENT_H */