[PATCH V6 0/6] RISC-V fixups to work with crash tool
by Xianting Tian
I ever sent the patch 1 in the link:
https://patchwork.kernel.org/project/linux-riscv/patch/20220708073150.352...
And patch 2,3 in the link:
https://patchwork.kernel.org/project/linux-riscv/patch/20220714113300.367...
https://patchwork.kernel.org/project/linux-riscv/patch/20220714113300.367...
This patch set just put these patches together, and with three new patch 4, 5, 6.
these six patches are the fixups for machine_kexec, kernel mode PC for vmcore
and improvements for vmcoreinfo, memory layout dump and fixup schedule out issue
in machine_crash_shutdown().
The main changes in the six patchs as below,
Patch 1: Fixup use of smp_processor_id() in preemptible context, to cleanup
the console prints.
Patch 2: Fixup to get correct kernel mode PC for kernel mode regs for vmcore.
Patch 3: Fixup schedule out issue in machine_crash_shutdown()
Patch 4: Add modules to virtual kernel memory layout dump.
Patch 5: Add VM layout, va bits, ram base to vmcoreinfo, which can simplify
the development of crash tool as ARM64 already did
(arch/arm64/kernel/crash_core.c).
Patch 6: Updates vmcoreinfo.rst for vmcoreinfo export for RISCV64.
With these six patches(patch 2 is must), crash tool can work well to analyze
a vmcore. The patches for crash tool for RISCV64 is in the link:
https://lore.kernel.org/linux-riscv/20220801043040.2003264-1-xianting.tia...
------
Changes v1 -> v2:
1, remove the patch "Add a fast call path of crash_kexec()" from this series
of patches, as it already applied to riscv git.
https://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git/commit/?h...
2, add 'Reviewed-by' based on the comments of v1.
Changes v2 -> v3:
use "riscv" instead of "riscv64" in patch 5 subject line.
Changes v3 -> v4:
use "riscv" instead of "riscv64" in the summary of patch 5 subject line.
Changes v4 -> v5:
add a new patch "RISC-V: Fixup schedule out issue in machine_crash_shutdown()"
Changes v5 -> v6:
1, move "fixup" patches to the start of the patch set.
2, change patch 1, 2, 6's subject to make it tell more what it's about.
3, add Fixes for patch 3.
4, adjuest the changes format for patch 6.
Xianting Tian (6):
RISC-V: kexec: Fixup use of smp_processor_id() in preemptible context
RISC-V: Fixup get incorrect user mode PC for kernel mode regs
RISC-V: Fixup schedule out issue in machine_crash_shutdown()
RISC-V: Add modules to virtual kernel memory layout dump
RISC-V: Add arch_crash_save_vmcoreinfo support
Documentation: kdump: describe VMCOREINFO export for RISCV64
.../admin-guide/kdump/vmcoreinfo.rst | 31 +++++++++++++++++++
arch/riscv/kernel/Makefile | 1 +
arch/riscv/kernel/crash_core.c | 29 +++++++++++++++++
arch/riscv/kernel/crash_save_regs.S | 2 +-
arch/riscv/kernel/machine_kexec.c | 28 ++++++++++++++---
arch/riscv/mm/init.c | 4 +++
6 files changed, 89 insertions(+), 6 deletions(-)
create mode 100644 arch/riscv/kernel/crash_core.c
--
2.17.1
2 years, 1 month
Re: [Crash-utility] [RFC] [PATCH 0/6] Add maple tree vma iteration support for crash
by lijiang
Hi, Tao
Thanks for the work.
On Mon, Sep 19, 2022 at 11:10 PM <crash-utility-request(a)redhat.com> wrote:
> Date: Mon, 19 Sep 2022 23:10:22 +0800
> From: Tao Liu <ltao(a)redhat.com>
> To: crash-utility(a)redhat.com
> Subject: [Crash-utility] [RFC] [PATCH 0/6] Add maple tree vma
> iteration support for crash
> Message-ID: <20220919151028.25830-1-ltao(a)redhat.com>
> Content-Type: text/plain; charset="US-ASCII"; x-default=true
>
> Patchset [1] introduces maple tree data structure for linux, and the
> modification on mm subsystem.
>
> The main impact on crash utility, is the modification on vm_area_struct.
> Patch [2][3] removed the rbtree and linked list iteration of
> vm_area_struct, making it impossible for crash to iterate vma
> in the traditional way. For example, we can observe the failing
> of crash cmd vm/fuser on kernel which has integrated with patchset [1].
>
> This patchset deals with the issue by porting and adapting
> kernel's maple tree vma iteration code to crash utility. It has been
> tested on linux-next-next-20220914 [4].
>
>
Good job. But I still have several questions about the patchset.
Can you help try to tidy up the following patches? For example:
Step 1:
- introduce the maple tree data structures and iterative algorithms as
one patch.
- (they include two files: maple_tree.c, maple_tree.h)
Patch 1: the pure copy-and-paste work, extracting related kernel
> structures, functions, constants to crash.
> Patch 2: minimal code modification for crash adaption, kernel
> structures are kept for member resolving.
> Patch 3: modification on crash memory.c to use the maple vma
> iteration.
>
> The idea is to make patch 1-3 a POC work.
>
>
Step 2:
- imitate the do_rbtree(), do_radix_tree(), do_xarray()..., you could
refer to the filesys.c/tools.c
- the maple tree can be considered as a new structure and algorithm, just
like the rbtree, radix_tree and xarray..., crash can keep the same code
style.
- the advantage is that it is easy to maintain in the future.
Step 3:
- call the do_maple_tree(),... in crash code, etc...
- enable the maple tree support for crash-utility
That is my concern. But this may increase the difficulty of implementation,
can you also evaluate if it is doable?
Thanks.
Lianbo
Patch 4: Get rid of kernel structures by rewriting the structure
> member resolving code into the crash way, aka change
> "node->member" into "readmem(node) and OFFSET(member)"
> Patch 5: print the added variables of offset/size table
> Patch 6: Get rid of the compiling-time assgined arrays.
>
> Patch 4-6 will make the POC work formal for use.
>
>
> [1]:
> https://lore.kernel.org/all/20220906194824.2110408-1-Liam.Howlett@oracle....
> [2]:
> https://github.com/oracle/linux-uek/commit/d19703645b80abe35dff1a88449d07...
> [3]:
> https://github.com/oracle/linux-uek/commit/91dee01f1ebb6b6587463b6ee6f7bb...
> [4]:
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/snaps...
>
> Tao Liu (6):
> Port linux maple tree related files to crash
> Maple tree kernel code modification for step 1
> Introduce maple tree vma iteration to memory.c
> Maple tree kernel code modification for step 2
> Dump maple tree offset variables by help -o
> Remove mt_slots and mt_pivots array assignment
>
> Makefile | 12 +-
> defs.h | 19 ++
> maple_tree.c | 824 +++++++++++++++++++++++++++++++++++++++++++++++
> maple_tree.h | 109 +++++++
> maple_tree_vma.h | 34 ++
> memory.c | 315 ++++++++++--------
> symbols.c | 34 ++
> xarray.h | 70 ++++
> 8 files changed, 1285 insertions(+), 132 deletions(-)
> create mode 100644 maple_tree.c
> create mode 100644 maple_tree.h
> create mode 100644 maple_tree_vma.h
> create mode 100644 xarray.h
>
> --
> 2.33.1
>
2 years, 1 month
[PATCH] ppc64: still allow to move on if the emergency stacks info fails to initialize
by Lianbo Jiang
Currently crash will fail and then exit, if the initialization of
the emergency stacks information fails. In real customer environments,
sometimes, a vmcore may be partially damaged, although such vmcores
are rare. For example:
# ./crash ../3.10.0-1127.18.2.el7.ppc64le/vmcore ../3.10.0-1127.18.2.el7.ppc64le/vmlinux -s
crash: invalid kernel virtual address: 38 type: "paca->emergency_sp"
#
Lets try to keep loading vmcore if such issues happen, so call
the readmem() with the RETURN_ON_ERROR instead of FAULT_ON_ERROR,
which allows the crash move on.
Reported-by: Dave Wysochanski <dwysocha(a)redhat.com>
Signed-off-by: Lianbo Jiang <lijiang(a)redhat.com>
---
ppc64.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/ppc64.c b/ppc64.c
index 4ea1f7c0c6f8..f94b402ec64d 100644
--- a/ppc64.c
+++ b/ppc64.c
@@ -1224,13 +1224,13 @@ ppc64_init_paca_info(void)
ulong paca_loc;
readmem(symbol_value("paca_ptrs"), KVADDR, &paca_loc, sizeof(void *),
- "paca double pointer", FAULT_ON_ERROR);
+ "paca double pointer", RETURN_ON_ERROR);
readmem(paca_loc, KVADDR, paca_ptr, sizeof(void *) * kt->cpus,
- "paca pointers", FAULT_ON_ERROR);
+ "paca pointers", RETURN_ON_ERROR);
} else if (symbol_exists("paca") &&
(get_symbol_type("paca", NULL, NULL) == TYPE_CODE_PTR)) {
readmem(symbol_value("paca"), KVADDR, paca_ptr, sizeof(void *) * kt->cpus,
- "paca pointers", FAULT_ON_ERROR);
+ "paca pointers", RETURN_ON_ERROR);
} else {
free(paca_ptr);
return;
@@ -1245,7 +1245,7 @@ ppc64_init_paca_info(void)
for (i = 0; i < kt->cpus; i++)
readmem(paca_ptr[i] + offset, KVADDR, &ms->emergency_sp[i],
sizeof(void *), "paca->emergency_sp",
- FAULT_ON_ERROR);
+ RETURN_ON_ERROR);
}
if (MEMBER_EXISTS("paca_struct", "nmi_emergency_sp")) {
@@ -1256,7 +1256,7 @@ ppc64_init_paca_info(void)
for (i = 0; i < kt->cpus; i++)
readmem(paca_ptr[i] + offset, KVADDR, &ms->nmi_emergency_sp[i],
sizeof(void *), "paca->nmi_emergency_sp",
- FAULT_ON_ERROR);
+ RETURN_ON_ERROR);
}
if (MEMBER_EXISTS("paca_struct", "mc_emergency_sp")) {
@@ -1267,7 +1267,7 @@ ppc64_init_paca_info(void)
for (i = 0; i < kt->cpus; i++)
readmem(paca_ptr[i] + offset, KVADDR, &ms->mc_emergency_sp[i],
sizeof(void *), "paca->mc_emergency_sp",
- FAULT_ON_ERROR);
+ RETURN_ON_ERROR);
}
free(paca_ptr);
--
2.37.1
2 years, 1 month
[RFC] [PATCH 0/6] Add maple tree vma iteration support for crash
by Tao Liu
Patchset [1] introduces maple tree data structure for linux, and the
modification on mm subsystem.
The main impact on crash utility, is the modification on vm_area_struct.
Patch [2][3] removed the rbtree and linked list iteration of
vm_area_struct, making it impossible for crash to iterate vma
in the traditional way. For example, we can observe the failing
of crash cmd vm/fuser on kernel which has integrated with patchset [1].
This patchset deals with the issue by porting and adapting
kernel's maple tree vma iteration code to crash utility. It has been
tested on linux-next-next-20220914 [4].
Patch 1: the pure copy-and-paste work, extracting related kernel
structures, functions, constants to crash.
Patch 2: minimal code modification for crash adaption, kernel
structures are kept for member resolving.
Patch 3: modification on crash memory.c to use the maple vma
iteration.
The idea is to make patch 1-3 a POC work.
Patch 4: Get rid of kernel structures by rewriting the structure
member resolving code into the crash way, aka change
"node->member" into "readmem(node) and OFFSET(member)"
Patch 5: print the added variables of offset/size table
Patch 6: Get rid of the compiling-time assgined arrays.
Patch 4-6 will make the POC work formal for use.
[1]: https://lore.kernel.org/all/20220906194824.2110408-1-Liam.Howlett@oracle....
[2]: https://github.com/oracle/linux-uek/commit/d19703645b80abe35dff1a88449d07...
[3]: https://github.com/oracle/linux-uek/commit/91dee01f1ebb6b6587463b6ee6f7bb...
[4]: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/snaps...
Tao Liu (6):
Port linux maple tree related files to crash
Maple tree kernel code modification for step 1
Introduce maple tree vma iteration to memory.c
Maple tree kernel code modification for step 2
Dump maple tree offset variables by help -o
Remove mt_slots and mt_pivots array assignment
Makefile | 12 +-
defs.h | 19 ++
maple_tree.c | 824 +++++++++++++++++++++++++++++++++++++++++++++++
maple_tree.h | 109 +++++++
maple_tree_vma.h | 34 ++
memory.c | 315 ++++++++++--------
symbols.c | 34 ++
xarray.h | 70 ++++
8 files changed, 1285 insertions(+), 132 deletions(-)
create mode 100644 maple_tree.c
create mode 100644 maple_tree.h
create mode 100644 maple_tree_vma.h
create mode 100644 xarray.h
--
2.33.1
2 years, 1 month