[PATCH v3 0/2] Get diskio statistics from the hw queues in blk-mq
by Lianbo Jiang
Currently, crash doesn't support to display disk I/O statistics
for blk-mq devices. The patchset will implement it by parsing
the bitmap, it includes two patches:
[1] [PATCH 1/2] Support for "dev -d|-D" options by parsing bitmap in
blk-mq layer
[2] [PATCH 2/2] Fix for "dev -d|-D" options to correctly display disk I/O
statistics on linux v5.18-rc1
Related kernel commits:
[1] commit <9a14d6ce4135> ("block: remove debugfs blk_mq_ctx
dispatched/merged/completed attributes")
[2] commit <4e5cc99e1e48> ("blk-mq: manage hctx map via xarray")
The patchset is tested on v5.17.0-rc8 and the latest kernel 5.18.0-rc4.
With the patchset:
crash> dev -d
MAJOR GENDISK NAME REQUEST_QUEUE TOTAL ASYNC SYNC
8 ffff93d2ca593400 sda ffff93d2c917b960 18 15 3
Changes since v2:
[1] Remove the static_rqs[] and sched_tags to exactly follow up the
kernel path
[2] Add checking if the status of rq is inflight
[3] Use TRUE/FALSE for readability
[4] Replace "if MEMBER_EXISTS()" with "if VALID_MEMBER"
[5] Align it with the colons
Lianbo Jiang (2):
Support for "dev -d|-D" options by parsing bitmap in blk-mq layer
Fix for "dev -d|-D" options to correctly display disk I/O statistics
on linux v5.18-rc1
defs.h | 12 +++
dev.c | 285 ++++++++++++++++++++++++++++++++++++++++++++++--------
symbols.c | 24 +++++
3 files changed, 282 insertions(+), 39 deletions(-)
--
2.20.1
2 years, 5 months
[PATCH] gdb: print details of unnamed struct and union
by HAGIO KAZUHITO(萩尾 一仁)
Currently gdb's "ptype" command does not print the details of unnamed
structure and union deeper than second level in a structure, it prints
only "{...}" instead. And crash's "struct" and similar commands also
inherit this behavior, so we cannot get the full information of them.
To print the details of them, change the show variable when it is an
unnamed one like crash-7.x.
Without the patch:
crash> struct -o page
struct page {
[0] unsigned long flags;
union {
struct {...};
struct {...};
...
With the patch:
crash> struct -o page
struct page {
[0] unsigned long flags;
union {
struct {
[8] struct list_head lru;
[24] struct address_space *mapping;
[32] unsigned long index;
[40] unsigned long private;
};
struct {
[8] dma_addr_t dma_addr;
};
...
Signed-off-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
---
gdb-10.2.patch | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/gdb-10.2.patch b/gdb-10.2.patch
index b67db4e1ded9..603679657eee 100644
--- a/gdb-10.2.patch
+++ b/gdb-10.2.patch
@@ -1638,3 +1638,15 @@ exit 0
$(ECHO_CXXLD) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \
-o $(shell /bin/cat mergeobj) $(LIBGDB_OBS) \
$(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES) $(shell /bin/cat mergelibs)
+--- gdb-10.2/gdb/c-typeprint.c.orig
++++ gdb-10.2/gdb/c-typeprint.c
+@@ -1202,6 +1202,9 @@ c_type_print_base_struct_union (struct t
+ = podata->end_bitpos
+ - TYPE_LENGTH (type->field (i).type ()) * TARGET_CHAR_BIT;
+ }
++ else if (strlen(TYPE_FIELD_NAME (type, i)) == 0)
++ /* crash: Print details for unnamed struct and union. */
++ newshow = show;
+
+ c_print_type_1 (type->field (i).type (),
+ TYPE_FIELD_NAME (type, i),
--
2.27.0
2 years, 5 months
Re: [Crash-utility] [PATCH] Fix for 'struct -o' option to display the offsets of struct fields
by lijiang
Hi, Kazu
On Fri, May 27, 2022 at 2:35 PM <crash-utility-request(a)redhat.com> wrote:
> Date: Fri, 27 May 2022 05:56:38 +0000
> From: HAGIO KAZUHITO(?????) <k-hagio-ab(a)nec.com>
> To: "crash-utility(a)redhat.com" <crash-utility(a)redhat.com>
> Subject: Re: [Crash-utility] [PATCH] Fix for 'struct -o' option to
> display the offsets of struct fields
> Message-ID: <3b82e6a4-63db-d163-cc55-ec268c5a4b33(a)nec.com>
> Content-Type: text/plain; charset="utf-8"
>
> On 2022/05/27 11:36, HAGIO KAZUHITO(?? ??) wrote:
> > On 2022/05/27 11:22, HAGIO KAZUHITO(?? ??) wrote:
> >> Hi Lianbo,
> >>
> >> On 2022/05/26 16:07, Lianbo Jiang wrote:
> >>> Currently, the 'struct -o' command does not display the offsets
> >>> of struct fields like this:
> >>>
> >>> crash> struct page -ox ffffce98870a0d40
> >>> struct page {
> >>> [ffffce98870a0d40] unsigned long flags;
> >>> union {
> >>> struct {...};
> >>> struct {...};
> >>> struct {...};
> >>> struct {...};
> >>> struct {...};
> >>> struct {...};
> >>> struct {...};
> >>> [ffffce98870a0d48] struct callback_head callback_head;
> >>> };
> >>> ...
> >>> }
> >>> SIZE: 0x40
> >>
> >> Good catch!
> >>
> >>>
> >>> The gdb-10.2 added a new option '/o' for the 'ptype' command, which
> >>> prints the offsets and sizes of struct fields, let's use it now to
> >>> fix the above issue.
> >>
> >> but isn't there another gdb option or setting to show their details?
> >>
> >> (gdb) ptype struct page
> >> type = struct page {
> >> unsigned long flags;
> >> union {
> >> struct {...};
> >> struct {...};
> >> struct {...};
> >> ...
> >>
> >> If there is no setting other than '/o', it's a bit strange UI design,
> >> I think.. (although I cannot find so far..)
> >>
>
Me too.
> >>
> >> Also the 'ptype /o' overdoes unfolding struct members,
> >> and extra spaces and lines are printed with the patch:
> >>
> >> * crash-7.3.2
> >>
> >> crash-7.3.2> struct address_space
> >> struct address_space {
> >> struct inode *host;
> >> struct xarray i_pages;
> >> atomic_t i_mmap_writable;
> >> struct rb_root_cached i_mmap;
> >> struct rw_semaphore i_mmap_rwsem;
> >> unsigned long nrpages;
> >> ...
> >> crash-7.3.2> struct -o address_space
> >> struct address_space {
> >> [0] struct inode *host;
> >> [8] struct xarray i_pages;
> >> [32] atomic_t i_mmap_writable;
> >> [40] struct rb_root_cached i_mmap;
> >> [56] struct rw_semaphore i_mmap_rwsem;
> >> [96] unsigned long nrpages;
> >>
> >> * With the patch
> >>
> >> crash-dev> struct address_space
> >> struct address_space {
> >> struct inode *host;
> >> struct xarray {
> >> spinlock_t xa_lock;
> >> gfp_t xa_flags;
> >> void *xa_head;
> >> size_t xarray_size_rh;
> >> struct xarray_rh {
> >> <no data fields>
> >>
> >>
> >> } _rh;
> >>
> >>
> >> } i_pages;
> >> atomic_t i_mmap_writable;
> >>
> >> struct rb_root_cached {
> >> struct rb_root {
> >> struct rb_node *rb_node;
> >> ...
> >> crash-dev> struct -o address_space
> >> struct address_space {
> >> [0] struct inode *host;
> >> struct xarray {
> >> spinlock_t xa_lock;
> >> gfp_t xa_flags;
> >> void *xa_head;
> >> size_t xarray_size_rh;
> >> struct xarray_rh {
> >> <no data fields>
> >>
> >>
> >> } _rh;
> >>
> >>
> >> [8] } i_pages;
> >> [32] atomic_t i_mmap_writable;
> >>
> >> struct rb_root_cached {
> >> struct rb_root {
> >> struct rb_node *rb_node;
> >> ...
> >>
> >>
> >> task_struct also looks wrong:
> >>
> >> crash-dev> struct -o task_struct
> >> struct task_struct {
> >> struct thread_info {
> >> [36] unsigned long flags;
> >> u32 status;
> >>
> >>
> >>
> >> [0] } thread_info;
> >> [16] volatile long state;
> >> [24] void *stack;
> >> ...
> >>
> >>
> >> If no another gdb setting, we will need to rewrite the parser.
> >> So first, I'd like to know whether there is no another setting.
> >
> > Otherwise, maybe we can patch the gdb code...
> >
> > That '{...}' is probably printed in c_type_print_base_struct_union().
> > And found a comment for c_type_print_base_1() in gdb/c-typeprint.c:
> >
> > SHOW negative means just print the type name or struct tag if there
> > is one. If there is no name, print something sensible but concise
> > like "struct {...}".
> >
> > Just an idea and clue.
>
>
I like the good idea.
> Just a rough try and I've not tested enough, but this patch might be
> somewhat good.
>
> --- gdb-10.2.orig/gdb/c-typeprint.c 2022-05-27 14:49:53.079853333 +0900
> +++ gdb-10.2/gdb/c-typeprint.c 2022-05-27 14:47:18.729165094 +0900
> @@ -1043,6 +1043,8 @@
> struct type_print_options local_flags = *flags;
> local_flags.local_typedefs = NULL;
>
> + show = 1;
> +
> std::unique_ptr<typedef_hash_table> hash_holder;
> if (!flags->raw)
> {
>
>
This looks more reasonable to me. Could you please post a patch with this
fix?
Thanks.
Lianbo
> Thanks,
> Kazu
>
> ------------------------------
>
2 years, 5 months
[PATCH v2 0/2] Get diskio statistics from the hw queues in blk-mq
by Lianbo Jiang
Currently, crash doesn't support to display disk I/O statistics
for blk-mq devices. The patchset will implement it by parsing
the bitmap, it includes two patches:
[1] [PATCH 1/2] Support for "dev -d|-D" options by parsing bitmap in
blk-mq layer
[2] [PATCH 2/2] Fix for "dev -d|-D" options to correctly display disk I/O
statistics on linux v5.18-rc1
Related kernel commits:
[1] commit <9a14d6ce4135> ("block: remove debugfs blk_mq_ctx
dispatched/merged/completed attributes")
[2] commit <4e5cc99e1e48> ("blk-mq: manage hctx map via xarray")
The patchset is tested on v5.17.0-rc8 and the latest kernel 5.18.0-rc4.
Note:
The patchset depends on the implementation of sbitmap.c, so need to
apply another patchset: "[PATCH 0/4] Fix for "sbitmapq" command" before
testing it, otherwise it won't work.
Link: https://www.mail-archive.com/crash-utility@redhat.com/msg09177.html
Lianbo Jiang (2):
Support for "dev -d|-D" options by parsing bitmap in blk-mq layer
Fix for "dev -d|-D" options to correctly display disk I/O statistics
on linux v5.18-rc1
defs.h | 13 +++
dev.c | 316 +++++++++++++++++++++++++++++++++++++++++++++++-------
symbols.c | 26 +++++
3 files changed, 316 insertions(+), 39 deletions(-)
--
2.20.1
2 years, 6 months
[PATCH] Fix for 'struct -o' option to display the offsets of struct fields
by Lianbo Jiang
Currently, the 'struct -o' command does not display the offsets
of struct fields like this:
crash> struct page -ox ffffce98870a0d40
struct page {
[ffffce98870a0d40] unsigned long flags;
union {
struct {...};
struct {...};
struct {...};
struct {...};
struct {...};
struct {...};
struct {...};
[ffffce98870a0d48] struct callback_head callback_head;
};
...
}
SIZE: 0x40
The gdb-10.2 added a new option '/o' for the 'ptype' command, which
prints the offsets and sizes of struct fields, let's use it now to
fix the above issue.
Signed-off-by: Lianbo Jiang <lijiang(a)redhat.com>
---
symbols.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/symbols.c b/symbols.c
index 5d12a021c769..9ba43dee61c8 100644
--- a/symbols.c
+++ b/symbols.c
@@ -6845,6 +6845,16 @@ do_datatype_declaration(struct datatype_member *dm, ulong flags)
len = dm->size;
multiline = NULL;
while (fgets(buf, BUFSIZE, pc->tmpfile)) {
+ char *p = NULL;
+
+ p = strstr(buf, "*/");
+ if (p) {
+ p += strlen("*/");
+ shift_string_left(buf, p - buf);
+ if (strstr(buf, "type = "))
+ strip_beginning_whitespace(buf);
+ }
+
if (STRNEQ(buf, "type = ")) {
multiline = strstr(buf, "{");
if (flags & TYPEDEF)
@@ -7802,7 +7812,7 @@ whatis_datatype(char *st, ulong flags, FILE *ofp)
else if (flags & UNION_REQUEST)
sprintf(lookbuf, "ptype union %s", st);
else if (flags & STRUCT_REQUEST)
- sprintf(lookbuf, "ptype struct %s", st);
+ sprintf(lookbuf, "ptype /o struct %s", st);
else
return;
--
2.20.1
2 years, 6 months
[PATCH v3 0/2] add '-n idle' option support for bt command
by Qi Zheng
Hi all,
This patch series adds '-n idle' option support for bt command, which can
help us filter the stack of the idle process when debugging the dumpfiles
captured by kdump.
Comments and suggestions are welcome.
Thanks,
Qi
Changelog in v2 -> v3:
- update the help text and commit log.
- compatible with unsupported architectures
- pick up Acked-bys
Changelog in v1 -> v2:
- update the help text and commit log.
Qi Zheng (2):
bt: x86_64: filter out idle task stack
bt: arm64: add support for bt -n idle
arm64.c | 19 ++++++++++++++++---
defs.h | 1 +
help.c | 32 +++++++++++++++++++++++++++++++-
kernel.c | 14 +++++++++++++-
x86_64.c | 8 ++++++++
5 files changed, 69 insertions(+), 5 deletions(-)
--
2.20.1
2 years, 6 months
[PATCH 0/4] Fix for "sbitmapq" command
by Lianbo Jiang
The sbitmapq command will fail due to the following kernel commit:
[1] commit <c548e62bcf6a> ("scsi: sbitmap: Move allocation hint
into sbitmap")
[2] commit <efe1f3a1d583> ("scsi: sbitmap: Maintain allocation
round_robin in sbitmap")
[3] commit <3301bc53358a> ("lib/sbitmap: kill 'depth' from sbitmap_word")
Without the patchset, the sbitmapq won't work.
Lianbo Jiang (4):
sbitmapq: a cleanup in the sbitmapq_init()
sbitmapq: fix invalid offset for "sbitmap_queue_alloc_hint" on linux
v5.13-rc1
sbitmapq: fix invalid offset for "sbitmap_queue_round_robin" on linux
v5.13-rc1
sbitmapq: fix invalid offset for "sbitmap_word_depth" on linux
v5.18-rc1
defs.h | 4 ++++
sbitmap.c | 70 +++++++++++++++++++++++++++----------------------------
symbols.c | 4 ++++
3 files changed, 42 insertions(+), 36 deletions(-)
--
2.20.1
2 years, 6 months
[PATCH v2 0/2] add '-n idle' option support for bt command
by Qi Zheng
Hi all,
This patch series adds '-n idle' option support for bt command, which can
help us filter the stack of the idle process when debugging the dumpfiles
captured by kdump.
Comments and suggestions are welcome.
Thanks,
Qi
Changelog in v1 -> v2:
- update the help text and commit log.
Qi Zheng (2):
bt: x86_64: filter out idle task stack
bt: arm64: add support for bt -n idle
arm64.c | 19 ++++++++++++++++---
defs.h | 1 +
help.c | 30 ++++++++++++++++++++++++++++++
kernel.c | 12 +++++++++++-
x86_64.c | 8 ++++++++
5 files changed, 66 insertions(+), 4 deletions(-)
--
2.20.1
2 years, 6 months
Re: [Crash-utility] [PATCH] Makefile: add missing crash_target.o to be cleaned
by lijiang
On Mon, May 23, 2022 at 6:04 PM <crash-utility-request(a)redhat.com> wrote:
> Date: Mon, 23 May 2022 05:55:11 +0000
> From: HAGIO KAZUHITO(?????) <k-hagio-ab(a)nec.com>
> To: "crash-utility(a)redhat.com" <crash-utility(a)redhat.com>,
> "lijiang(a)redhat.com" <lijiang(a)redhat.com>
> Subject: [Crash-utility] [PATCH] Makefile: add missing crash_target.o
> to be cleaned
> Message-ID: <a94f6f79-3c12-5271-f30e-218bf97db1ec(a)nec.com>
> Content-Type: text/plain; charset="utf-8"
>
> Without the patch, "make clean" does not remove the crash_target.o.
>
> Signed-off-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
> ---
> Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index e520b1217a9d..162c2baa5164 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -184,7 +184,7 @@ GDB_7.6_FILES=
> GDB_7.6_OFILES=${GDB}/gdb/symtab.o
>
> GDB_10.2_FILES=
> -GDB_10.2_OFILES=${GDB}/gdb/symtab.o
> +GDB_10.2_OFILES=${GDB}/gdb/symtab.o crash_target.o
>
Good findings, Kazu.This looks good to me.
Acked-by: Lianbo Jiang <lijiang(a)redhat.com>
Thanks.
#
> # GDB_FLAGS is passed up from the gdb Makefile.
> --
> 2.27.0
>
> ------------------------------
>
2 years, 6 months
[PATCH] Makefile: add missing crash_target.o to be cleaned
by HAGIO KAZUHITO(萩尾 一仁)
Without the patch, "make clean" does not remove the crash_target.o.
Signed-off-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index e520b1217a9d..162c2baa5164 100644
--- a/Makefile
+++ b/Makefile
@@ -184,7 +184,7 @@ GDB_7.6_FILES=
GDB_7.6_OFILES=${GDB}/gdb/symtab.o
GDB_10.2_FILES=
-GDB_10.2_OFILES=${GDB}/gdb/symtab.o
+GDB_10.2_OFILES=${GDB}/gdb/symtab.o crash_target.o
#
# GDB_FLAGS is passed up from the gdb Makefile.
--
2.27.0
2 years, 6 months