import crash-7.3.1-5.el8
This commit is contained in:
parent
6615b535b0
commit
bd0c6a5112
70
SOURCES/0001-Fix-pvops-Xen-detection-for-arm-machine.patch
Normal file
70
SOURCES/0001-Fix-pvops-Xen-detection-for-arm-machine.patch
Normal file
@ -0,0 +1,70 @@
|
||||
From 5c4f786450ea61b87d4db0092288df83dd5cb454 Mon Sep 17 00:00:00 2001
|
||||
From: Qi Zheng <zhengqi.arch@bytedance.com>
|
||||
Date: Tue, 21 Dec 2021 15:40:31 +0800
|
||||
Subject: [PATCH 01/11] Fix pvops Xen detection for arm machine
|
||||
|
||||
Since the xen_start_info on the arm/arm64 platform points to a static
|
||||
variable '_xen_start_info'(see its definition as below), which makes
|
||||
that the address of xen_start_info will never be null.
|
||||
|
||||
arch/arm/xen/enlighten.c:40:static struct start_info _xen_start_info;
|
||||
arch/arm/xen/enlighten.c:41:struct start_info *xen_start_info = &_xen_start_info;
|
||||
arch/arm/xen/enlighten.c:42:EXPORT_SYMBOL(xen_start_info);
|
||||
|
||||
As a result, the is_pvops_xen() in commit 4badc6229c69 ("Fix pvops
|
||||
Xen detection for kernels >= v4.20") always returns TRUE because it
|
||||
can always read out the non-null address of xen_start_info, finally
|
||||
the following error will be reported on arm/arm64 platform(non-Xen
|
||||
environment) because p2m_mid_missing and xen_p2m_addr are not defined:
|
||||
|
||||
crash: cannot resolve "p2m_top"
|
||||
|
||||
For the arm/arm64 platform, fix it by using xen_vcpu_info instead of
|
||||
xen_start_info to detect Xen dumps.
|
||||
|
||||
In addition, also explicitly narrow the scope of the xen_start_info
|
||||
check to x86 with the machine_type(), there is no need to check it on
|
||||
other architectures.
|
||||
|
||||
Fixes: 4badc6229c69 ("Fix pvops Xen detection for kernels >= v4.20")
|
||||
Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
|
||||
Acked-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
kernel.c | 20 +++++++++++++++-----
|
||||
1 file changed, 15 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/kernel.c b/kernel.c
|
||||
index 8ae9e0c169ff..a637dd0eb8f8 100644
|
||||
--- a/kernel.c
|
||||
+++ b/kernel.c
|
||||
@@ -10754,11 +10754,21 @@ is_pvops_xen(void)
|
||||
STREQ(sym, "paravirt_patch_default")))
|
||||
return TRUE;
|
||||
|
||||
- if (symbol_exists("xen_start_info") &&
|
||||
- readmem(symbol_value("xen_start_info"), KVADDR, &addr,
|
||||
- sizeof(void *), "xen_start_info", RETURN_ON_ERROR) &&
|
||||
- addr != 0)
|
||||
- return TRUE;
|
||||
+ if (machine_type("X86") || machine_type("X86_64")) {
|
||||
+ if (symbol_exists("xen_start_info") &&
|
||||
+ readmem(symbol_value("xen_start_info"), KVADDR, &addr,
|
||||
+ sizeof(void *), "xen_start_info", RETURN_ON_ERROR) &&
|
||||
+ addr != 0)
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+
|
||||
+ if (machine_type("ARM") || machine_type("ARM64")) {
|
||||
+ if (symbol_exists("xen_vcpu_info") &&
|
||||
+ readmem(symbol_value("xen_vcpu_info"), KVADDR, &addr,
|
||||
+ sizeof(void *), "xen_vcpu_info", RETURN_ON_ERROR) &&
|
||||
+ addr != 0)
|
||||
+ return TRUE;
|
||||
+ }
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,101 @@
|
||||
From 78255e3b33f8d51eb893e662dd1b05a008246b9d Mon Sep 17 00:00:00 2001
|
||||
From: Lianbo Jiang <lijiang@redhat.com>
|
||||
Date: Fri, 24 Dec 2021 18:56:35 +0800
|
||||
Subject: [PATCH 02/11] Handle blk_mq_ctx member changes for kernels 5.16-rc1
|
||||
and later
|
||||
|
||||
Kernel commit 9a14d6ce4135 ("block: remove debugfs blk_mq_ctx
|
||||
dispatched/merged/completed attributes") removed the member
|
||||
rq_dispatched and rq_completed from struct blk_mq_ctx. Without
|
||||
the patch, "dev -d|-D" options will fail with the following error:
|
||||
|
||||
crash> dev -d
|
||||
MAJOR GENDISK NAME REQUEST_QUEUE TOTAL ASYNC SYNC
|
||||
|
||||
dev: invalid structure member offset: blk_mq_ctx_rq_dispatched
|
||||
FILE: dev.c LINE: 4229 FUNCTION: get_one_mctx_diskio()
|
||||
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
---
|
||||
dev.c | 57 +++++++++++++++++++++++++++++++++++++++------------------
|
||||
1 file changed, 39 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/dev.c b/dev.c
|
||||
index effe789f38d8..a493e51ac95c 100644
|
||||
--- a/dev.c
|
||||
+++ b/dev.c
|
||||
@@ -4246,6 +4246,10 @@ get_mq_diskio(unsigned long q, unsigned long *mq_count)
|
||||
unsigned long mctx_addr;
|
||||
struct diskio tmp;
|
||||
|
||||
+ if (INVALID_MEMBER(blk_mq_ctx_rq_dispatched) ||
|
||||
+ INVALID_MEMBER(blk_mq_ctx_rq_completed))
|
||||
+ return;
|
||||
+
|
||||
memset(&tmp, 0x00, sizeof(struct diskio));
|
||||
|
||||
readmem(q + OFFSET(request_queue_queue_ctx), KVADDR, &queue_ctx,
|
||||
@@ -4475,24 +4479,41 @@ display_one_diskio(struct iter *i, unsigned long gendisk, ulong flags)
|
||||
&& (io.read + io.write == 0))
|
||||
return;
|
||||
|
||||
- fprintf(fp, "%s%s%s %s%s%s%s %s%5d%s%s%s%s%s",
|
||||
- mkstring(buf0, 5, RJUST|INT_DEC, (char *)(unsigned long)major),
|
||||
- space(MINSPACE),
|
||||
- mkstring(buf1, VADDR_PRLEN, LJUST|LONG_HEX, (char *)gendisk),
|
||||
- space(MINSPACE),
|
||||
- mkstring(buf2, 10, LJUST, disk_name),
|
||||
- space(MINSPACE),
|
||||
- mkstring(buf3, VADDR_PRLEN <= 11 ? 11 : VADDR_PRLEN,
|
||||
- LJUST|LONG_HEX, (char *)queue_addr),
|
||||
- space(MINSPACE),
|
||||
- io.read + io.write,
|
||||
- space(MINSPACE),
|
||||
- mkstring(buf4, 5, RJUST|INT_DEC,
|
||||
- (char *)(unsigned long)io.read),
|
||||
- space(MINSPACE),
|
||||
- mkstring(buf5, 5, RJUST|INT_DEC,
|
||||
- (char *)(unsigned long)io.write),
|
||||
- space(MINSPACE));
|
||||
+ if (use_mq_interface(queue_addr) &&
|
||||
+ (INVALID_MEMBER(blk_mq_ctx_rq_dispatched) ||
|
||||
+ INVALID_MEMBER(blk_mq_ctx_rq_completed)))
|
||||
+ fprintf(fp, "%s%s%s %s%s%s%s %s%s%s",
|
||||
+ mkstring(buf0, 5, RJUST|INT_DEC, (char *)(unsigned long)major),
|
||||
+ space(MINSPACE),
|
||||
+ mkstring(buf1, VADDR_PRLEN, LJUST|LONG_HEX, (char *)gendisk),
|
||||
+ space(MINSPACE),
|
||||
+ mkstring(buf2, 10, LJUST, disk_name),
|
||||
+ space(MINSPACE),
|
||||
+ mkstring(buf3, VADDR_PRLEN <= 11 ? 11 : VADDR_PRLEN,
|
||||
+ LJUST|LONG_HEX, (char *)queue_addr),
|
||||
+ space(MINSPACE),
|
||||
+ mkstring(buf4, 17, RJUST, "(not supported)"),
|
||||
+ space(MINSPACE));
|
||||
+
|
||||
+ else
|
||||
+ fprintf(fp, "%s%s%s %s%s%s%s %s%5d%s%s%s%s%s",
|
||||
+ mkstring(buf0, 5, RJUST|INT_DEC, (char *)(unsigned long)major),
|
||||
+ space(MINSPACE),
|
||||
+ mkstring(buf1, VADDR_PRLEN, LJUST|LONG_HEX, (char *)gendisk),
|
||||
+ space(MINSPACE),
|
||||
+ mkstring(buf2, 10, LJUST, disk_name),
|
||||
+ space(MINSPACE),
|
||||
+ mkstring(buf3, VADDR_PRLEN <= 11 ? 11 : VADDR_PRLEN,
|
||||
+ LJUST|LONG_HEX, (char *)queue_addr),
|
||||
+ space(MINSPACE),
|
||||
+ io.read + io.write,
|
||||
+ space(MINSPACE),
|
||||
+ mkstring(buf4, 5, RJUST|INT_DEC,
|
||||
+ (char *)(unsigned long)io.read),
|
||||
+ space(MINSPACE),
|
||||
+ mkstring(buf5, 5, RJUST|INT_DEC,
|
||||
+ (char *)(unsigned long)io.write),
|
||||
+ space(MINSPACE));
|
||||
|
||||
if (VALID_MEMBER(request_queue_in_flight)) {
|
||||
if (!use_mq_interface(queue_addr)) {
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,59 @@
|
||||
From c48177972f351d7853abb2a57709628c75ee38bc Mon Sep 17 00:00:00 2001
|
||||
From: Lianbo Jiang <lijiang@redhat.com>
|
||||
Date: Thu, 6 Jan 2022 22:34:26 +0800
|
||||
Subject: [PATCH 03/11] Fix for "timer -r" option to display all the per-CPU
|
||||
clocks
|
||||
|
||||
Currently, the hrtimer_max_clock_bases is hard-coded to 3, which
|
||||
makes that crash only prints three clocks, and the rest of clocks
|
||||
are not displayed.
|
||||
|
||||
Without the patch:
|
||||
crash> timer -r -C 11
|
||||
CPU: 11 HRTIMER_CPU_BASE: ffff9a775f95ee00
|
||||
CLOCK: 0 HRTIMER_CLOCK_BASE: ffff9a775f95ee80 [ktime_get]
|
||||
(empty)
|
||||
|
||||
CLOCK: 1 HRTIMER_CLOCK_BASE: ffff9a775f95ef00 [ktime_get_real]
|
||||
(empty)
|
||||
|
||||
CLOCK: 2 HRTIMER_CLOCK_BASE: ffff9a775f95ef80 [ktime_get_boottime]
|
||||
(empty)
|
||||
|
||||
With the patch:
|
||||
crash> timer -r -C 11
|
||||
CPU: 11 HRTIMER_CPU_BASE: ffff9a775f95ee00
|
||||
CLOCK: 0 HRTIMER_CLOCK_BASE: ffff9a775f95ee80 [ktime_get]
|
||||
(empty)
|
||||
|
||||
CLOCK: 1 HRTIMER_CLOCK_BASE: ffff9a775f95ef00 [ktime_get_real]
|
||||
(empty)
|
||||
|
||||
CLOCK: 2 HRTIMER_CLOCK_BASE: ffff9a775f95ef80 [ktime_get_boottime]
|
||||
(empty)
|
||||
...
|
||||
CLOCK: 7 HRTIMER_CLOCK_BASE: ffff9a775f95f200 [ktime_get_clocktai]
|
||||
(empty)
|
||||
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
kernel.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/kernel.c b/kernel.c
|
||||
index a637dd0eb8f8..a44a9c52ace0 100644
|
||||
--- a/kernel.c
|
||||
+++ b/kernel.c
|
||||
@@ -7672,7 +7672,8 @@ dump_hrtimer_data(const ulong *cpus)
|
||||
if (VALID_STRUCT(hrtimer_clock_base)) {
|
||||
hrtimer_max_clock_bases = 2;
|
||||
if (symbol_exists("ktime_get_boottime"))
|
||||
- hrtimer_max_clock_bases = 3;
|
||||
+ hrtimer_max_clock_bases = MEMBER_SIZE("hrtimer_cpu_base", "clock_base") /
|
||||
+ SIZE(hrtimer_clock_base);
|
||||
} else if (VALID_STRUCT(hrtimer_base)) {
|
||||
max_hrtimer_bases = 2;
|
||||
} else
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,69 @@
|
||||
From 1706f8b6ab50cd25e8fdabe8d50a37ce89bd60e0 Mon Sep 17 00:00:00 2001
|
||||
From: Lianbo Jiang <lijiang@redhat.com>
|
||||
Date: Thu, 6 Jan 2022 12:01:17 +0800
|
||||
Subject: [PATCH 04/11] Fix for "bt -v" option to display the stack-end address
|
||||
correctly
|
||||
|
||||
The "bt -v" command prints incorrect stack-end address when the
|
||||
"CONFIG_THREAD_INFO_IN_TASK=y" is enabled in kernel, the "bt -v"
|
||||
command output shows that the value stored at 0xffff8dee0312c198
|
||||
is 0xffffffffc076400a, however, the value stored actually at
|
||||
0xffff8dee0312c198 is NULL(0x0000000000000000), the stack-end
|
||||
address is incorrect.
|
||||
|
||||
Without the patch:
|
||||
crash> bt -v
|
||||
PID: 28642 TASK: ffff8dee0312c180 CPU: 0 COMMAND: "insmod"
|
||||
possible stack overflow: ffff8dee0312c198: ffffffffc076400a != STACK_END_MAGIC
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
crash> rd 0xffff8dee0312c198
|
||||
ffff8dee0312c198: 0000000000000000 ........
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
With the patch:
|
||||
crash> bt -v
|
||||
PID: 28642 TASK: ffff8dee0312c180 CPU: 0 COMMAND: "insmod"
|
||||
possible stack overflow: ffff991340bc0000: ffffffffc076400a != STACK_END_MAGIC
|
||||
|
||||
crash> rd 0xffff991340bc0000
|
||||
ffff991340bc0000: ffffffffc076400a .@v.....
|
||||
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
task.c | 10 ++++++++--
|
||||
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/task.c b/task.c
|
||||
index bb6a5da8ad33..b5ddc88e0acb 100644
|
||||
--- a/task.c
|
||||
+++ b/task.c
|
||||
@@ -11202,7 +11202,7 @@ check_stack_overflow(void)
|
||||
{
|
||||
int i, overflow, cpu_size, cpu, total;
|
||||
char buf[BUFSIZE];
|
||||
- ulong magic, task, stackbase;
|
||||
+ ulong magic, task, stackbase, location;
|
||||
struct task_context *tc;
|
||||
|
||||
if (!tt->stack_end_magic &&
|
||||
@@ -11286,9 +11286,15 @@ check_stack_end_magic:
|
||||
if (magic != STACK_END_MAGIC) {
|
||||
if (!overflow)
|
||||
print_task_header(fp, tc, 0);
|
||||
+
|
||||
+ if (tt->flags & THREAD_INFO_IN_TASK)
|
||||
+ location = task_to_stackbase(tc->task);
|
||||
+ else
|
||||
+ location = tc->thread_info + SIZE(thread_info);
|
||||
+
|
||||
fprintf(fp,
|
||||
" possible stack overflow: %lx: %lx != STACK_END_MAGIC\n",
|
||||
- tc->thread_info + SIZE(thread_info), magic);
|
||||
+ location, magic);
|
||||
overflow++, total++;
|
||||
}
|
||||
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,35 @@
|
||||
From f5637f341533ef2b28e2d6a6b12fcfb00d0fff2d Mon Sep 17 00:00:00 2001
|
||||
From: Lianbo Jiang <lijiang@redhat.com>
|
||||
Date: Mon, 10 Jan 2022 17:25:06 +0800
|
||||
Subject: [PATCH 05/11] Fix for HZ calculation on Linux 5.14 and later
|
||||
|
||||
Kernel commit 3e9a99eba058 ("block/mq-deadline: Rename dd_init_queue()
|
||||
and dd_exit_queue()") renamed dd_init_queue to dd_init_sched. Without
|
||||
the patch, the 'help -m' may print incorrect hz value as follows:
|
||||
|
||||
crash> help -m | grep hz
|
||||
hz: 1000 <---The correct hz value on ppc64le machine is 100.
|
||||
^^^^
|
||||
|
||||
Fixes: b93027ce5c75 ("Add alternate HZ calculation using write_expire")
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
task.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/task.c b/task.c
|
||||
index b5ddc88e0acb..76e184ae70b1 100644
|
||||
--- a/task.c
|
||||
+++ b/task.c
|
||||
@@ -440,6 +440,8 @@ task_init(void)
|
||||
}
|
||||
} else if ((symbol_exists("dd_init_queue") &&
|
||||
gdb_set_crash_scope(symbol_value("dd_init_queue"), "dd_init_queue")) ||
|
||||
+ (symbol_exists("dd_init_sched") &&
|
||||
+ gdb_set_crash_scope(symbol_value("dd_init_sched"), "dd_init_sched")) ||
|
||||
(symbol_exists("deadline_init_queue") &&
|
||||
gdb_set_crash_scope(symbol_value("deadline_init_queue"), "deadline_init_queue"))) {
|
||||
char buf[BUFSIZE];
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,40 @@
|
||||
From a392b27653e4e75460753522af0f006006b4dc4e Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Egorenkov <egorenar@linux.ibm.com>
|
||||
Date: Mon, 6 Dec 2021 16:04:19 +0100
|
||||
Subject: [PATCH 06/11] memory: Handle struct slab changes on Linux 5.17-rc1
|
||||
and later
|
||||
|
||||
Since kernel commit d122019bf061 ("mm: Split slab into its own type"),
|
||||
the struct slab is used for both SLAB and SLUB. Therefore, don't depend
|
||||
on the non-presence of the struct slab to decide whether SLAB implementation
|
||||
should be chosen and use the member variable "cpu_slab" of the struct
|
||||
kmem_cache instead, it should be present only in SLUB.
|
||||
|
||||
Without the patch, crash fails to start with the error message:
|
||||
|
||||
crash: invalid structure member offset: kmem_cache_s_num
|
||||
FILE: memory.c LINE: 9619 FUNCTION: kmem_cache_init()
|
||||
|
||||
Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
memory.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/memory.c b/memory.c
|
||||
index 86c02c132890..5af45fd7d834 100644
|
||||
--- a/memory.c
|
||||
+++ b/memory.c
|
||||
@@ -576,7 +576,8 @@ vm_init(void)
|
||||
STRUCT_SIZE_INIT(cpucache_s, "cpucache_s");
|
||||
|
||||
} else if (!VALID_STRUCT(kmem_slab_s) &&
|
||||
- !VALID_STRUCT(slab_s) &&
|
||||
+ !VALID_STRUCT(slab_s) &&
|
||||
+ !MEMBER_EXISTS("kmem_cache", "cpu_slab") &&
|
||||
(VALID_STRUCT(slab) || (vt->flags & SLAB_OVERLOAD_PAGE))) {
|
||||
vt->flags |= PERCPU_KMALLOC_V2;
|
||||
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,75 @@
|
||||
From fa0b6453a05c5600849e4e531c94594ed9c90270 Mon Sep 17 00:00:00 2001
|
||||
From: Lianbo Jiang <lijiang@redhat.com>
|
||||
Date: Mon, 17 Jan 2022 15:14:00 +0800
|
||||
Subject: [PATCH 07/11] Move the initialization of "boot_date" to task_init()
|
||||
|
||||
The "boot_date" is initialized conditionally in the cmd_log(), which may
|
||||
display incorrect "boot_date" value with the following command before
|
||||
running the "log -T" command:
|
||||
|
||||
crash> help -k | grep date
|
||||
date: Wed Dec 22 13:39:29 IST 2021
|
||||
boot_date: Thu Jan 1 05:30:00 IST 1970
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
The calculation of "boot_date" depends on the HZ value, and the HZ will
|
||||
be calculated in task_init() at the latest, so let's move it here.
|
||||
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
kernel.c | 18 +++---------------
|
||||
task.c | 10 ++++++++++
|
||||
2 files changed, 13 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/kernel.c b/kernel.c
|
||||
index a44a9c52ace0..9afddc0c918c 100644
|
||||
--- a/kernel.c
|
||||
+++ b/kernel.c
|
||||
@@ -5026,21 +5026,9 @@ cmd_log(void)
|
||||
if (argerrs)
|
||||
cmd_usage(pc->curcmd, SYNOPSIS);
|
||||
|
||||
- if (msg_flags & SHOW_LOG_CTIME) {
|
||||
- if (pc->flags & MINIMAL_MODE) {
|
||||
- error(WARNING, "the option '-T' is not available in minimal mode\n");
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- if (kt->boot_date.tv_sec == 0) {
|
||||
- ulonglong uptime_jiffies;
|
||||
- ulong uptime_sec;
|
||||
-
|
||||
- get_uptime(NULL, &uptime_jiffies);
|
||||
- uptime_sec = (uptime_jiffies)/(ulonglong)machdep->hz;
|
||||
- kt->boot_date.tv_sec = kt->date.tv_sec - uptime_sec;
|
||||
- kt->boot_date.tv_nsec = 0;
|
||||
- }
|
||||
+ if (msg_flags & SHOW_LOG_CTIME && pc->flags & MINIMAL_MODE) {
|
||||
+ error(WARNING, "the option '-T' is not available in minimal mode\n");
|
||||
+ return;
|
||||
}
|
||||
|
||||
if (msg_flags & SHOW_LOG_AUDIT) {
|
||||
diff --git a/task.c b/task.c
|
||||
index 76e184ae70b1..263a8344dd94 100644
|
||||
--- a/task.c
|
||||
+++ b/task.c
|
||||
@@ -692,6 +692,16 @@ task_init(void)
|
||||
|
||||
stack_overflow_check_init();
|
||||
|
||||
+ if (machdep->hz) {
|
||||
+ ulonglong uptime_jiffies;
|
||||
+ ulong uptime_sec;
|
||||
+
|
||||
+ get_uptime(NULL, &uptime_jiffies);
|
||||
+ uptime_sec = (uptime_jiffies)/(ulonglong)machdep->hz;
|
||||
+ kt->boot_date.tv_sec = kt->date.tv_sec - uptime_sec;
|
||||
+ kt->boot_date.tv_nsec = 0;
|
||||
+ }
|
||||
+
|
||||
tt->flags |= TASK_INIT_DONE;
|
||||
}
|
||||
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,79 @@
|
||||
From bbd5a5c1f5db3bde04628e75396155260333e53e Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Wed, 19 Jan 2022 16:24:49 +0900
|
||||
Subject: [PATCH 08/11] Remove ptype command from "ps -t" option to reduce
|
||||
memory and time
|
||||
|
||||
With some vmlinux e.g. RHEL9 ones, the first execution of the gdb ptype
|
||||
command heavily consumes memory and time. The "ps -t" option uses it in
|
||||
start_time_timespec(), and it can be replaced with the crash macros.
|
||||
|
||||
This can reduce about 1.4 GB memory and 6 seconds time comsumption in
|
||||
the following test:
|
||||
|
||||
$ echo "ps -t" | time crash vmlinux vmcore
|
||||
|
||||
Without the patch:
|
||||
11.60user 0.43system 0:11.94elapsed 100%CPU (0avgtext+0avgdata 1837964maxresident)k
|
||||
0inputs+400outputs (0major+413636minor)pagefaults 0swaps
|
||||
|
||||
With the patch:
|
||||
5.40user 0.16system 0:05.46elapsed 101%CPU (0avgtext+0avgdata 417896maxresident)k
|
||||
0inputs+384outputs (0major+41528minor)pagefaults 0swaps
|
||||
|
||||
Although the ptype command and similar ones cannot be fully removed,
|
||||
but removing some of them will make the use of crash safer, especially
|
||||
for an automatic crash reporter.
|
||||
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
task.c | 25 +++++--------------------
|
||||
1 file changed, 5 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/task.c b/task.c
|
||||
index 263a8344dd94..a79ed0d96fb5 100644
|
||||
--- a/task.c
|
||||
+++ b/task.c
|
||||
@@ -4662,8 +4662,6 @@ show_task_times(struct task_context *tcp, ulong flags)
|
||||
static int
|
||||
start_time_timespec(void)
|
||||
{
|
||||
- char buf[BUFSIZE];
|
||||
-
|
||||
switch(tt->flags & (TIMESPEC | NO_TIMESPEC | START_TIME_NSECS))
|
||||
{
|
||||
case TIMESPEC:
|
||||
@@ -4677,24 +4675,11 @@ start_time_timespec(void)
|
||||
|
||||
tt->flags |= NO_TIMESPEC;
|
||||
|
||||
- open_tmpfile();
|
||||
- sprintf(buf, "ptype struct task_struct");
|
||||
- if (!gdb_pass_through(buf, NULL, GNU_RETURN_ON_ERROR)) {
|
||||
- close_tmpfile();
|
||||
- return FALSE;
|
||||
- }
|
||||
-
|
||||
- rewind(pc->tmpfile);
|
||||
- while (fgets(buf, BUFSIZE, pc->tmpfile)) {
|
||||
- if (strstr(buf, "start_time;")) {
|
||||
- if (strstr(buf, "struct timespec")) {
|
||||
- tt->flags &= ~NO_TIMESPEC;
|
||||
- tt->flags |= TIMESPEC;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- close_tmpfile();
|
||||
+ if (VALID_MEMBER(task_struct_start_time) &&
|
||||
+ STREQ(MEMBER_TYPE_NAME("task_struct", "start_time"), "timespec")) {
|
||||
+ tt->flags &= ~NO_TIMESPEC;
|
||||
+ tt->flags |= TIMESPEC;
|
||||
+ }
|
||||
|
||||
if ((tt->flags & NO_TIMESPEC) && (SIZE(task_struct_start_time) == 8)) {
|
||||
tt->flags &= ~NO_TIMESPEC;
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,150 @@
|
||||
From d52cccfaa96ed6f61ff9d53da88715296e31db80 Mon Sep 17 00:00:00 2001
|
||||
From: Tao Liu <ltao@redhat.com>
|
||||
Date: Fri, 21 Jan 2022 13:43:09 +0800
|
||||
Subject: [PATCH 09/11] Improve the ps performance for vmcores with large
|
||||
number of threads
|
||||
|
||||
Previously, the ps command will iterate over all threads which
|
||||
have the same tgid, to accumulate their rss value, in order to
|
||||
get a thread/process's final rss value as part of the final output.
|
||||
|
||||
For non-live systems, the rss accumulation values are identical for
|
||||
threads which have the same tgid, so there is no need to do the
|
||||
iteration and accumulation repeatly, thus a lot of readmem calls are
|
||||
skipped. Otherwise it will be the performance bottleneck if the
|
||||
vmcores have a large number of threads.
|
||||
|
||||
In this patch, the rss accumulation value will be stored in a cache,
|
||||
next time a thread with the same tgid will take it directly without
|
||||
the iteration.
|
||||
|
||||
For example, we can monitor the performance issue when a vmcore has
|
||||
~65k processes, most of which are threads for several specific
|
||||
processes. Without the patch, it will take ~7h for ps command
|
||||
to finish. With the patch, ps command will finish in 1min.
|
||||
|
||||
Signed-off-by: Tao Liu <ltao@redhat.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
defs.h | 1 +
|
||||
memory.c | 70 +++++++++++++++++++++++++++++++-------------------------
|
||||
task.c | 1 +
|
||||
3 files changed, 41 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/defs.h b/defs.h
|
||||
index 41b6cbc6cc85..77e76f27cddb 100644
|
||||
--- a/defs.h
|
||||
+++ b/defs.h
|
||||
@@ -830,6 +830,7 @@ struct task_context { /* context stored for each task */
|
||||
struct tgid_context { /* tgid and task stored for each task */
|
||||
ulong tgid;
|
||||
ulong task;
|
||||
+ long rss_cache;
|
||||
};
|
||||
|
||||
struct task_table { /* kernel/local task table data */
|
||||
diff --git a/memory.c b/memory.c
|
||||
index 5af45fd7d834..e80c59ea4534 100644
|
||||
--- a/memory.c
|
||||
+++ b/memory.c
|
||||
@@ -4665,7 +4665,7 @@ void
|
||||
get_task_mem_usage(ulong task, struct task_mem_usage *tm)
|
||||
{
|
||||
struct task_context *tc;
|
||||
- long rss = 0;
|
||||
+ long rss = 0, rss_cache = 0;
|
||||
|
||||
BZERO(tm, sizeof(struct task_mem_usage));
|
||||
|
||||
@@ -4730,38 +4730,46 @@ get_task_mem_usage(ulong task, struct task_mem_usage *tm)
|
||||
(last->tgid == (last + 1)->tgid))
|
||||
last++;
|
||||
|
||||
- while (first <= last)
|
||||
- {
|
||||
- /* count 0 -> filepages */
|
||||
- if (!readmem(first->task +
|
||||
- OFFSET(task_struct_rss_stat) +
|
||||
- OFFSET(task_rss_stat_count), KVADDR,
|
||||
- &sync_rss,
|
||||
- sizeof(int),
|
||||
- "task_struct rss_stat MM_FILEPAGES",
|
||||
- RETURN_ON_ERROR))
|
||||
- continue;
|
||||
-
|
||||
- rss += sync_rss;
|
||||
-
|
||||
- /* count 1 -> anonpages */
|
||||
- if (!readmem(first->task +
|
||||
- OFFSET(task_struct_rss_stat) +
|
||||
- OFFSET(task_rss_stat_count) +
|
||||
- sizeof(int),
|
||||
- KVADDR, &sync_rss,
|
||||
- sizeof(int),
|
||||
- "task_struct rss_stat MM_ANONPAGES",
|
||||
- RETURN_ON_ERROR))
|
||||
- continue;
|
||||
-
|
||||
- rss += sync_rss;
|
||||
-
|
||||
- if (first == last)
|
||||
- break;
|
||||
- first++;
|
||||
+ /*
|
||||
+ * Using rss cache for dumpfile is more beneficial than live debug
|
||||
+ * because its value never changes in dumpfile.
|
||||
+ */
|
||||
+ if (ACTIVE() || last->rss_cache == UNINITIALIZED) {
|
||||
+ while (first <= last)
|
||||
+ {
|
||||
+ /* count 0 -> filepages */
|
||||
+ if (!readmem(first->task +
|
||||
+ OFFSET(task_struct_rss_stat) +
|
||||
+ OFFSET(task_rss_stat_count), KVADDR,
|
||||
+ &sync_rss,
|
||||
+ sizeof(int),
|
||||
+ "task_struct rss_stat MM_FILEPAGES",
|
||||
+ RETURN_ON_ERROR))
|
||||
+ continue;
|
||||
+
|
||||
+ rss_cache += sync_rss;
|
||||
+
|
||||
+ /* count 1 -> anonpages */
|
||||
+ if (!readmem(first->task +
|
||||
+ OFFSET(task_struct_rss_stat) +
|
||||
+ OFFSET(task_rss_stat_count) +
|
||||
+ sizeof(int),
|
||||
+ KVADDR, &sync_rss,
|
||||
+ sizeof(int),
|
||||
+ "task_struct rss_stat MM_ANONPAGES",
|
||||
+ RETURN_ON_ERROR))
|
||||
+ continue;
|
||||
+
|
||||
+ rss_cache += sync_rss;
|
||||
+
|
||||
+ if (first == last)
|
||||
+ break;
|
||||
+ first++;
|
||||
+ }
|
||||
+ last->rss_cache = rss_cache;
|
||||
}
|
||||
|
||||
+ rss += last->rss_cache;
|
||||
tt->last_tgid = last;
|
||||
}
|
||||
}
|
||||
diff --git a/task.c b/task.c
|
||||
index a79ed0d96fb5..864c838637ee 100644
|
||||
--- a/task.c
|
||||
+++ b/task.c
|
||||
@@ -2947,6 +2947,7 @@ add_context(ulong task, char *tp)
|
||||
tg = tt->tgid_array + tt->running_tasks;
|
||||
tg->tgid = *tgid_addr;
|
||||
tg->task = task;
|
||||
+ tg->rss_cache = UNINITIALIZED;
|
||||
|
||||
if (do_verify && !verify_task(tc, do_verify)) {
|
||||
error(INFO, "invalid task address: %lx\n", tc->task);
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,59 @@
|
||||
From 1a1fd21c625cb2ca335e626eb50426f13c4160f7 Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Wed, 26 Jan 2022 06:07:00 +0000
|
||||
Subject: [PATCH 10/11] arm64: Fix segfault by "bt" command with offline cpus
|
||||
|
||||
Currently on arm64, NT_PRSTATUS notes in dumpfile are not mapped to
|
||||
online cpus and machine_specific->panic_task_regs correctly. As a
|
||||
result, the "bt" command can cause a segmentation fault.
|
||||
|
||||
crash> bt -c 0
|
||||
PID: 0 TASK: ffff8000117fa240 CPU: 0 COMMAND: "swapper/0"
|
||||
Segmentation fault (core dumped)
|
||||
|
||||
To fix this,
|
||||
1) make map_cpus_to_prstatus_kdump_cmprs() map the notes to
|
||||
dd->nt_prstatus_percpu also on arm64, and
|
||||
2) move arm64_get_crash_notes() to machdep_init(POST_INIT) in order
|
||||
to apply the mapping to machine_specific->panic_task_regs.
|
||||
|
||||
Resolves: https://github.com/crash-utility/crash/issues/105
|
||||
Reported-by: xuchunmei000 <xuchunmei@linux.alibaba.com>
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Tested-by: David Wysochanski <dwysocha@redhat.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
arm64.c | 2 +-
|
||||
diskdump.c | 3 +--
|
||||
2 files changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/arm64.c b/arm64.c
|
||||
index 23c3d75d85aa..4f2c2b5104a1 100644
|
||||
--- a/arm64.c
|
||||
+++ b/arm64.c
|
||||
@@ -472,7 +472,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
|
||||
diff --git a/diskdump.c b/diskdump.c
|
||||
index 112f769f8949..690b42443ed2 100644
|
||||
--- a/diskdump.c
|
||||
+++ b/diskdump.c
|
||||
@@ -111,8 +111,7 @@ map_cpus_to_prstatus_kdump_cmprs(void)
|
||||
if (pc->flags2 & QEMU_MEM_DUMP_COMPRESSED) /* notes exist for all cpus */
|
||||
goto resize_note_pointers;
|
||||
|
||||
- if (!(online = get_cpus_online()) || (online == kt->cpus) ||
|
||||
- machine_type("ARM64"))
|
||||
+ if (!(online = get_cpus_online()) || (online == kt->cpus))
|
||||
goto resize_note_pointers;
|
||||
|
||||
if (CRASHDEBUG(1))
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,89 @@
|
||||
From 86446eaba408807e00cf2310d5748aa6b7511284 Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Wed, 2 Feb 2022 02:14:56 +0000
|
||||
Subject: [PATCH 11/11] Fix for "kmem -s|-S" and "bt -F[F]" on Linux 5.17-rc1
|
||||
|
||||
Since the following kernel commits split slab info from struct page
|
||||
into struct slab, crash cannot get several slab related offsets from
|
||||
struct page.
|
||||
|
||||
d122019bf061 ("mm: Split slab into its own type")
|
||||
07f910f9b729 ("mm: Remove slab from struct page")
|
||||
|
||||
Without the patch, "kmem -s|-S" and "bt -F[F]" options cannot work
|
||||
correctly with the following errors:
|
||||
|
||||
crash> kmem -s kmem_cache
|
||||
CACHE OBJSIZE ALLOCATED TOTAL SLABS SSIZE NAME
|
||||
kmem: page_to_nid: invalid page: ffff9454afc35020
|
||||
kmem: kmem_cache: cannot gather relevant slab data
|
||||
ffff945140042000 216 ? ? ? 8k kmem_cache
|
||||
|
||||
crash> bt -F
|
||||
...
|
||||
bt: invalid structure member offset: page_slab
|
||||
FILE: memory.c LINE: 9477 FUNCTION: vaddr_to_kmem_cache()
|
||||
|
||||
Signed-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
memory.c | 13 +++++++++++++
|
||||
1 file changed, 13 insertions(+)
|
||||
|
||||
diff --git a/memory.c b/memory.c
|
||||
index e80c59ea4534..8448ddc3a16c 100644
|
||||
--- a/memory.c
|
||||
+++ b/memory.c
|
||||
@@ -421,6 +421,8 @@ vm_init(void)
|
||||
MEMBER_OFFSET_INIT(page_prev, "page", "prev");
|
||||
if (INVALID_MEMBER(page_next))
|
||||
ANON_MEMBER_OFFSET_INIT(page_next, "page", "next");
|
||||
+ if (INVALID_MEMBER(page_next))
|
||||
+ MEMBER_OFFSET_INIT(page_next, "slab", "next");
|
||||
|
||||
MEMBER_OFFSET_INIT(page_list, "page", "list");
|
||||
if (VALID_MEMBER(page_list)) {
|
||||
@@ -747,11 +749,15 @@ vm_init(void)
|
||||
MEMBER_OFFSET_INIT(kmem_cache_random, "kmem_cache", "random");
|
||||
MEMBER_OFFSET_INIT(kmem_cache_cpu_freelist, "kmem_cache_cpu", "freelist");
|
||||
MEMBER_OFFSET_INIT(kmem_cache_cpu_page, "kmem_cache_cpu", "page");
|
||||
+ if (INVALID_MEMBER(kmem_cache_cpu_page))
|
||||
+ MEMBER_OFFSET_INIT(kmem_cache_cpu_page, "kmem_cache_cpu", "slab");
|
||||
MEMBER_OFFSET_INIT(kmem_cache_cpu_node, "kmem_cache_cpu", "node");
|
||||
MEMBER_OFFSET_INIT(kmem_cache_cpu_partial, "kmem_cache_cpu", "partial");
|
||||
MEMBER_OFFSET_INIT(page_inuse, "page", "inuse");
|
||||
if (INVALID_MEMBER(page_inuse))
|
||||
ANON_MEMBER_OFFSET_INIT(page_inuse, "page", "inuse");
|
||||
+ if (INVALID_MEMBER(page_inuse))
|
||||
+ MEMBER_OFFSET_INIT(page_inuse, "slab", "inuse");
|
||||
MEMBER_OFFSET_INIT(page_offset, "page", "offset");
|
||||
if (INVALID_MEMBER(page_offset))
|
||||
ANON_MEMBER_OFFSET_INIT(page_offset, "page", "offset");
|
||||
@@ -763,6 +769,9 @@ vm_init(void)
|
||||
if (INVALID_MEMBER(page_slab))
|
||||
ANON_MEMBER_OFFSET_INIT(page_slab, "page", "slab_cache");
|
||||
}
|
||||
+ if (INVALID_MEMBER(page_slab))
|
||||
+ MEMBER_OFFSET_INIT(page_slab, "slab", "slab_cache");
|
||||
+
|
||||
MEMBER_OFFSET_INIT(page_slab_page, "page", "slab_page");
|
||||
if (INVALID_MEMBER(page_slab_page))
|
||||
ANON_MEMBER_OFFSET_INIT(page_slab_page, "page", "slab_page");
|
||||
@@ -772,10 +781,14 @@ vm_init(void)
|
||||
MEMBER_OFFSET_INIT(page_freelist, "page", "freelist");
|
||||
if (INVALID_MEMBER(page_freelist))
|
||||
ANON_MEMBER_OFFSET_INIT(page_freelist, "page", "freelist");
|
||||
+ if (INVALID_MEMBER(page_freelist))
|
||||
+ MEMBER_OFFSET_INIT(page_freelist, "slab", "freelist");
|
||||
if (INVALID_MEMBER(kmem_cache_objects)) {
|
||||
MEMBER_OFFSET_INIT(kmem_cache_oo, "kmem_cache", "oo");
|
||||
/* NOTE: returns offset of containing bitfield */
|
||||
ANON_MEMBER_OFFSET_INIT(page_objects, "page", "objects");
|
||||
+ if (INVALID_MEMBER(page_objects))
|
||||
+ ANON_MEMBER_OFFSET_INIT(page_objects, "slab", "objects");
|
||||
}
|
||||
if (VALID_MEMBER(kmem_cache_node)) {
|
||||
ARRAY_LENGTH_INIT(len, NULL, "kmem_cache.node", NULL, 0);
|
||||
--
|
||||
2.20.1
|
||||
|
@ -4,7 +4,7 @@
|
||||
Summary: Kernel analysis utility for live systems, netdump, diskdump, kdump, LKCD or mcore dumpfiles
|
||||
Name: crash
|
||||
Version: 7.3.1
|
||||
Release: 3%{?dist}
|
||||
Release: 5%{?dist}
|
||||
License: GPLv3
|
||||
Group: Development/Debuggers
|
||||
Source0: https://github.com/crash-utility/crash/archive/crash-%{version}.tar.gz
|
||||
@ -21,6 +21,17 @@ Patch1: rhel8_build.patch
|
||||
Patch2: rhel8_freepointer.patch
|
||||
Patch3: 0001-arm64-Support-overflow-stack-panic.patch
|
||||
Patch4: 0002-defs.h-fix-breakage-of-compatibility-of-struct-symbo.patch
|
||||
Patch5: 0001-Fix-pvops-Xen-detection-for-arm-machine.patch
|
||||
Patch6: 0002-Handle-blk_mq_ctx-member-changes-for-kernels-5.16-rc.patch
|
||||
Patch7: 0003-Fix-for-timer-r-option-to-display-all-the-per-CPU-cl.patch
|
||||
Patch8: 0004-Fix-for-bt-v-option-to-display-the-stack-end-address.patch
|
||||
Patch9: 0005-Fix-for-HZ-calculation-on-Linux-5.14-and-later.patch
|
||||
Patch10: 0006-memory-Handle-struct-slab-changes-on-Linux-5.17-rc1-.patch
|
||||
Patch11: 0007-Move-the-initialization-of-boot_date-to-task_init.patch
|
||||
Patch12: 0008-Remove-ptype-command-from-ps-t-option-to-reduce-memo.patch
|
||||
Patch13: 0009-Improve-the-ps-performance-for-vmcores-with-large-nu.patch
|
||||
Patch14: 0010-arm64-Fix-segfault-by-bt-command-with-offline-cpus.patch
|
||||
Patch15: 0011-Fix-for-kmem-s-S-and-bt-F-F-on-Linux-5.17-rc1.patch
|
||||
|
||||
%description
|
||||
The core analysis suite is a self-contained tool that can be used to
|
||||
@ -46,6 +57,17 @@ offered by Mission Critical Linux, or the LKCD kernel patch.
|
||||
%patch2 -p1 -b rhel8_freepointer.patch
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
%patch14 -p1
|
||||
%patch15 -p1
|
||||
|
||||
%build
|
||||
cp %{SOURCE1} .
|
||||
@ -76,6 +98,14 @@ rm -rf %{buildroot}
|
||||
%{_includedir}/*
|
||||
|
||||
%changelog
|
||||
* Tue Feb 08 2022 Lianbo Jiang <lijiang@redhat.com> - 7.3.1-5
|
||||
- Rebuild for osci badfuncs issue
|
||||
|
||||
* Mon Feb 07 2022 Lianbo Jiang <lijiang@redhat.com> - 7.3.1-4
|
||||
- Fix segfault on aarch64 for "bt -a|-c" command
|
||||
- Fix HZ calculation on Linux 5.14 and later
|
||||
- Fix for "timer -r" option to display all the per-CPU clocks
|
||||
|
||||
* Mon Dec 13 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.1-3
|
||||
- Fix segmentation fault caused by crash extension modules
|
||||
- Support the overflow stack exception handling on aarch64
|
||||
|
Loading…
Reference in New Issue
Block a user