On Mon, Dec 27, 2021 at 10:24 AM HAGIO KAZUHITO(萩尾 一仁) <k-hagio-ab@xxxxxxx> wrote: > > Hi Lianbo, > > thanks for the update, > > -----Original Message----- > > Subject: [PATCH v2] Handle blk_mq_ctx member changes for kernels v5.16-rc1~75^2~44 > > only "5.16-rc1" is fine, as we have the commit id below. > > > 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 > > this patch, crash 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@xxxxxxxxxx> > > --- > > change since v1: > > [1] display prompt information "(not supported)" instead of the > > statistical result if kernel does not support it > > > > dev.c | 56 ++++++++++++++++++++++++++++++++++++++------------------ > > 1 file changed, 38 insertions(+), 18 deletions(-) > > > > diff --git a/dev.c b/dev.c > > index effe789f38d8..c5e38e1c5376 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 (!MEMBER_EXISTS("blk_mq_ctx", "rq_dispatched") && > > + !MEMBER_EXISTS("blk_mq_ctx", "rq_completed")) > > + return; > > + > > It's better to use INVALID_MEMBER() here, because they are in the offset_table and > it doesn't call gdb function. And, both of them should be gone on 5.16 and later, > but let's use 'or' for safe: > > 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,40 @@ 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 (!MEMBER_EXISTS("blk_mq_ctx", "rq_dispatched") && > > + !MEMBER_EXISTS("blk_mq_ctx", "rq_completed")) > > Same as above. > > And this stops displaying the statistics of all devices on 5.16 kernel. > I think that we can stop only mq devices, so how about this? > > if (use_mq_interface(queue_addr) && > (INVALID_MEMBER(blk_mq_ctx_rq_dispatched) || > INVALID_MEMBER(blk_mq_ctx_rq_completed))) > > With this, on a 5.16-rc2 kernel: > > crash-dev> dev -d > MAJOR GENDISK NAME REQUEST_QUEUE TOTAL ASYNC SYNC > 8 ffff92bbd102e400 sdb ffff92bbf04e3678 (not supported) > 8 ffff92bbd1014400 sdc ffff92bbf04e26e8 (not supported) > 8 ffff92bbc9bff200 sdd ffff92bbf04e07c8 (not supported) > 8 ffff92bbd9676200 sda ffff92bbf04e0000 (not supported) > 11 ffff92c347da5e00 sr0 ffff92bbd9c3e528 (not supported) > 253 ffff92bbca726e00 dm-0 ffff92bbcad7dd60 0 0 0 > 253 ffff92bbe03f1000 dm-1 ffff92bbe1d587c8 0 0 0 > 253 ffff92bbe02fa800 dm-2 ffff92bc01b11f20 0 0 0 > > where dm-X devices don't use mq interface. > Looks better. > I've modified the patch and attached, you can merge it if you are OK. > Will apply this one after some tests. Thanks. Lianbo -- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/crash-utility