mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zdump/dfi: Get online cpu count based on lowcore_ptr array
In case of missing dfi_cpu_info in the dump, obtain the number of online cpus of the dumped system based on the number of present entries in the lowcore_ptr array (if vmcoreinfo is available). Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com> Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
f1055a62e3
commit
5d2c93bc7a
31
zdump/dfi.c
31
zdump/dfi.c
@@ -107,11 +107,38 @@ static void date_print(void)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Obtain online cpu count based on the lowcore_ptr entries
|
||||
*/
|
||||
static unsigned int lowcore_cpu_count(void)
|
||||
{
|
||||
unsigned long *cpu_lowcore;
|
||||
unsigned long ptr, length;
|
||||
unsigned int i, count = 0;
|
||||
|
||||
if (dfi_vmcoreinfo_symbol(&ptr, "lowcore_ptr"))
|
||||
return 0;
|
||||
if (dfi_vmcoreinfo_length(&length, "lowcore_ptr") || length == 0)
|
||||
return 0;
|
||||
cpu_lowcore = zg_alloc(length * sizeof(*cpu_lowcore));
|
||||
if (dfi_mem_virt_read(dfi_vm_vtop(ptr), cpu_lowcore, length * sizeof(*cpu_lowcore)) == 0) {
|
||||
for (i = 0; i < length; i++) {
|
||||
if (cpu_lowcore[i])
|
||||
count++;
|
||||
}
|
||||
util_log_print(UTIL_LOG_INFO, "DFI lowcore_ptr entries count: %lu\n", count);
|
||||
}
|
||||
zg_free(cpu_lowcore);
|
||||
return count;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print dump information (--info option)
|
||||
*/
|
||||
void dfi_info_print(void)
|
||||
{
|
||||
const unsigned int online_cpu_cnt = l.cpus.cnt ? l.cpus.cnt : lowcore_cpu_count();
|
||||
|
||||
STDERR("General dump info:\n");
|
||||
STDERR(" Dump format........: %s\n", l.dfi->name);
|
||||
if (l.attr.dfi_version)
|
||||
@@ -129,8 +156,8 @@ void dfi_info_print(void)
|
||||
if (l.attr.vol_nr)
|
||||
STDERR(" Volume number......: %u\n", *l.attr.vol_nr);
|
||||
STDERR(" System arch........: %s\n", dfi_arch_str(DFI_ARCH_64));
|
||||
if (l.cpus.cnt)
|
||||
STDERR(" CPU count (online).: %u\n", l.cpus.cnt);
|
||||
if (online_cpu_cnt)
|
||||
STDERR(" CPU count (online).: %u\n", online_cpu_cnt);
|
||||
if (l.attr.real_cpu_cnt)
|
||||
STDERR(" CPU count (real)...: %u\n", *l.attr.real_cpu_cnt);
|
||||
if (dfi_mem_range())
|
||||
|
||||
Reference in New Issue
Block a user