mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-01-05 07:35:31 +00:00
hv: sched: Add sched_params struct for thread parameters
Abstract out schedulers config data for vCPU threads and other hypervisor threads to sched_params structure. And it's used to initialize per thread scheduler private data. The sched_params for vCPU threads come from vm_config generated by config tools while other hypervisor threads need give them explicitly. Tracked-On: #8500 Signed-off-by: Qiang Zhang <qiang4.zhang@intel.com>
This commit is contained in:
committed by
acrnsi-robot
parent
c000a3f70b
commit
6a1d91c740
@@ -34,6 +34,16 @@ enum thread_priority {
|
||||
PRIO_MAX
|
||||
};
|
||||
|
||||
/*
|
||||
* For now, we just have several parameters for all the schedulers. So we
|
||||
* put them together here for simplicity. TODO When this structure grows big
|
||||
* enough, we need to replace it with a union of parameters of different
|
||||
* schedulers.
|
||||
*/
|
||||
struct sched_params {
|
||||
uint32_t prio; /* The priority of a thread */
|
||||
};
|
||||
|
||||
struct thread_object;
|
||||
typedef void (*thread_entry_t)(struct thread_object *obj);
|
||||
typedef void (*switch_t)(struct thread_object *obj);
|
||||
@@ -49,8 +59,6 @@ struct thread_object {
|
||||
switch_t switch_out;
|
||||
switch_t switch_in;
|
||||
|
||||
int priority;
|
||||
|
||||
uint8_t data[THREAD_DATA_SIZE];
|
||||
};
|
||||
|
||||
@@ -70,7 +78,7 @@ struct acrn_scheduler {
|
||||
/* init scheduler */
|
||||
int32_t (*init)(struct sched_control *ctl);
|
||||
/* init private data of scheduler */
|
||||
void (*init_data)(struct thread_object *obj);
|
||||
void (*init_data)(struct thread_object *obj, struct sched_params *params);
|
||||
/* pick the next thread object */
|
||||
struct thread_object* (*pick_next)(struct sched_control *ctl);
|
||||
/* put thread object into sleep */
|
||||
@@ -120,7 +128,7 @@ void deinit_sched(uint16_t pcpu_id);
|
||||
void obtain_schedule_lock(uint16_t pcpu_id, uint64_t *rflag);
|
||||
void release_schedule_lock(uint16_t pcpu_id, uint64_t rflag);
|
||||
|
||||
void init_thread_data(struct thread_object *obj);
|
||||
void init_thread_data(struct thread_object *obj, struct sched_params *params);
|
||||
void deinit_thread_data(struct thread_object *obj);
|
||||
|
||||
void make_reschedule_request(uint16_t pcpu_id);
|
||||
|
||||
Reference in New Issue
Block a user