[PATCH] Fix for "timer -r" option on Linux 5.4-rc1
by Kazuhito Hagio
Fix for Linux 5.4-rc1 and later kernels that contain commit
511885d7061eda3eb1faf3f57dcc936ff75863f1, titled "lib/timerqueue: Rely on
rbtree semantics for next timer". Without the patch, "timer -r" option
fails with the following error:
timer: invalid structure member offset: timerqueue_head_next
FILE: kernel.c LINE: 7652 FUNCTION: dump_active_timers()
Also fix a typo in MEMBER_OFFSET_INIT(timerqueue_node_node, ...).
Signed-off-by: Kazuhito Hagio <k-hagio(a)ab.jp.nec.com>
---
defs.h | 2 ++
kernel.c | 16 ++++++++++++++--
symbols.c | 4 ++++
3 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/defs.h b/defs.h
index 502e7c268448..efa40b9e1688 100644
--- a/defs.h
+++ b/defs.h
@@ -2073,6 +2073,8 @@ struct offset_table { /* stash of commonly-used offsets */
long cpu_context_save_r7;
long dentry_d_sb;
long device_private_knode_class;
+ long timerqueue_head_rb_root;
+ long rb_root_cached_rb_leftmost;
};
struct size_table { /* stash of commonly-used sizes */
diff --git a/kernel.c b/kernel.c
index 375e1b4ceb67..c4cb0018962e 100644
--- a/kernel.c
+++ b/kernel.c
@@ -783,7 +783,13 @@ kernel_init()
MEMBER_OFFSET_INIT(timerqueue_node_expires,
"timerqueue_node", "expires");
MEMBER_OFFSET_INIT(timerqueue_node_node,
- "timerqueue_node_node", "node");
+ "timerqueue_node", "node");
+ if (INVALID_MEMBER(timerqueue_head_next)) {
+ MEMBER_OFFSET_INIT(timerqueue_head_rb_root,
+ "timerqueue_head", "rb_root");
+ MEMBER_OFFSET_INIT(rb_root_cached_rb_leftmost,
+ "rb_root_cached", "rb_leftmost");
+ }
}
MEMBER_OFFSET_INIT(hrtimer_softexpires, "hrtimer", "_softexpires");
MEMBER_OFFSET_INIT(hrtimer_function, "hrtimer", "function");
@@ -7647,11 +7653,17 @@ next_one:
readmem((ulong)(base + OFFSET(hrtimer_clock_base_first)),
KVADDR, &curr, sizeof(curr), "hrtimer_clock_base first",
FAULT_ON_ERROR);
- else
+ else if (VALID_MEMBER(timerqueue_head_next))
readmem((ulong)(base + OFFSET(hrtimer_clock_base_active) +
OFFSET(timerqueue_head_next)),
KVADDR, &curr, sizeof(curr), "hrtimer_clock base",
FAULT_ON_ERROR);
+ else
+ readmem((ulong)(base + OFFSET(hrtimer_clock_base_active) +
+ OFFSET(timerqueue_head_rb_root) +
+ OFFSET(rb_root_cached_rb_leftmost)),
+ KVADDR, &curr, sizeof(curr),
+ "hrtimer_clock_base active", FAULT_ON_ERROR);
while (curr && i < next) {
curr = rb_next(curr);
diff --git a/symbols.c b/symbols.c
index 7af5e69da39b..eb88ca119751 100644
--- a/symbols.c
+++ b/symbols.c
@@ -10032,6 +10032,8 @@ dump_offset_table(char *spec, ulong makestruct)
OFFSET(rb_node_rb_left));
fprintf(fp, " rb_node_rb_right: %ld\n",
OFFSET(rb_node_rb_right));
+ fprintf(fp, " rb_root_cached_rb_leftmost: %ld\n",
+ OFFSET(rb_root_cached_rb_leftmost));
fprintf(fp, " x8664_pda_pcurrent: %ld\n",
OFFSET(x8664_pda_pcurrent));
@@ -10388,6 +10390,8 @@ dump_offset_table(char *spec, ulong makestruct)
OFFSET(hrtimer_function));
fprintf(fp, " timerqueue_head_next: %ld\n",
OFFSET(timerqueue_head_next));
+ fprintf(fp, " timerqueue_head_rb_root: %ld\n",
+ OFFSET(timerqueue_head_rb_root));
fprintf(fp, " timerqueue_node_expires: %ld\n",
OFFSET(timerqueue_node_expires));
fprintf(fp, " timerqueue_node_node: %ld\n",
--
2.18.1
5 years, 1 month
[ANNOUNCE] crash version 7.2.7 is available
by Dave Anderson
Download from: http://people.redhat.com/anderson
or
https://github.com/crash-utility/crash/releases
The github master branch serves as a development branch that will contain
all patches that are queued for the next release:
$ git clone git://github.com/crash-utility/crash.git
Changelog:
- Document the "-N", "-g" and "-z" options in the "help" command's
help page.
(k-hagio(a)ab.jp.nec.com)
- Fix for a crash-7.2.6 regression to the "p" command. Without the
patch, a gdb pass-through command construct such as:
p ((struct zone *)0xffff901e3ffda000)->min_slab_pages
gets parsed incorrectly, and the "-" is mistaken for an argument
option, and each of the subsequent characters are marked as an
"invalid option".
(dwysocha(a)redhat.com)
- Export the get_mount_list() and get_dump_level() functions in defs.h
for use by extension modules.
(k-hagio(a)ab.jp.nec.com)
- Change the gating of a debug message in the do_xarray_dump_cb()
function from CRASHDEBUG(0) to CRASHDEBUG(1). Without the patch,
users of the XArray callback functionality may see messages of the
sort "entry has XARRAY_TAG_MASK bits set: 239ab0024001" without
setting a debug number.
(anderson(a)redhat.com)
- Fix for Linux 5.2 and later x86_64 kernels that contain kernel commit
e6401c13093173aad709a5c6de00cf8d692ee786, titled "x86/irq/64: Split
the IRQ stack into its own". Without the patch, the per-cpu IRQ
stack addresses cannot be determined, and as a result backtraces
that utilize an IRQ stack will fail.
(anderson(a)redhat.com)
- Fix to allow live system analysis of s390x kernels that have been
configured with CONFIG_RANDOMIZE_BASE=y (KASLR). Without the patch,
the "--kaslr=<offset>" command line option is required.
(anderson(a)redhat.com)
- Fix for Linux 5.2 and later x86_64 kernels that contain kernel commit
019b17b3ffe48100e52f609ca1c6ed6e5a40cba1, titled "x86/exceptions: Add
structs for exception stacks". Without the patch, the exception
stack sizes cannot be determined, and as a result backtraces
that initiate from an exception stack will fail with error messages
indicating "bt: invalid kernel virtual address: <address> type:
stack contents" and then "bt: read of stack at <address> failed".
(anderson(a)redhat.com)
- Two fixes for the "sys -c" option, one that significantly shortens
the time consumed by the option, and a second fix that addresses
occasional situations where the file and line number data are not
displayed.
(k-hagio(a)ab.jp.nec.com)
- Fix for a signed/unsigned comparison bug in vmcoreinfo_read_string()
which could lead to a segmentation violation in the highly unlikely
event of a zero length or severely truncated VMCOREINFO note.
(nudasnev(a)microsoft.com)
- Fix for the determination of the ARM64 "kimage_voffset" value
in Linux 4.6 and later kernels if an ELF format dumpfile:
(1) does not contain its value in a VMCOREINFO note, and
(2) if the kernel image was loaded at a higher address than the
system's physical base address.
This may happen, for example, when analyzing a dynamically-created
ramdump-to-ELF dumpfile.
(zhaoqianli(a)xiaomi.com, anderson(a)redhat.com)
- Fix for Linux 4.16 and later ARM64 kernels that contain kernel commit
fa2a8445b1d3810c52f2a6b3a006456bd1aacb7e, titled "arm64: allow ID map
to be extended to 52 bits", and which have been configured with both
CONFIG_DEVMEM=y and CONFIG_STRICT_DEVMEM=y. Without the patch, an
inconsequential error message indicating "crash: read error: kernel
virtual address: <address> type: idmap_ptrs_per_pgd" is displayed
during initialization.
(anderson(a)redhat.com)
- Introduction of a new "bt -p" option that generates a backtrace of
the panic task, regardless of the current context. This option is
only applicable when running against dumpfiles in which the panic
task is known.
(atomlin(a)redhat.com)
- When the gdb-7.6.patch file is updated in an existing source tree,
it gets re-applied during the next build using "patch -N --fuzz=0",
which ignores patches that have already been applied. However, if
a gdb file has been modified multiple times, the secondary patching
may fail to recognize that a given patch has been previously applied,
and will attempt to re-apply it. To prevent any uninintended
consequences, the gdb-7.6.patch file will also act as a shell script
invoked by the Makefile, which restores any selected gdb file to its
original state prior to all secondary patch applications.
(anderson(a)redhat.com)
- As an addendum to the previous patch for updating the gdb-7.6.patch
in an existing pre-built source tree, when rebuilding for the ppc64
architecture, do not restore the selected gdb files. This is because
the gdb-7.6-ppc64le-support.patch will have modified the selected
files during the initial build.
(anderson(a)redhat.com)
- Extend the "timer" command with a new "TTE" column that displays the
remaining time in jiffies until the expiration of a timer entry, and
where a negative value displays the number of jiffies that have
elapsed since a timer has expired.
(oleksandr(a)redhat.com)
- Fix for a "warning: cast to pointer from integer of different size
[-Wint-to-pointer-cast]" compiler message generated by the previous
"timer" patch when compiling kernel.c on 32-bit architectures.
(anderson(a)redhat.com)
- Fix to the x86_64 "--machdep phys_base=<value>" command line option
to allow the use of a negative decimal number as the value. Without
the patch, only the hexadecimal representation of the value would be
accepted.
(v-santy(a)microsoft.com, anderson(a)redhat.com)
- Introduction of a new "rd -R" option, which will display memory in
reverse order. Memory will be displayed up to and including the
address argument, which requires that the count argument be greater
than 1 in order to display memory before the specified address.
(anderson(a)redhat.com)
- Add support for the "count" argument to be used in conjunction with
the "dis -r" and "dis -f" reverse/forward modes of operation. In
reverse mode, the specified "count" number of instructions leading
up to and including the target address will be displayed. In forward
mode, the display will be limited to "count" instructions. Without
the patch, using a count argument in either mode generates a "count
argument ignored" message, and the command proceeds as if it had
not been entered.
(anderson(a)redhat.com, atomlin(a)redhat.com)
- Fix a memory leak in the previous "dis" commit.
(anderson(a)redhat.com)
- Implemented a new "error" environment variable that sets the
destination of error messages. It can be set to either:
"default": error messages are always displayed on the
console; if the output of a command is piped to an
external command or redirected to a file, the error
messages are also sent to the pipe or file.
"redirect": if the output of a command is piped to an
external command or redirected to a file, error messages
are only sent to the pipe or file; otherwise they are
displayed on the console.
"filename": error messages are only sent to the specified
filename; they are not displayed on the console and
are not sent to a pipe or file.
(dkwon(a)redhat.com)
- Fix for the "kmem -n" option on Linux 5.3-rc1 and later kernels
that contain commit 326e1b8f83a4318b09033ef754f40c785aed5e68,
titled "mm/sparsemem: introduce a SECTION_IS_EARLY flag". Without
the patch, mem_map addresses containing the flag in bit 3 incorrectly
show it as part of the virtual address; with the patch, the option
displays the new "E" state flag.
(k-hagio(a)ab.jp.nec.com)
- Fix for the "timer" command in RHEL7.6 and later RHEL7 kernels.
Without the patch, the command emits extra faulty timer entries
because the tvec_root.vec[] and tvec.vec[] arrays are tracked using
hlist_head structures where list_head structures should be used.
(k-hagio(a)ab.jp.nec.com)
- crash-7.2.4 commit 6596f1121b added a "list -B" option to allow more
efficient enumeration of longer lists. There is a small bug with
this option where it may incorrectly flag a loop length of "0" on
list of length 1, indicating "list: loop detected, loop length: 0".
Since it is impossible to have a loop of length 0, the erroneous
message can be prevented by ensuring the list count is non-zero.
(dwysocha(a)redhat.com)
- Create the specified installation directory if it does not exist.
Without the patch, the Makefile's "make install" target will fail
if the INSTALLDIR and/or DESTDIR macros resolve to a non-existent
directory.
(pmenzel(a)molgen.mpg.de)
- Fix for the internal caching of the kernel's mem_map array of page
structures. Without the patch, in rare circumstances, commands such
as "kmem -p" may erroneously receive zero-filled page structures.
(k-hagio(a)ab.jp.nec.com)
- Fix to prevent a potential segmentation violation when accessing
the compressed configuration data contained in kernels that are
configured with CONFIG_IKCONFIG.
(chenqiwu(a)xiaomi.com)
- Determine the ARM64 SECTION_SIZE_BITS value using the following
order of precedence:
(1) from the VMCOREINFO data if it exists
(2) from the in-kernel configuration data if it exists
(3) the default value
(chenqiwu(a)xiaomi.com)
5 years, 1 month
arm64: doesn't work for kernel v5.4?
by AKASHI Takahiro
Hi Dave,
I tried to use crash v7.2.7 with kernel v5.4-rc1 on arm64.
1. VA_BITS_ACTUAL is missing in vmcoreinfo.
Does anyone work on fixing it on kernel side?
(just adding one or two lines though)
2. With a tweak above, I still fail to run crash with vmcore
seeing the following errors;
(I didn't dig into details)
crash-arm64: invalid kernel virtual address: ffff800010c689a8 type: "kernel_config_data"
WARNING: cannot read kernel_config_data
crash-arm64: invalid kernel virtual address: ffff80001177a160 type: "possible"
WARNING: cannot read cpu_possible_map
crash-arm64: invalid kernel virtual address: ffff80001177a140 type: "present"
WARNING: cannot read cpu_present_map
crash-arm64: invalid kernel virtual address: ffff80001177a120 type: "online"
WARNING: cannot read cpu_online_map
crash-arm64: invalid kernel virtual address: ffff80001177a188 type: "active"
WARNING: cannot read cpu_active_map
crash-arm64: invalid kernel virtual address: ffff80001196afe0 type: "shadow_timekeeper xtime_sec"
crash-arm64: invalid kernel virtual address: ffff800011782b3c type: "init_uts_ns"
WARNING: invalid linux_banner pointer: ffff800010c500e8
crash: vmlinux.1003 and vmcore.1003 do not match!
Have you noticed this issue?
Thanks,
-Takahiro Akashi
5 years, 1 month