[PATCH] Remove __exception_text_start and __exception_text_end for ARM64
by Prabhakar Kushwaha
__exception_text_start and __exception_text_end is used to group functions
and place according to linker script in such a way to achieve
kprobe blacklist. commit b6e43c0e3129 ("arm64: remove __exception
annotations") has removed __exception_text_start and
__exception_text_end and uses NOKPROBE_SYMBOL() for blacklist kprobes.
So removing references of __exception_text_start and __exception_text_end
for ARM64.
Signed-off-by: Prabhakar Kushwaha <pkushwaha(a)marvell.com>
---
arm64.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/arm64.c b/arm64.c
index 1b024a4..56ec088 100644
--- a/arm64.c
+++ b/arm64.c
@@ -673,8 +673,6 @@ arm64_dump_machdep_table(ulong arg)
fprintf(fp, " kimage_voffset: %016lx\n", ms->kimage_voffset);
}
fprintf(fp, " phys_offset: %lx\n", ms->phys_offset);
- fprintf(fp, "__exception_text_start: %lx\n", ms->__exception_text_start);
- fprintf(fp, " __exception_text_end: %lx\n", ms->__exception_text_end);
fprintf(fp, " __irqentry_text_start: %lx\n", ms->__irqentry_text_start);
fprintf(fp, " __irqentry_text_end: %lx\n", ms->__irqentry_text_end);
fprintf(fp, " exp_entry1_start: %lx\n", ms->exp_entry1_start);
@@ -1644,10 +1642,6 @@ arm64_stackframe_init(void)
machdep->machspec->kern_eframe_offset = SIZE(pt_regs);
}
- machdep->machspec->__exception_text_start =
- symbol_value("__exception_text_start");
- machdep->machspec->__exception_text_end =
- symbol_value("__exception_text_end");
if ((sp1 = kernel_symbol_search("__irqentry_text_start")) &&
(sp2 = kernel_symbol_search("__irqentry_text_end"))) {
machdep->machspec->__irqentry_text_start = sp1->value;
@@ -1861,9 +1855,7 @@ arm64_in_exception_text(ulong ptr)
{
struct machine_specific *ms = machdep->machspec;
- if ((ptr >= ms->__exception_text_start) &&
- (ptr < ms->__exception_text_end))
- return TRUE;
+ return TRUE;
if (ms->__irqentry_text_start && ms->__irqentry_text_end &&
((ptr >= ms->__irqentry_text_start) &&
--
2.17.1
5 years
[PATCH] Bugfix and optimization for ARM64 getting crash notes
by qiwuchen55@gmail.com
From: chenqiwu <chenqiwu(a)xiaomi.com>
1) ARM64 call arm64_get_crash_notes() to retrieve active task
registers when POST_VM before calling map_cpus_to_prstatus()
to remap the NT_PRSTATUS elf notes to the online cpus. It's
better to call arm64_get_crash_notes() when POST_INIT.
2) arm64_get_crash_notes() check the sanity of NT_PRSTATUS notes
only for online cpus. If one cpu contains invalid note, it's
better to continue finding the crash notes for other online cpus.
So we can extract the backtraces for the online cpus which contain
valid note by using command "bt -a".
3) map_cpus_to_prstatus() remap the NT_PRSTATUS notes only to the
online cpus. Make sure there must be a one-to-one relationship
between the number of online cpus and the number of notes.
Signed-off-by: chenqiwu <chenqiwu(a)xiaomi.com>
---
arm64.c | 49 +++++++++++++++++++++++++++++--------------------
diskdump.c | 9 +++------
netdump.c | 4 ++--
3 files changed, 34 insertions(+), 28 deletions(-)
diff --git a/arm64.c b/arm64.c
index 233029d..cbad461 100644
--- a/arm64.c
+++ b/arm64.c
@@ -458,7 +458,7 @@ arm64_init(int when)
arm64_stackframe_init();
break;
- case POST_VM:
+ case POST_INIT:
/*
* crash_notes contains machine specific information about the
* crash. In particular, it contains CPU registers at the time
@@ -3587,7 +3587,7 @@ arm64_get_crash_notes(void)
ulong offset;
char *buf, *p;
ulong *notes_ptrs;
- ulong i;
+ ulong i, j;
if (!symbol_exists("crash_notes"))
return FALSE;
@@ -3620,12 +3620,12 @@ arm64_get_crash_notes(void)
if (!(ms->panic_task_regs = calloc((size_t)kt->cpus, sizeof(struct arm64_pt_regs))))
error(FATAL, "cannot calloc panic_task_regs space\n");
- for (i = 0; i < kt->cpus; i++) {
-
+ for (i = 0, j = 0; i < kt->cpus; i++) {
if (!readmem(notes_ptrs[i], KVADDR, buf, SIZE(note_buf),
"note_buf_t", RETURN_ON_ERROR)) {
- error(WARNING, "failed to read note_buf_t\n");
- goto fail;
+ error(WARNING, "cpu#%d: failed to read note_buf_t\n", i);
+ ++j;
+ continue;
}
/*
@@ -3655,19 +3655,29 @@ arm64_get_crash_notes(void)
note->n_descsz == notesz)
BCOPY((char *)note, buf, notesz);
} else {
- error(WARNING,
- "cannot find NT_PRSTATUS note for cpu: %d\n", i);
+ if (CRASHDEBUG(1))
+ error(WARNING,
+ "cpu#%d: cannot find NT_PRSTATUS note\n", i);
+ ++j;
continue;
}
}
+ /*
+ * Check the sanity of NT_PRSTATUS note only for each online cpu.
+ * If this cpu has invalid note, continue to find the crash notes
+ * for other online cpus.
+ */
if (note->n_type != NT_PRSTATUS) {
- error(WARNING, "invalid note (n_type != NT_PRSTATUS)\n");
- goto fail;
+ error(WARNING, "cpu#%d: invalid note (n_type != NT_PRSTATUS)\n", i);
+ ++j;
+ continue;
}
- if (p[0] != 'C' || p[1] != 'O' || p[2] != 'R' || p[3] != 'E') {
- error(WARNING, "invalid note (name != \"CORE\"\n");
- goto fail;
+
+ if (!STRNEQ(p, "CORE")) {
+ error(WARNING, "cpu#%d: invalid note (name != \"CORE\")\n", i);
+ ++j;
+ continue;
}
/*
@@ -3684,14 +3694,13 @@ arm64_get_crash_notes(void)
FREEBUF(buf);
FREEBUF(notes_ptrs);
- return TRUE;
-fail:
- FREEBUF(buf);
- FREEBUF(notes_ptrs);
- free(ms->panic_task_regs);
- ms->panic_task_regs = NULL;
- return FALSE;
+ if (j == kt->cpus) {
+ free(ms->panic_task_regs);
+ ms->panic_task_regs = NULL;
+ return FALSE;
+ }
+ return TRUE;
}
static void
diff --git a/diskdump.c b/diskdump.c
index e88243e..12d8e9c 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -130,12 +130,9 @@ map_cpus_to_prstatus_kdump_cmprs(void)
*/
nrcpus = (kt->kernel_NR_CPUS ? kt->kernel_NR_CPUS : NR_CPUS);
- for (i = 0, j = 0; i < nrcpus; i++) {
- if (in_cpu_map(ONLINE_MAP, i)) {
- dd->nt_prstatus_percpu[i] = nt_ptr[j++];
- dd->num_prstatus_notes =
- MAX(dd->num_prstatus_notes, i+1);
- }
+ for (i = 0; i < nrcpus; i++) {
+ if (in_cpu_map(ONLINE_MAP, i))
+ dd->nt_prstatus_percpu[i] = nt_ptr[i];
}
FREEBUF(nt_ptr);
diff --git a/netdump.c b/netdump.c
index 406416a..849638a 100644
--- a/netdump.c
+++ b/netdump.c
@@ -97,9 +97,9 @@ map_cpus_to_prstatus(void)
*/
nrcpus = (kt->kernel_NR_CPUS ? kt->kernel_NR_CPUS : NR_CPUS);
- for (i = 0, j = 0; i < nrcpus; i++) {
+ for (i = 0; i < nrcpus; i++) {
if (in_cpu_map(ONLINE_MAP, i))
- nd->nt_prstatus_percpu[i] = nt_ptr[j++];
+ nd->nt_prstatus_percpu[i] = nt_ptr[i];
}
FREEBUF(nt_ptr);
--
1.9.1
5 years
[PATCH] Debugging xen hypervisor failed
by Dietmar Hahn
Hi Dave,
debugging newer xen hypervisors failed with:
crash: cannot resolve "init_tss"
This is caused by a change in the xen hypervisor with commit 78884406256,
from 4.12.0-rc5-763-g7888440625. In this patch the struct tss_struct was
renamed to tss64 and the structure tss_page was introduced which contains a
single tss64.
Now tss information are accessible via symbol "per_cpu__tss_page"
The code is as follows:
struct __packed tss64 {
uint32_t :32;
uint64_t rsp0, rsp1, rsp2;
uint64_t :64;
/*
* Interrupt Stack Table is 1-based so tss->ist[0] corresponds to an IST
* value of 1 in an Interrupt Descriptor.
*/
uint64_t ist[7];
uint64_t :64;
uint16_t :16, bitmap;
};
struct tss_page {
struct tss64 __aligned(PAGE_SIZE) tss;
};
DECLARE_PER_CPU(struct tss_page, tss_page);
To keep the change simple and small I renamed xen_hyper_size_table.tss_struct
to xen_hyper_size_table.tss and consequently I did the same for
tss_struct_rsp0, tss_struct_esp0 and tss_struct_ist.
But I'm not sure this is the way to go.
Thanks.
Dietmar.
---
x86_64.c | 20 +++++++++++++++-----
xen_hyper.c | 22 ++++++++++++----------
xen_hyper_defs.h | 8 ++++----
xen_hyper_dump_tables.c | 8 ++++----
4 files changed, 35 insertions(+), 23 deletions(-)
diff --git a/x86_64.c b/x86_64.c
index a4138ed..4f1a6d7 100644
--- a/x86_64.c
+++ b/x86_64.c
@@ -7973,13 +7973,23 @@ x86_64_init_hyper(int when)
case POST_GDB:
XEN_HYPER_STRUCT_SIZE_INIT(cpuinfo_x86, "cpuinfo_x86");
- XEN_HYPER_STRUCT_SIZE_INIT(tss_struct, "tss_struct");
- if (MEMBER_EXISTS("tss_struct", "__blh")) {
- XEN_HYPER_ASSIGN_OFFSET(tss_struct_rsp0) = MEMBER_OFFSET("tss_struct", "__blh") + sizeof(short unsigned int);
+ if (symbol_exists("per_cpu__tss_page")) {
+ XEN_HYPER_STRUCT_SIZE_INIT(tss, "tss64");
+ XEN_HYPER_ASSIGN_OFFSET(tss_rsp0) =
+ MEMBER_OFFSET("tss64", "rsp0");
+ XEN_HYPER_MEMBER_OFFSET_INIT(tss_ist, "tss64", "ist");
} else {
- XEN_HYPER_ASSIGN_OFFSET(tss_struct_rsp0) = MEMBER_OFFSET("tss_struct", "rsp0");
+ XEN_HYPER_STRUCT_SIZE_INIT(tss, "tss_struct");
+ XEN_HYPER_MEMBER_OFFSET_INIT(tss_ist, "tss_struct", "ist");
+ if (MEMBER_EXISTS("tss_struct", "__blh")) {
+ XEN_HYPER_ASSIGN_OFFSET(tss_rsp0) =
+ MEMBER_OFFSET("tss_struct", "__blh") +
+ sizeof(short unsigned int);
+ } else {
+ XEN_HYPER_ASSIGN_OFFSET(tss_rsp0) =
+ MEMBER_OFFSET("tss_struct", "rsp0");
+ }
}
- XEN_HYPER_MEMBER_OFFSET_INIT(tss_struct_ist, "tss_struct", "ist");
if (symbol_exists("cpu_data")) {
xht->cpu_data_address = symbol_value("cpu_data");
}
diff --git a/xen_hyper.c b/xen_hyper.c
index f2f00e6..1030c0a 100644
--- a/xen_hyper.c
+++ b/xen_hyper.c
@@ -338,33 +338,35 @@ xen_hyper_x86_pcpu_init(void)
if((xhpct->pcpu_struct = malloc(XEN_HYPER_SIZE(cpu_info))) == NULL) {
error(FATAL, "cannot malloc pcpu struct space.\n");
}
-
/* get physical cpu context */
xen_hyper_alloc_pcpu_context_space(XEN_HYPER_MAX_CPUS());
if (symbol_exists("per_cpu__init_tss")) {
init_tss_base = symbol_value("per_cpu__init_tss");
flag = TRUE;
+ } else if (symbol_exists("per_cpu__tss_page")) {
+ init_tss_base = symbol_value("per_cpu__tss_page");
+ flag = TRUE;
} else {
init_tss_base = symbol_value("init_tss");
flag = FALSE;
}
- buf = GETBUF(XEN_HYPER_SIZE(tss_struct));
+ buf = GETBUF(XEN_HYPER_SIZE(tss));
for_cpu_indexes(i, cpuid)
{
if (flag)
init_tss = xen_hyper_per_cpu(init_tss_base, cpuid);
else
init_tss = init_tss_base +
- XEN_HYPER_SIZE(tss_struct) * cpuid;
+ XEN_HYPER_SIZE(tss) * cpuid;
if (!readmem(init_tss, KVADDR, buf,
- XEN_HYPER_SIZE(tss_struct), "init_tss", RETURN_ON_ERROR)) {
+ XEN_HYPER_SIZE(tss), "init_tss", RETURN_ON_ERROR)) {
error(FATAL, "cannot read init_tss.\n");
}
if (machine_type("X86")) {
- sp = ULONG(buf + XEN_HYPER_OFFSET(tss_struct_esp0));
+ sp = ULONG(buf + XEN_HYPER_OFFSET(tss_esp0));
} else if (machine_type("X86_64")) {
- sp = ULONG(buf + XEN_HYPER_OFFSET(tss_struct_rsp0));
- } else
+ sp = ULONG(buf + XEN_HYPER_OFFSET(tss_rsp0));
+ } else
sp = 0;
cpu_info = XEN_HYPER_GET_CPU_INFO(sp);
if (CRASHDEBUG(1)) {
@@ -1777,10 +1779,10 @@ xen_hyper_store_pcpu_context_tss(struct xen_hyper_pcpu_context *pcc,
pcc->init_tss = init_tss;
if (machine_type("X86")) {
- pcc->sp.esp0 = ULONG(tss + XEN_HYPER_OFFSET(tss_struct_esp0));
+ pcc->sp.esp0 = ULONG(tss + XEN_HYPER_OFFSET(tss_esp0));
} else if (machine_type("X86_64")) {
- pcc->sp.rsp0 = ULONG(tss + XEN_HYPER_OFFSET(tss_struct_rsp0));
- ist_p = (uint64_t *)(tss + XEN_HYPER_OFFSET(tss_struct_ist));
+ pcc->sp.rsp0 = ULONG(tss + XEN_HYPER_OFFSET(tss_rsp0));
+ ist_p = (uint64_t *)(tss + XEN_HYPER_OFFSET(tss_ist));
for (i = 0; i < XEN_HYPER_TSS_IST_MAX; i++, ist_p++) {
pcc->ist[i] = ULONG(ist_p);
}
diff --git a/xen_hyper_defs.h b/xen_hyper_defs.h
index b871bdd..acf910a 100644
--- a/xen_hyper_defs.h
+++ b/xen_hyper_defs.h
@@ -598,7 +598,7 @@ struct xen_hyper_size_table {
long scheduler;
long shared_info;
long timer;
- long tss_struct;
+ long tss;
long vcpu;
long vcpu_runstate_info;
long xen_crash_xen_regs_t; /* elf note v2 */
@@ -727,9 +727,9 @@ struct xen_hyper_offset_table {
long timer_heap_offset;
long timer_killed;
/* tss */
- long tss_struct_rsp0;
- long tss_struct_esp0;
- long tss_struct_ist;
+ long tss_rsp0;
+ long tss_esp0;
+ long tss_ist;
/* vcpu */
long vcpu_vcpu_id;
long vcpu_processor;
diff --git a/xen_hyper_dump_tables.c b/xen_hyper_dump_tables.c
index eb646b6..0360d25 100644
--- a/xen_hyper_dump_tables.c
+++ b/xen_hyper_dump_tables.c
@@ -636,8 +636,8 @@ xen_hyper_dump_xen_hyper_size_table(char *spec, ulong makestruct)
(buf, "%ld\n", xen_hyper_size_table.shared_info));
XEN_HYPER_PRI(fp, len, "timer: ", buf, flag,
(buf, "%ld\n", xen_hyper_size_table.timer));
- XEN_HYPER_PRI(fp, len, "tss_struct: ", buf, flag,
- (buf, "%ld\n", xen_hyper_size_table.tss_struct));
+ XEN_HYPER_PRI(fp, len, "tss: ", buf, flag,
+ (buf, "%ld\n", xen_hyper_size_table.tss));
XEN_HYPER_PRI(fp, len, "vcpu: ", buf, flag,
(buf, "%ld\n", xen_hyper_size_table.vcpu));
XEN_HYPER_PRI(fp, len, "vcpu_runstate_info: ", buf, flag,
@@ -868,9 +868,9 @@ xen_hyper_dump_xen_hyper_offset_table(char *spec, ulong makestruct)
(buf, "%ld\n", xen_hyper_offset_table.timer_killed));
XEN_HYPER_PRI(fp, len, "tss_struct_rsp0: ", buf, flag,
- (buf, "%ld\n", xen_hyper_offset_table.tss_struct_rsp0));
+ (buf, "%ld\n", xen_hyper_offset_table.tss_rsp0));
XEN_HYPER_PRI(fp, len, "tss_struct_esp0: ", buf, flag,
- (buf, "%ld\n", xen_hyper_offset_table.tss_struct_esp0));
+ (buf, "%ld\n", xen_hyper_offset_table.tss_esp0));
XEN_HYPER_PRI(fp, len, "vcpu_vcpu_id: ", buf, flag,
(buf, "%ld\n", xen_hyper_offset_table.vcpu_vcpu_id));
--
2.16.4
5 years
Re: [Crash-utility] README: Reword crash support for arch different than host arch
by Santosh Yadawar
“The crash binary can only be used on systems of the same architecture as
the host build system.”
This statement on first read made me think that crash running on particular arch can handle vmcore of that arch only.
Thanks, Santosh
---------- Forwarded message ---------
From: Dave Anderson <anderson(a)redhat.com<mailto:anderson@redhat.com>>
Date: Fri, Dec 6, 2019 at 12:04 PM
Subject: Re: [Crash-utility] README: Reword crash support for arch different than host arch
To: Discussion list for crash utility usage, maintenance and development <crash-utility(a)redhat.com<mailto:crash-utility@redhat.com>>
The point is that regardless whether the target vmcore is from
a different architecture, the "alternate" crash binary that is
built with "make target=XXX" must match the architecture of the
host.
Dave
----- Original Message -----
>
>
> Hi,
>
>
>
>
>
> May be this rewording is needed?
>
>
>
>
>
>
>
> crash$ git diff README
>
> diff --git a/README b/README
>
> index 62855c2..3bef5ec 100644
>
> --- a/README
>
> +++ b/README
>
> @@ -82,9 +82,10 @@
>
> must be configured and built. Alternatively, the crash source RPM file
>
> may be installed and built, and the resultant crash binary RPM file
> installed.
>
>
>
> - The crash binary can only be used on systems of the same architecture as
>
> - the host build system. There are a few optional manners of building the
>
> - crash binary:
>
> + The crash binary built as above can only be used on systems of the same
>
> + architecture as the host build system. However crash can be built to handle
>
> + dumpfiles from different architecture than host build system, here are the
>
> + available build options:
>
>
>
> o On an x86_64 host, a 32-bit x86 binary that can be used to analyze
>
> 32-bit x86 dumpfiles may be built by typing "make target=X86".
>
>
>
>
>
>
>
>
>
> Thanks,
>
> Santosh
>
> --
> Crash-utility mailing list
> Crash-utility(a)redhat.com<mailto:Crash-utility@redhat.com>
> https://www.redhat.com/mailman/listinfo/crash-utility<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.red...>
--
Crash-utility mailing list
Crash-utility(a)redhat.com<mailto:Crash-utility@redhat.com>
https://www.redhat.com/mailman/listinfo/crash-utility<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.red...>
5 years
README: Reword crash support for arch different than host arch
by Santosh Yadawar
Hi,
May be this rewording is needed?
crash$ git diff README
diff --git a/README b/README
index 62855c2..3bef5ec 100644
--- a/README
+++ b/README
@@ -82,9 +82,10 @@
must be configured and built. Alternatively, the crash source RPM file
may be installed and built, and the resultant crash binary RPM file installed.
- The crash binary can only be used on systems of the same architecture as
- the host build system. There are a few optional manners of building the
- crash binary:
+ The crash binary built as above can only be used on systems of the same
+ architecture as the host build system. However crash can be built to handle
+ dumpfiles from different architecture than host build system, here are the
+ available build options:
o On an x86_64 host, a 32-bit x86 binary that can be used to analyze
32-bit x86 dumpfiles may be built by typing "make target=X86".
Thanks,
Santosh
5 years
accessing RAM filesystem content in vmcore
by Tim D. Hammer
Is it possible to access a pstore filesystem in /proc/vmcore?
We do not have persistent memory to connect to pstore. We have ramoops and
kexec/kdump enabled, and I can see that the call trace output from a
SysRq-C (along with other dmesg content) is in vmcore (via hexdump), but am
struggling with how to extract that from /proc/vmcore (hopefully quickly so
that kexec/kdump can finish and restart the system to full functionality).
Any help/guidance would be greatly appreciated.
Thank you!
.Tim
5 years