[PATCH] Fix misleading CPU count in display_sys_stats()
by soakley@redhat.com
From: Lucas Oakley <soakley(a)redhat.com>
This simplication fixes the total CPU count being reported
incorrectly in ppc64le and s390x systems when some number of
CPUs have been offlined, as the kt->cpus value is adjusted.
This adds the word "OFFLINE" to the 'sys' output for s390x
and ppc64le, like exists for x86_64 and aarch64 when examining
systems with offlined CPUs.
Without patch:
KERNEL: /debug/4.18.0-477.10.1.el8_8.s390x/vmlinux
DUMPFILE: /proc/kcore
CPUS: 1
With patch:
KERNEL: /debug/4.18.0-477.10.1.el8_8.s390x/vmlinux
DUMPFILE: /proc/kcore
CPUS: 2 [OFFLINE: 1]
Signed-off-by: Lucas Oakley <soakley(a)redhat.com>
---
kernel.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/kernel.c b/kernel.c
index 8c2e0ca..3e190f1 100644
--- a/kernel.c
+++ b/kernel.c
@@ -5816,15 +5816,13 @@ display_sys_stats(void)
pc->kvmdump_mapfile);
}
- if (machine_type("PPC64"))
- fprintf(fp, " CPUS: %d\n", get_cpus_to_display());
- else {
- fprintf(fp, " CPUS: %d", kt->cpus);
- if (kt->cpus - get_cpus_to_display())
- fprintf(fp, " [OFFLINE: %d]",
- kt->cpus - get_cpus_to_display());
- fprintf(fp, "\n");
- }
+ int number_cpus_to_display = get_cpus_to_display();
+ int number_cpus_present = get_cpus_present();
+ fprintf(fp, " CPUS: %d", number_cpus_present);
+ if (number_cpus_present != number_cpus_to_display)
+ fprintf(fp, " [OFFLINE: %d]",
+ number_cpus_present - number_cpus_to_display);
+ fprintf(fp, "\n");
if (ACTIVE())
get_xtime(&kt->date);
--
2.47.1
4 hours, 4 minutes
[PATCH v1 0/5] gdb multi-stack unwinding support
by Tao Liu
This patchset is based on Alexy's work [1], and is the follow-up of the
previous "gdb stack unwinding support for crash utility" patchset.
Currently gdb target analyzes only one task at a time and it backtraces
only straight stack until end of the stack. If stacks were concatenated
during exceptions or interrupts, gdb bt will show only the topmost one.
This patchset will introduce multiple stacks support for gdb stack unwinding,
which can be observed as a different threads from gdb perspective. A
short usage is as follows:
'set <PID>' - to switch to a specific task
'gdb info threads' - to see list of in-kernel stacks of this task.
'gdb thread <ID>' - to switch to the stack.
'gdb bt' - to unwind it.
E.g, with the patchset:
crash> bt
PID: 17636 TASK: ffff88032e0742c0 CPU: 11 COMMAND: "kworker/11:4"
#0 [ffff88037fca6b58] machine_kexec at ffffffff8103cef2
#1 [ffff88037fca6ba8] crash_kexec at ffffffff810c9aa3
#2 [ffff88037fca6c70] panic at ffffffff815f0444
...
#9 [ffff88037fca6ec8] do_nmi at ffffffff815fd980
#10 [ffff88037fca6ef0] end_repeat_nmi at ffffffff815fcec1
[exception RIP: memcpy+13]
RIP: ffffffff812f5b1d RSP: ffff88034f2a9728 RFLAGS: 00010046
RAX: ffffc900139fe000 RBX: ffff880374b7a1b0 RCX: 0000000000000030
RBP: ffff88034f2a9778 R8: 000000007fffffff R9: 00000000ffffffff
...
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018
--- <NMI exception stack> ---
#11 [ffff88034f2a9728] memcpy at ffffffff812f5b1d
#12 [ffff88034f2a9728] mga_dirty_update at ffffffffa024ad2b [mgag200]
#13 [ffff88034f2a9780] mga_imageblit at ffffffffa024ae3f [mgag200]
#14 [ffff88034f2a97a0] bit_putcs at ffffffff813424ef
...
crash> info threads
Id Target Id Frame
* 1 17636 kworker/11:4 (stack 0) crash_setup_regs (oldregs=0x0, newregs=0xffff88037fca6bb0)
2 17636 kworker/11:4 (stack 1) 0xffffffff812f5b1d in memcpy ()
crash> thread 2
crash> gdb bt
#0 0xffffffff812f5b1d in memcpy () at arch/x86/lib/memcpy_64.S:69
...
There are 2 stacks of the current task, and we can list/switch-to/unwind
each stack.
[1]: https://www.mail-archive.com/devel@lists.crash-utility.osci.io/msg01204.html
Tao Liu (5):
Add multi-threads support in crash target
Call cmd_bt silently after "set pid"
x86_64: Add gdb multi-stack unwind support
arm64: Add gdb multi-stack unwind support
ppc64: Add gdb multi-stack unwind support
arm64.c | 62 ++++++++++++++++++++++++++++++++++++++++----
crash_target.c | 47 +++++++++++++++++++++++++++++++---
defs.h | 3 ++-
gdb-10.2.patch | 2 +-
gdb_interface.c | 6 ++---
kernel.c | 20 +++++++++++++++
ppc64.c | 51 +++++++++++++++++++++++++++++++------
x86_64.c | 68 ++++++++++++++++++++++++++++++++++++++++---------
8 files changed, 226 insertions(+), 33 deletions(-)
--
2.47.0
20 hours, 8 minutes
Re: [PATCH] Check whether the patch command is installed before compiling
by lijiang
Hi, YePing
Thank you for the patch.
On Tue, Dec 31, 2024 at 7:22 PM <devel-request(a)lists.crash-utility.osci.io>
wrote:
> Date: Tue, 31 Dec 2024 19:21:03 +0800
> From: wonderzyp(a)gmail.com
> Subject: [Crash-utility] [PATCH] Check whether the patch command is
> installed before compiling
> To: devel(a)lists.crash-utility.osci.io
> Cc: yeping.zheng(a)nio.com, "yeping.zheng" <wonderzyp(a)gmail.com>
> Message-ID: <20241231112106.1105816-1-wonderzyp(a)gmail.com>
>
> From: "yeping.zheng" <wonderzyp(a)gmail.com>
>
> When using fedora40 build crash utility, it cannot compile successfully
> with the following log at end:
> > crash build failed
> > make[1]: *** [Makefile:267: gdb_merge] Error 1
> > make: *** [Makefile:258: all] Error 2
>
> It took me some time to find out that the failure was caused by not
> installing the patch command.
> To make it easier for others to locate this problem, this patch checks
> whether the patch command is available before compiling.
>
There are many dependencies for building crash tools, and some packages may
not be installed by default, the current issue is such a case.
>
> How do you think about it?
>
I would suggest adding a new section to README(Doc patch) and says that:
Requirements:
make gcc gcc-c++ ncurses-devel zlib-devel lzo-devel snappy-devel bison wget
patch texinfo libzstd-devel
This is for Fedora, but I'm not sure if they have the same package name on
other distributions. Can you help to investigate it? Maybe we can list
dependencies based on known distributions.
Thanks
Lianbo
>
> Thanks,
> yeping.
>
> Signed-off-by: yeping.zheng <yeping.zheng(a)nio.com>
> ---
> Makefile | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index 60dad18..0dfe0a5 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -259,6 +259,9 @@ all: make_configure
> # @$(MAKE) extensions
>
> gdb_merge: force
> + @if [ -z "$(shell command -v patch)" ]; then \
> + echo "patch is not installed. Please install it."; \
> + exit 1; fi
> @if [ ! -f ${GDB}/README ]; then \
> $(MAKE) gdb_unzip; fi
> @echo "${LDFLAGS} -lz -ldl -rdynamic" > ${GDB}/gdb/mergelibs
> --
> 2.47.1
>
1 day, 17 hours