f1cd67284d
Release: crash-7.3.0-4 Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
121 lines
2.9 KiB
Diff
121 lines
2.9 KiB
Diff
From 163abcbbabdf8207c11ee93b1c909d85ecbcbf1f Mon Sep 17 00:00:00 2001
|
|
From: Alexey Makhalov <amakhalov@vmware.com>
|
|
Date: Fri, 19 Mar 2021 21:07:26 -0700
|
|
Subject: [PATCH 13/27] crash_get_nr_cpus: get nr_cpus from the dumps
|
|
|
|
Most of the dumps have information about real number of CPUS.
|
|
Use that to instantiate GDB's target inferior threads.
|
|
|
|
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
|
|
---
|
|
diskdump.c | 13 +++++++++++--
|
|
gdb_interface.c | 9 +++++++++
|
|
netdump.c | 11 ++++++++---
|
|
sadump.c | 2 +-
|
|
4 files changed, 29 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/diskdump.c b/diskdump.c
|
|
index 112f769f8949..3e1cfd548c96 100644
|
|
--- a/diskdump.c
|
|
+++ b/diskdump.c
|
|
@@ -2593,13 +2593,22 @@ diskdump_kaslr_check()
|
|
return FALSE;
|
|
}
|
|
|
|
-#ifdef X86_64
|
|
int
|
|
diskdump_get_nr_cpus(void)
|
|
{
|
|
- return dd->num_qemu_notes;
|
|
+ if (dd->num_prstatus_notes)
|
|
+ return dd->num_prstatus_notes;
|
|
+ else if (dd->num_qemu_notes)
|
|
+ return dd->num_qemu_notes;
|
|
+ else if (dd->num_vmcoredd_notes)
|
|
+ return dd->num_vmcoredd_notes;
|
|
+ else if (dd->header->nr_cpus)
|
|
+ return dd->header->nr_cpus;
|
|
+
|
|
+ return 1;
|
|
}
|
|
|
|
+#ifdef X86_64
|
|
QEMUCPUState *
|
|
diskdump_get_qemucpustate(int cpu)
|
|
{
|
|
diff --git a/gdb_interface.c b/gdb_interface.c
|
|
index 93fc8baef2c6..bcca080eb8b4 100644
|
|
--- a/gdb_interface.c
|
|
+++ b/gdb_interface.c
|
|
@@ -1070,6 +1070,15 @@ int crash_get_nr_cpus(void);
|
|
|
|
int crash_get_nr_cpus(void)
|
|
{
|
|
+ if (SADUMP_DUMPFILE())
|
|
+ return sadump_get_nr_cpus();
|
|
+ else if (DISKDUMP_DUMPFILE())
|
|
+ return diskdump_get_nr_cpus();
|
|
+ else if (KDUMP_DUMPFILE())
|
|
+ return kdump_get_nr_cpus();
|
|
+ else if (VMSS_DUMPFILE())
|
|
+ return vmware_vmss_get_nr_cpus();
|
|
+
|
|
/* Just CPU #0 */
|
|
return 1;
|
|
}
|
|
diff --git a/netdump.c b/netdump.c
|
|
index e8721d89f1a3..ff273b4fdfab 100644
|
|
--- a/netdump.c
|
|
+++ b/netdump.c
|
|
@@ -5206,11 +5206,17 @@ kdump_kaslr_check(void)
|
|
return FALSE;
|
|
}
|
|
|
|
-#ifdef X86_64
|
|
int
|
|
kdump_get_nr_cpus(void)
|
|
{
|
|
- return nd->num_qemu_notes;
|
|
+ if (nd->num_prstatus_notes)
|
|
+ return nd->num_prstatus_notes;
|
|
+ else if (nd->num_qemu_notes)
|
|
+ return nd->num_qemu_notes;
|
|
+ else if (nd->num_vmcoredd_notes)
|
|
+ return nd->num_vmcoredd_notes;
|
|
+
|
|
+ return 1;
|
|
}
|
|
|
|
QEMUCPUState *
|
|
@@ -5232,7 +5238,6 @@ kdump_get_qemucpustate(int cpu)
|
|
|
|
return (QEMUCPUState *)nd->nt_qemu_percpu[cpu];
|
|
}
|
|
-#endif
|
|
|
|
static void *
|
|
get_kdump_device_dump_offset(void)
|
|
diff --git a/sadump.c b/sadump.c
|
|
index d75c66b74be9..cb43fdb8ecab 100644
|
|
--- a/sadump.c
|
|
+++ b/sadump.c
|
|
@@ -1670,7 +1670,6 @@ get_sadump_data(void)
|
|
return sd;
|
|
}
|
|
|
|
-#ifdef X86_64
|
|
int
|
|
sadump_get_nr_cpus(void)
|
|
{
|
|
@@ -1678,6 +1677,7 @@ sadump_get_nr_cpus(void)
|
|
return sd->dump_header->nr_cpus;
|
|
}
|
|
|
|
+#ifdef X86_64
|
|
int
|
|
sadump_get_cr3_cr4_idtr(int cpu, ulong *cr3, ulong *cr4, ulong *idtr)
|
|
{
|
|
--
|
|
2.30.2
|
|
|