mirror of https://github.com/crash-utility/crash
xen: adjust to new scheduler structures
There has been a significant modification regarding scheduler data in the Xen hypervisor (Xen commit d62fefa4d459). Adapt to new structures and removed fields. Note that this is only the bare minimum to not let crash error out when opening a vmcore in Xen mode with a recent Xen version. Signed-off-by: Juergen Gross <jgross@suse.com>
This commit is contained in:
parent
9ee564cd1a
commit
97269209aa
35
xen_hyper.c
35
xen_hyper.c
|
@ -415,6 +415,8 @@ void
|
|||
xen_hyper_misc_init(void)
|
||||
{
|
||||
XEN_HYPER_STRUCT_SIZE_INIT(schedule_data, "schedule_data");
|
||||
XEN_HYPER_STRUCT_SIZE_INIT(sched_resource, "sched_resource");
|
||||
if (XEN_HYPER_VALID_SIZE(schedule_data)) {
|
||||
XEN_HYPER_MEMBER_OFFSET_INIT(schedule_data_schedule_lock, "schedule_data", "schedule_lock");
|
||||
XEN_HYPER_MEMBER_OFFSET_INIT(schedule_data_curr, "schedule_data", "curr");
|
||||
if (MEMBER_EXISTS("schedule_data", "idle"))
|
||||
|
@ -422,6 +424,12 @@ xen_hyper_misc_init(void)
|
|||
XEN_HYPER_MEMBER_OFFSET_INIT(schedule_data_sched_priv, "schedule_data", "sched_priv");
|
||||
XEN_HYPER_MEMBER_OFFSET_INIT(schedule_data_s_timer, "schedule_data", "s_timer");
|
||||
XEN_HYPER_MEMBER_OFFSET_INIT(schedule_data_tick, "schedule_data", "tick");
|
||||
} else if (XEN_HYPER_VALID_SIZE(sched_resource)) {
|
||||
XEN_HYPER_MEMBER_OFFSET_INIT(schedule_data_schedule_lock, "sched_resource", "schedule_lock");
|
||||
XEN_HYPER_MEMBER_OFFSET_INIT(schedule_data_curr, "sched_resource", "curr");
|
||||
XEN_HYPER_MEMBER_OFFSET_INIT(schedule_data_sched_priv, "sched_resource", "sched_priv");
|
||||
XEN_HYPER_MEMBER_OFFSET_INIT(schedule_data_s_timer, "sched_resource", "s_timer");
|
||||
}
|
||||
|
||||
XEN_HYPER_STRUCT_SIZE_INIT(scheduler, "scheduler");
|
||||
XEN_HYPER_MEMBER_OFFSET_INIT(scheduler_name, "scheduler", "name");
|
||||
|
@ -465,6 +473,7 @@ xen_hyper_schedule_init(void)
|
|||
long *schedulers_buf;
|
||||
int nr_schedulers;
|
||||
struct xen_hyper_sched_context *schc;
|
||||
long buf_size;
|
||||
char *buf;
|
||||
char opt_name_buf[XEN_HYPER_OPT_SCHED_SIZE];
|
||||
int i, cpuid, flag;
|
||||
|
@ -559,28 +568,39 @@ xen_hyper_schedule_init(void)
|
|||
}
|
||||
BZERO(xhscht->sched_context_array,
|
||||
sizeof(struct xen_hyper_sched_context) * XEN_HYPER_MAX_CPUS());
|
||||
buf = GETBUF(XEN_HYPER_SIZE(schedule_data));
|
||||
if (symbol_exists("per_cpu__schedule_data")) {
|
||||
if (symbol_exists("per_cpu__sched_res")) {
|
||||
addr = symbol_value("per_cpu__sched_res");
|
||||
buf_size = XEN_HYPER_SIZE(sched_resource);
|
||||
flag = 0;
|
||||
} else if (symbol_exists("per_cpu__schedule_data")) {
|
||||
addr = symbol_value("per_cpu__schedule_data");
|
||||
flag = TRUE;
|
||||
buf_size = XEN_HYPER_SIZE(schedule_data);
|
||||
flag = 1;
|
||||
} else {
|
||||
addr = symbol_value("schedule_data");
|
||||
flag = FALSE;
|
||||
buf_size = XEN_HYPER_SIZE(schedule_data);
|
||||
flag = 2;
|
||||
}
|
||||
buf = GETBUF(buf_size);
|
||||
for_cpu_indexes(i, cpuid)
|
||||
{
|
||||
schc = &xhscht->sched_context_array[cpuid];
|
||||
if (flag) {
|
||||
if (flag == 1) {
|
||||
schc->schedule_data =
|
||||
xen_hyper_per_cpu(addr, i);
|
||||
} else {
|
||||
schc->schedule_data = addr +
|
||||
XEN_HYPER_SIZE(schedule_data) * i;
|
||||
}
|
||||
if (!readmem(schc->schedule_data,
|
||||
readmem(schc->schedule_data,
|
||||
KVADDR, buf, XEN_HYPER_SIZE(schedule_data),
|
||||
"schedule_data", RETURN_ON_ERROR)) {
|
||||
error(FATAL, "cannot read schedule_data.\n");
|
||||
"schedule_data", FAULT_ON_ERROR);
|
||||
} else {
|
||||
schc->sched_resource = xen_hyper_per_cpu(addr, i);
|
||||
readmem(schc->sched_resource,
|
||||
KVADDR, buf, XEN_HYPER_SIZE(sched_resource),
|
||||
"sched_resource", FAULT_ON_ERROR);
|
||||
}
|
||||
schc->cpu_id = cpuid;
|
||||
schc->curr = ULONG(buf + XEN_HYPER_OFFSET(schedule_data_curr));
|
||||
|
@ -1597,6 +1617,7 @@ xen_hyper_store_vcpu_context(struct xen_hyper_vcpu_context *vcc,
|
|||
vcc->next_in_list = ULONG(vcp + XEN_HYPER_OFFSET(vcpu_next_in_list));
|
||||
if (XEN_HYPER_VALID_MEMBER(vcpu_sleep_tick))
|
||||
vcc->sleep_tick = ULONG(vcp + XEN_HYPER_OFFSET(vcpu_sleep_tick));
|
||||
if (XEN_HYPER_VALID_MEMBER(vcpu_sched_priv))
|
||||
vcc->sched_priv = ULONG(vcp + XEN_HYPER_OFFSET(vcpu_sched_priv));
|
||||
vcc->state = INT(vcp + XEN_HYPER_OFFSET(vcpu_runstate) +
|
||||
XEN_HYPER_OFFSET(vcpu_runstate_info_state));
|
||||
|
|
|
@ -551,6 +551,7 @@ struct xen_hyper_sched_context {
|
|||
ulong idle;
|
||||
ulong sched_priv;
|
||||
ulong tick;
|
||||
ulong sched_resource;
|
||||
};
|
||||
|
||||
struct xen_hyper_sched_table {
|
||||
|
@ -602,6 +603,7 @@ struct xen_hyper_size_table {
|
|||
long vcpu;
|
||||
long vcpu_runstate_info;
|
||||
long xen_crash_xen_regs_t; /* elf note v2 */
|
||||
long sched_resource;
|
||||
};
|
||||
|
||||
struct xen_hyper_offset_table {
|
||||
|
@ -692,7 +694,7 @@ struct xen_hyper_offset_table {
|
|||
/* mm_struct */
|
||||
long mm_struct_pgd;
|
||||
#endif
|
||||
/* schedule_data */
|
||||
/* schedule_data or sched_resource */
|
||||
long schedule_data_schedule_lock;
|
||||
long schedule_data_curr;
|
||||
long schedule_data_idle;
|
||||
|
|
|
@ -558,6 +558,8 @@ xen_hyper_dump_xen_hyper_sched_table(int verbose)
|
|||
flag, (buf, "%d]\n", i));
|
||||
XEN_HYPER_PRI(fp, len, "schedule_data: ", buf, flag,
|
||||
(buf, "%lx\n", schc->schedule_data));
|
||||
XEN_HYPER_PRI(fp, len, "sched_resource: ", buf, flag,
|
||||
(buf, "%lx\n", schc->sched_resource));
|
||||
XEN_HYPER_PRI(fp, len, "curr: ", buf, flag,
|
||||
(buf, "%lx\n", schc->curr));
|
||||
XEN_HYPER_PRI(fp, len, "idle: ", buf, flag,
|
||||
|
@ -630,6 +632,8 @@ xen_hyper_dump_xen_hyper_size_table(char *spec, ulong makestruct)
|
|||
(buf, "%ld\n", xen_hyper_size_table.note_buf_t));
|
||||
XEN_HYPER_PRI(fp, len, "schedule_data: ", buf, flag,
|
||||
(buf, "%ld\n", xen_hyper_size_table.schedule_data));
|
||||
XEN_HYPER_PRI(fp, len, "sched_resource: ", buf, flag,
|
||||
(buf, "%ld\n", xen_hyper_size_table.sched_resource));
|
||||
XEN_HYPER_PRI(fp, len, "scheduler: ", buf, flag,
|
||||
(buf, "%ld\n", xen_hyper_size_table.scheduler));
|
||||
XEN_HYPER_PRI(fp, len, "shared_info: ", buf, flag,
|
||||
|
|
Loading…
Reference in New Issue