Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1901738

Summary: due to racing per-cpu values in the kernel, crash prints incorrect stats in dev -d for blk-mq devices
Product: Red Hat Enterprise Linux 8 Reporter: John Pittman <jpittman>
Component: crashAssignee: lijiang
Status: CLOSED ERRATA QA Contact: xiaoying yan <yiyan>
Severity: urgent Docs Contact:
Priority: high    
Version: 8.2CC: bhull, bubrown, djeffery, idryomov, jmagrini, kazuhito.hagio, kdump-bugs, lijiang, loberman, mgandhi, minlei, mpg, nyewale, ruyang
Target Milestone: rcKeywords: Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: crash-7.3.2-2.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-08 09:39:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description John Pittman 2020-11-25 21:43:48 UTC
Description of problem:

crash prints incorrect stats in dev -d

crash> dev -d | grep -v '0     0     0'
MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC 
  253 ffff8c62856eb800   dm-11      ffff8c5a84a1f620     764   587   177 
  253 ffff8c5a83c02000   dm-12      ffff8c5a84a193b0      10     8     2 
  253 ffff8c5a7ba06000   dm-35      ffff8c5a81a4cec0     576   576     0

Taking /dev/dm-11 as example, we can see there are no I/O.

crash> struct request_queue.queue_ctx ffff8c5a84a1f620
  queue_ctx = 0x4640e0422cc0

crash> epython rqlist
No requests on queues

crash> epython scsishow --time
No SCSI commands found

Version-Release number of selected component (if applicable):

4.18.0-193.28.1.el8_2
crash 7.2.7-3.el8

How reproducible:

Every time with this core

Steps to Reproduce:

Run dev -d on relevant vmcore

Actual results:

Incorrect stats results

Expected results:

Correct stats results

Additional info:

In speaking with our most senior SBR member, David Jeffery, he mentioned that this was potentially a case of the stats crash is looking at being racy when QUEUE_FLAG_SAME_FORCE (rq_affinity = 2) isn't set. With it not set, per-cpu ints get modified from other CPUs without being atomic or locked in any way.  So some of the adds to rq_completed get lost and you end up with stats that look like there are still I/Os.  Ming Lei is our block/mq development expert, so he may be a good resource to speak with about calculations for dev -d when dealing w/ blk-mq devices.

Comment 2 Ming Lei 2020-12-01 02:22:37 UTC
Hello John,


(In reply to John Pittman from comment #0)
> Description of problem:
> 
> crash prints incorrect stats in dev -d
> 
> crash> dev -d | grep -v '0     0     0'
> MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC 
>   253 ffff8c62856eb800   dm-11      ffff8c5a84a1f620     764   587   177 
>   253 ffff8c5a83c02000   dm-12      ffff8c5a84a193b0      10     8     2 
>   253 ffff8c5a7ba06000   dm-35      ffff8c5a81a4cec0     576   576     0

I am not farmiliar with 'crash dev -d', can you explain a bit where the number in
last three columns is retrieved from?

Is it read from sum(ctx->rq_completed[]) on each CPU?

> 
> Taking /dev/dm-11 as example, we can see there are no I/O.
> 
> crash> struct request_queue.queue_ctx ffff8c5a84a1f620
>   queue_ctx = 0x4640e0422cc0
> 
> crash> epython rqlist
> No requests on queues
> 
> crash> epython scsishow --time
> No SCSI commands found
> 
> Version-Release number of selected component (if applicable):
> 
> 4.18.0-193.28.1.el8_2
> crash 7.2.7-3.el8
> 
> How reproducible:
> 
> Every time with this core
> 
> Steps to Reproduce:
> 
> Run dev -d on relevant vmcore
> 
> Actual results:
> 
> Incorrect stats results

Can you share more words about why it is incorrect? 

> 
> Expected results:
> 
> Correct stats results

What is the exact expected correct stats?


One more question, is there any user visible effect from this 'issue'?

thanks,
Ming

Comment 3 John Pittman 2020-12-01 14:23:35 UTC
Hi Ming, thanks a lot for looking.  We can see the dev -d values are wrong, possibly b/c rq_completed value can't be trusted, but we're not sure if there is a desire for the crash utility to track the tags as rqlist does; or if there is an alternate solution to make sure these values presented by dev -d are correct.

> I am not farmiliar with 'crash dev -d', can you explain a bit where the
> number in
> last three columns is retrieved from?

-d  display disk I/O statistics:
    TOTAL: total number of allocated in-progress I/O requests
    SYNC: I/O requests that are synchronous
    ASYNC: I/O requests that are asynchronous

The crash command uses the below routine (comparing blk_mq_ctx.rq_dispatched to blk_mq_ctx.rq_completed) to get how many I/O(requests) are active on the device.  We know there are no active requests, so it seems we can't trust rq_completed.

static void
get_one_mctx_diskio(unsigned long mctx, struct diskio *io)
{
        unsigned long dispatch[2];
        unsigned long comp[2];

        readmem(mctx + OFFSET(blk_mq_ctx_rq_dispatched),
                KVADDR, dispatch, sizeof(ulong) * 2, "blk_mq_ctx.rq_dispatched",
                FAULT_ON_ERROR);

        readmem(mctx + OFFSET(blk_mq_ctx_rq_completed),
                KVADDR, comp, sizeof(ulong) * 2, "blk_mq_ctx.rq_completed",
                FAULT_ON_ERROR);

        io->read = (dispatch[0] - comp[0]);
        io->write = (dispatch[1] - comp[1]);
}

static void
get_mq_diskio(unsigned long q, unsigned long *mq_count)
{
        int cpu;
        unsigned long queue_ctx;
        unsigned long mctx_addr;
        struct diskio tmp;

        memset(&tmp, 0x00, sizeof(struct diskio));

        readmem(q + OFFSET(request_queue_queue_ctx), KVADDR, &queue_ctx,
                sizeof(ulong), "request_queue.queue_ctx",
                FAULT_ON_ERROR);

        for (cpu = 0; cpu < kt->cpus; cpu++) {
                if ((kt->flags & SMP) && (kt->flags & PER_CPU_OFF)) {
                        mctx_addr = queue_ctx + kt->__per_cpu_offset[cpu];
                        get_one_mctx_diskio(mctx_addr, &tmp);
                        mq_count[0] += tmp.read;
                        mq_count[1] += tmp.write;
                }
        }

I will have to allow the crash developers to comment further on this portion if needed.

> 
> Can you share more words about why it is incorrect? 

Shared further info above.

> What is the exact expected correct stats?

The value of each should be 0 as from the calculations from our rqlist tool there are no active requests.  In rqlist (written by David Jeffery), we pull all available request_queue structs.  The queues are pulled (afterward sorted) from various places: all_q_list, all_q_node, bdev_map, and the scsi devices available, per host, through the siblings member of the scsi_device struct.  Then going through each request_queue, we pull all the reqeusts available, in this case, as it's blk-mq, we use get_mq_requests().  The get_mq_requests() function goes through for each context and finds the used tags, and rqlist prints only the active requests this way.  I'll post that portion below just for clarity.

check_for_sbitmap_word_cleared = 1
all_rq = 0
def find_used_tags(queue, tags, offset, rqs):
    global check_for_sbitmap_word_cleared
    out = []
    if tags.isNamed("struct sbitmap_queue"):
        tags = tags.sb

    for i in range(tags.map_nr):
        bitmap = tags.map[i].word

        if check_for_sbitmap_word_cleared:
            try:
                mask = ~tags.map[i].cleared
                bitmap = bitmap & mask
            except:
                check_for_sbitmap_word_cleared = 0

        if (not int(bitmap) and not all_rq):
            next

        for j in range(tags.map[i].depth):
            if int(bitmap) & 1:
                rq = rqs[offset]
                if rq and rq.q == queue:
                    if (member_size("struct request", "ref") != -1):
                        if rq.ref.refs.counter != 0:
                            out.append(rq)
                        elif all_rq:
                            rq._free_ = 1
                            out.append(rq)
                    else:
                        out.append(rq)
                elif rq == 0:
                    print("WARNING: bit set but no request? {} {} map {} rqs {} offset {}".format(queue, tags, i, rqs, offset))
            elif all_rq:
                rq = rqs[offset]
                if rq and rq.q == queue:
                    rq._free_ = 1
                    out.append(rq)

            offset += 1
            bitmap = bitmap >> 1
    return out

def get_mq_requests(queue):
    out = []
    if not queue.mq_ops:
        return out

    #find requests which are tagged and in the various hw queues
    for i in range(queue.nr_hw_queues):
        if queue.queue_hw_ctx[i].tags:
            out += find_used_tags(queue,
                                  queue.queue_hw_ctx[i].tags.breserved_tags,
                                  0, queue.queue_hw_ctx[i].tags.rqs)
            out += find_used_tags(queue, queue.queue_hw_ctx[i].tags.bitmap_tags,
                                  queue.queue_hw_ctx[i].tags.nr_reserved_tags,
                                  queue.queue_hw_ctx[i].tags.rqs)

        if ((member_size("struct blk_mq_hw_ctx", "sched_tags") != -1) and
          queue.queue_hw_ctx[i].sched_tags):
            out += find_used_tags(queue,
                             queue.queue_hw_ctx[i].sched_tags.breserved_tags,
                             0, queue.queue_hw_ctx[i].sched_tags.static_rqs)
            out += find_used_tags(queue,
                             queue.queue_hw_ctx[i].sched_tags.bitmap_tags,
                             queue.queue_hw_ctx[i].sched_tags.nr_reserved_tags,
                             queue.queue_hw_ctx[i].sched_tags.static_rqs)

    # I/O scheduler requests can show up in both sched_tags and hw ctx tags,
    # abuse set to remove any duplicates
    out = list(set(out))

    out.sort(key=sort_request)
    return out

> One more question, is there any user visible effect from this 'issue'?

Yes, since crash is an analysis tool, it should print the correct values to be used in that analysis.  Any incorrect values can lead users down a bad path on analysis.

Comment 4 Ming Lei 2020-12-02 02:37:09 UTC
(In reply to John Pittman from comment #3)
> Hi Ming, thanks a lot for looking.  We can see the dev -d values are wrong,
> possibly b/c rq_completed value can't be trusted, but we're not sure if
> there is a desire for the crash utility to track the tags as rqlist does; or
> if there is an alternate solution to make sure these values presented by dev
> -d are correct.
> 
> > I am not farmiliar with 'crash dev -d', can you explain a bit where the
> > number in
> > last three columns is retrieved from?
> 
> -d  display disk I/O statistics:
>     TOTAL: total number of allocated in-progress I/O requests
>     SYNC: I/O requests that are synchronous
>     ASYNC: I/O requests that are asynchronous
> 
> The crash command uses the below routine (comparing blk_mq_ctx.rq_dispatched
> to blk_mq_ctx.rq_completed) to get how many I/O(requests) are active on the
> device.  We know there are no active requests, so it seems we can't trust
> rq_completed.
> 
> static void
> get_one_mctx_diskio(unsigned long mctx, struct diskio *io)
> {
>         unsigned long dispatch[2];
>         unsigned long comp[2];
> 
>         readmem(mctx + OFFSET(blk_mq_ctx_rq_dispatched),
>                 KVADDR, dispatch, sizeof(ulong) * 2,
> "blk_mq_ctx.rq_dispatched",
>                 FAULT_ON_ERROR);
> 
>         readmem(mctx + OFFSET(blk_mq_ctx_rq_completed),
>                 KVADDR, comp, sizeof(ulong) * 2, "blk_mq_ctx.rq_completed",
>                 FAULT_ON_ERROR);
> 
>         io->read = (dispatch[0] - comp[0]);
>         io->write = (dispatch[1] - comp[1]);
> }
> 
> static void
> get_mq_diskio(unsigned long q, unsigned long *mq_count)
> {
>         int cpu;
>         unsigned long queue_ctx;
>         unsigned long mctx_addr;
>         struct diskio tmp;
> 
>         memset(&tmp, 0x00, sizeof(struct diskio));
> 
>         readmem(q + OFFSET(request_queue_queue_ctx), KVADDR, &queue_ctx,
>                 sizeof(ulong), "request_queue.queue_ctx",
>                 FAULT_ON_ERROR);
> 
>         for (cpu = 0; cpu < kt->cpus; cpu++) {
>                 if ((kt->flags & SMP) && (kt->flags & PER_CPU_OFF)) {
>                         mctx_addr = queue_ctx + kt->__per_cpu_offset[cpu];
>                         get_one_mctx_diskio(mctx_addr, &tmp);
>                         mq_count[0] += tmp.read;
>                         mq_count[1] += tmp.write;
>                 }
>         }
> 
> I will have to allow the crash developers to comment further on this portion
> if needed.

I'd suggest to not use ctx->rq_completed/ctx->rq_dispatched for 'dev -d', you can get
the allocated request number by parsing hctx->sched_tag or hctx->tags.

Also as David Jeffery mentioned, that rq_completed may be inc from remote cpu concurrently, so
the counter may become not accurate, then you observe more requests.

So far, not see anyone depend on this counter, maybe we need to kill them or simply implement them
as plain percpu counter in kernel side.

> 
> > 
> > Can you share more words about why it is incorrect? 
> 
> Shared further info above.
> 
> > What is the exact expected correct stats?
> 
> The value of each should be 0 as from the calculations from our rqlist tool
> there are no active requests.  In rqlist (written by David Jeffery), we pull
> all available request_queue structs.  The queues are pulled (afterward
> sorted) from various places: all_q_list, all_q_node, bdev_map, and the scsi
> devices available, per host, through the siblings member of the scsi_device
> struct.  Then going through each request_queue, we pull all the reqeusts
> available, in this case, as it's blk-mq, we use get_mq_requests().  The
> get_mq_requests() function goes through for each context and finds the used
> tags, and rqlist prints only the active requests this way.  I'll post that
> portion below just for clarity.
> 
> check_for_sbitmap_word_cleared = 1
> all_rq = 0
> def find_used_tags(queue, tags, offset, rqs):
>     global check_for_sbitmap_word_cleared
>     out = []
>     if tags.isNamed("struct sbitmap_queue"):
>         tags = tags.sb
> 
>     for i in range(tags.map_nr):
>         bitmap = tags.map[i].word
> 
>         if check_for_sbitmap_word_cleared:
>             try:
>                 mask = ~tags.map[i].cleared
>                 bitmap = bitmap & mask
>             except:
>                 check_for_sbitmap_word_cleared = 0
> 
>         if (not int(bitmap) and not all_rq):
>             next
> 
>         for j in range(tags.map[i].depth):
>             if int(bitmap) & 1:
>                 rq = rqs[offset]
>                 if rq and rq.q == queue:
>                     if (member_size("struct request", "ref") != -1):
>                         if rq.ref.refs.counter != 0:
>                             out.append(rq)
>                         elif all_rq:
>                             rq._free_ = 1
>                             out.append(rq)
>                     else:
>                         out.append(rq)
>                 elif rq == 0:
>                     print("WARNING: bit set but no request? {} {} map {} rqs
> {} offset {}".format(queue, tags, i, rqs, offset))
>             elif all_rq:
>                 rq = rqs[offset]
>                 if rq and rq.q == queue:
>                     rq._free_ = 1
>                     out.append(rq)
> 
>             offset += 1
>             bitmap = bitmap >> 1
>     return out
> 
> def get_mq_requests(queue):
>     out = []
>     if not queue.mq_ops:
>         return out
> 
>     #find requests which are tagged and in the various hw queues
>     for i in range(queue.nr_hw_queues):
>         if queue.queue_hw_ctx[i].tags:
>             out += find_used_tags(queue,
>                                   queue.queue_hw_ctx[i].tags.breserved_tags,
>                                   0, queue.queue_hw_ctx[i].tags.rqs)
>             out += find_used_tags(queue,
> queue.queue_hw_ctx[i].tags.bitmap_tags,
>                                  
> queue.queue_hw_ctx[i].tags.nr_reserved_tags,
>                                   queue.queue_hw_ctx[i].tags.rqs)
> 
>         if ((member_size("struct blk_mq_hw_ctx", "sched_tags") != -1) and
>           queue.queue_hw_ctx[i].sched_tags):
>             out += find_used_tags(queue,
>                              queue.queue_hw_ctx[i].sched_tags.breserved_tags,
>                              0, queue.queue_hw_ctx[i].sched_tags.static_rqs)
>             out += find_used_tags(queue,
>                              queue.queue_hw_ctx[i].sched_tags.bitmap_tags,
>                             
> queue.queue_hw_ctx[i].sched_tags.nr_reserved_tags,
>                              queue.queue_hw_ctx[i].sched_tags.static_rqs)
> 
>     # I/O scheduler requests can show up in both sched_tags and hw ctx tags,
>     # abuse set to remove any duplicates
>     out = list(set(out))
> 
>     out.sort(key=sort_request)
>     return out
> 
> > One more question, is there any user visible effect from this 'issue'?
> 
> Yes, since crash is an analysis tool, it should print the correct values to
> be used in that analysis.  Any incorrect values can lead users down a bad
> path on analysis.

IMO, the implementation on the two counters in blk-mq is quite simple, and the
reason should be concurrent inc on rq_completed. The kernel side can't provide
accurate counting for in-flight requests, which is too expensive.

I guess the crash 'dev -d' may have to live in this way, or be rewritten via
parsing sbitmap.


Thanks,
Ming

Comment 5 Dave Young 2020-12-02 05:36:24 UTC
> IMO, the implementation on the two counters in blk-mq is quite simple, and
> the
> reason should be concurrent inc on rq_completed. The kernel side can't
> provide
> accurate counting for in-flight requests, which is too expensive.
> 
> I guess the crash 'dev -d' may have to live in this way, or be rewritten via
> parsing sbitmap.

Ming, thanks for the suggestion, I believe Dave Anderson knows the details but he retired this year, I have added our crash maintainers in cc, let's see how they think.

Comment 6 lijiang 2020-12-02 06:15:00 UTC
Hi, John, Ming and Dave

Crash only reads the data from the old memory and analyzes it, which depends if the old data is reliable or accurate. Otherwise it can not get the expected results.

As Ming mentioned, I will make an investigation to see if parsing sbitmap is feasible in crash utility. Thank you for pointing out this issue, Ming.

BTW, yesterday evening, I tried to login the vmcore machine, but failed to connect. I can not copy the vmcore(vmlinux) to my local machine. Do you happen to know how to copy the vmcore/vmlinux to a local machine? John.

Thanks.

Comment 19 Nitin U. Yewale 2022-04-29 13:40:06 UTC
I tried to test the patches and following are the result. Basically didn't noticed any changes.. I will try and test again though just to ensure I am not missing anything

# git log |head
commit e8867c9ec03ff907bbd4004cb70a01dfe9873784
Author: root <root@hostname>
Date:   Fri Apr 29 18:41:20 2022 +0530

    displayio and bitmap

commit 2d193468e5fe7ee1c6be4c73083cc5ef8d922b74
Author: Kazuhito Hagio <k-hagio-ab>
Date:   Tue Apr 26 10:56:43 2022 +0900



-------------------------------------------------------------------------------------------------------


Without patch

# rpm -qa |grep crash
crash-7.3.0-2.el8.x86_64
 
crash> dev -D
MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC
  253 ffff8c62856eb800   dm-11      ffff8c5a84a1f620     764   587   177
  253 ffff8c5a83c02000   dm-12      ffff8c5a84a193b0      10     8     2
  253 ffff8c5a7ba06000   dm-35      ffff8c5a81a4cec0     576   576     0
 
 
With patch

# crash -v
 
crash 8.0.1
 
crash> dev -D
MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC
  253 ffff8c62856eb800   dm-11      ffff8c5a84a1f620     764   587   177
  253 ffff8c5a83c02000   dm-12      ffff8c5a84a193b0      10     8     2
  253 ffff8c5a7ba06000   dm-35      ffff8c5a81a4cec0     576   576     0

Comment 20 John Pittman 2022-04-30 16:10:54 UTC
Hi Lianbo, below are the results of testing latest upstream with your two patches against 8.0.1.

DUMPFILE: /cores/retrace/tasks/635327757/crash/vmcore.vmsn
RELEASE: 4.18.0-348.20.1.el8_5.x86_64
==========================================================

8.0.1
-----
crash> dev -d
MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC 
    8 ffff9aafb950e000   sda        ffff9aaf8920e9f0       1     1     0 
   11 ffff9aafba4b7000   sr0        ffff9aaf89257488       0     0     0 
  253 ffff9aafa2635000   dm-0       ffff9aaf89250000       0     0     0 
  253 ffff9aafa2633000   dm-1       ffff9aaf89251530       0     0     0 
  253 ffff9aafa0443000   dm-2       ffff9aaf89252a60       0     0     0 
  253 ffff9aaf88bdd000   dm-3       ffff9aaf89251fc8       0     0     0 
  253 ffff9aafb85c9000   dm-4       ffff9aaf89255f58       0     0     0 
  253 ffff9aafb85ce000   dm-5       ffff9aaf89250a98       1     0     1 
  253 ffff9aafb85cc000   dm-6       ffff9aaf892569f0       0     0     0 
  253 ffff9aafb85d7000   dm-7       ffff9aaf892554c0       0     0     0 
  253 ffff9aafb85d2000   dm-8       ffff9aaf89253f90       0     0     0 
crash> dev -D
MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC 
    8 ffff9aafb950e000   sda        ffff9aaf8920e9f0       1     1     0 
  253 ffff9aafb85ce000   dm-5       ffff9aaf89250a98       1     0     1 

latest upstream with patches
----------------------------

crash> dev -d
MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC 
    8 ffff9aafb950e000   sda        ffff9aaf8920e9f0       1     1     0 
   11 ffff9aafba4b7000   sr0        ffff9aaf89257488       0     0     0 
  253 ffff9aafa2635000   dm-0       ffff9aaf89250000       0     0     0 
  253 ffff9aafa2633000   dm-1       ffff9aaf89251530       0     0     0 
  253 ffff9aafa0443000   dm-2       ffff9aaf89252a60       0     0     0 
  253 ffff9aaf88bdd000   dm-3       ffff9aaf89251fc8       0     0     0 
  253 ffff9aafb85c9000   dm-4       ffff9aaf89255f58       0     0     0 
  253 ffff9aafb85ce000   dm-5       ffff9aaf89250a98       1     0     1 
  253 ffff9aafb85cc000   dm-6       ffff9aaf892569f0       0     0     0 
  253 ffff9aafb85d7000   dm-7       ffff9aaf892554c0       0     0     0 
  253 ffff9aafb85d2000   dm-8       ffff9aaf89253f90       0     0     0 
crash> dev -D
MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC 
    8 ffff9aafb950e000   sda        ffff9aaf8920e9f0       1     1     0 
  253 ffff9aafb85ce000   dm-5       ffff9aaf89250a98       1     0     1 

DUMPFILE: /cores/retrace/tasks/636103307/crash/vmcore
RELEASE: 4.18.0-193.19.1.el8_2.x86_64
=====================================================

8.0.1
-----
crash> dev -d
MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC 
    8 ffff9dd5f5744000   sda        ffff9dd5f57ee270     110     0   110 
    8 ffff9dd5f5747000   sdb        ffff9dd5f57ebb10       0     0     0 
    8 ffff9dd5f5740000   sdc        ffff9dd5f57ec4e8      17     0    17 
    8 ffff9dd5cf38b800   sdd        ffff9dd5f57e93b0       0     0     0 
  253 ffff9dd5f4cdf800   dm-0       ffff9dd5f5856c48      44    44     0 
  253 ffff9dd5f4cdc000   dm-1       ffff9dd5f5854ec0       1     1     0 
  253 ffff9dd62f8d8000   dm-2       ffff9dd630374ec0       0     0     0 
  253 ffff9dd62f945000   dm-3       ffff9dd62f91e270       0     0     0 
  253 ffff9dd62f8dc800   dm-4       ffff9dd630376c48      15    15     0 
  253 ffff9dd62f8df800   dm-6       ffff9dd630370000       0     0     0 
  253 ffff9dd62f8de000   dm-7       ffff9dd6303709d8       0     0     0 
  253 ffff9dd62f943000   dm-5       ffff9dd62f91bb10       0     0     0 
  253 ffff9dd62f8da000   dm-8       ffff9dd630371d88       0     0     0 
  253 ffff9dd62f946800   dm-9       ffff9dd62f91c4e8       0     0     0 
  253 ffff9dd62f940800   dm-10      ffff9dd62f9193b0      29    29     0 
  253 ffff9dd62f943800   dm-11      ffff9dd62f91cec0      11    11     0 
crash> dev -D
MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC 
    8 ffff9dd5f5744000   sda        ffff9dd5f57ee270     110     0   110 
    8 ffff9dd5f5740000   sdc        ffff9dd5f57ec4e8      17     0    17 
  253 ffff9dd5f4cdf800   dm-0       ffff9dd5f5856c48      44    44     0 
  253 ffff9dd5f4cdc000   dm-1       ffff9dd5f5854ec0       1     1     0 
  253 ffff9dd62f8dc800   dm-4       ffff9dd630376c48      15    15     0 
  253 ffff9dd62f940800   dm-10      ffff9dd62f9193b0      29    29     0 
  253 ffff9dd62f943800   dm-11      ffff9dd62f91cec0      11    11     0 

latest upstream with patches
----------------------------
crash> dev -d
MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC 
    8 ffff9dd5f5744000   sda        ffff9dd5f57ee270     110     0   110 
    8 ffff9dd5f5747000   sdb        ffff9dd5f57ebb10       0     0     0 
    8 ffff9dd5f5740000   sdc        ffff9dd5f57ec4e8      17     0    17 
    8 ffff9dd5cf38b800   sdd        ffff9dd5f57e93b0       0     0     0 
  253 ffff9dd5f4cdf800   dm-0       ffff9dd5f5856c48      44    44     0 
  253 ffff9dd5f4cdc000   dm-1       ffff9dd5f5854ec0       1     1     0 
  253 ffff9dd62f8d8000   dm-2       ffff9dd630374ec0       0     0     0 
  253 ffff9dd62f945000   dm-3       ffff9dd62f91e270       0     0     0 
  253 ffff9dd62f8dc800   dm-4       ffff9dd630376c48      15    15     0 
  253 ffff9dd62f8df800   dm-6       ffff9dd630370000       0     0     0 
  253 ffff9dd62f8de000   dm-7       ffff9dd6303709d8       0     0     0 
  253 ffff9dd62f943000   dm-5       ffff9dd62f91bb10       0     0     0 
  253 ffff9dd62f8da000   dm-8       ffff9dd630371d88       0     0     0 
  253 ffff9dd62f946800   dm-9       ffff9dd62f91c4e8       0     0     0 
  253 ffff9dd62f940800   dm-10      ffff9dd62f9193b0      29    29     0 
  253 ffff9dd62f943800   dm-11      ffff9dd62f91cec0      11    11     0 
crash> dev -D
MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC 
    8 ffff9dd5f5744000   sda        ffff9dd5f57ee270     110     0   110 
    8 ffff9dd5f5740000   sdc        ffff9dd5f57ec4e8      17     0    17 
  253 ffff9dd5f4cdf800   dm-0       ffff9dd5f5856c48      44    44     0 
  253 ffff9dd5f4cdc000   dm-1       ffff9dd5f5854ec0       1     1     0 
  253 ffff9dd62f8dc800   dm-4       ffff9dd630376c48      15    15     0 
  253 ffff9dd62f940800   dm-10      ffff9dd62f9193b0      29    29     0 
  253 ffff9dd62f943800   dm-11      ffff9dd62f91cec0      11    11     0 

DUMPFILE: /cores/retrace/tasks/686168480/crash/vmcore
RELEASE: 5.14.0-70.5.1.el9_0.x86_64
=====================================================

8.0.1
-----
crash> dev -d
MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC 
  252 ffff97b3f4255200   vda        ffff97b3f40988b0     (not supported) 
    8 ffff97b3f4265c00   sda        ffff97b3f409f0f0     (not supported) 
    8 ffff97b3f425b400   sdb        ffff97b3f409a2c0     (not supported) 
    8 ffff97b3f425a200   sdc        ffff97b3f409ab70     (not supported) 
    8 ffff97b3f425be00   sdd        ffff97b3f4099160     (not supported) 
    8 ffff97b3c26a8800   sde        ffff97b3f409e840     (not supported) 
    8 ffff97b3f40aac00   sdf        ffff97b3f3486840     (not supported) 
   11 ffff97b3f4276400   sr0        ffff97b3f3484580     (not supported) 
  253 ffff97b3f4257e00   dm-0       ffff97b3f39a3420       0     0     0 
  253 ffff97b3f4277600   dm-1       ffff97b3f3b42b70       0     0     0 
    8 ffff97b3c645b200   sdg        ffff97b3f34856e0     (not supported) 
crash> dev -D
MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC 

latest upstream with patches
----------------------------
crash> dev -d
MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC 
  252 ffff97b3f4255200   vda        ffff97b3f40988b0       0     0     0 
    8 ffff97b3f4265c00   sda        ffff97b3f409f0f0       0     0     0 
    8 ffff97b3f425b400   sdb        ffff97b3f409a2c0       0     0     0 
    8 ffff97b3f425a200   sdc        ffff97b3f409ab70       0     0     0 
    8 ffff97b3f425be00   sdd        ffff97b3f4099160       0     0     0 
    8 ffff97b3c26a8800   sde        ffff97b3f409e840       0     0     0 
    8 ffff97b3f40aac00   sdf        ffff97b3f3486840       0     0     0 
   11 ffff97b3f4276400   sr0        ffff97b3f3484580       0     0     0 
  253 ffff97b3f4257e00   dm-0       ffff97b3f39a3420       0     0     0 
  253 ffff97b3f4277600   dm-1       ffff97b3f3b42b70       0     0     0 
    8 ffff97b3c645b200   sdg        ffff97b3f34856e0       1     1     0 
crash> dev -D
MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC 
    8 ffff97b3c645b200   sdg        ffff97b3f34856e0       1     1     0 

crash> epython rqlist
ffff97b40ef6dd00 sdg      is active, deadline:  26.374 (30)  rq_alloc:  -3.594

Comment 21 lijiang 2022-05-02 01:32:17 UTC
(In reply to Nitin Yewale from comment #19)
> I tried to test the patches and following are the result. Basically didn't
> noticed any changes.. I will try and test again though just to ensure I am
> not missing anything
> 

As we mentioned in email thread, crash will still use the rq_dispatched|rq_completed to get the disk I/O statistics for the old kernel(before kernel v5.16-rc1), that is to say, the new patchset can work on the upstream kernel v5.16-rc1 and later. Please refer to the following commit:

kernel commit: 9a14d6ce4135 ("block: remove debugfs blk_mq_ctx dispatched/merged/completed attributes")
crash commit: 98b417fc6346 ("Handle blk_mq_ctx member changes for kernels 5.16-rc1 and later")

Could you please share your kernel version? Thanks.

Comment 22 lijiang 2022-05-02 01:45:16 UTC
Thank you for the test, John and Nitin.

For RHEL9, the kernel commit: 9a14d6ce4135 has been backported to RHEL9 since kernel-5.14.0-34.el9, please refer to the following commit:

commit b1b4351a6c6e2cdb11c3e66873dc6527ef40ba35 (tag: kernel-5.14.0-34.el9)
Author: Herton R. Krzesinski <herton>
Date:   Sat Dec 18 00:35:23 2021 +0000

    kernel-5.14.0-34.el9
...
    - block: remove debugfs blk_mq_ctx dispatched/merged/completed attributes (Ming Lei) [2018403]
...

Thanks.

Comment 23 Nitin U. Yewale 2022-05-02 10:35:13 UTC
(In reply to lijiang from comment #21)
> (In reply to Nitin Yewale from comment #19)
> > I tried to test the patches and following are the result. Basically didn't
> > noticed any changes.. I will try and test again though just to ensure I am
> > not missing anything
> > 
> 
> As we mentioned in email thread, crash will still use the
> rq_dispatched|rq_completed to get the disk I/O statistics for the old
> kernel(before kernel v5.16-rc1), that is to say, the new patchset can work
> on the upstream kernel v5.16-rc1 and later. Please refer to the following
> commit:
> 
> kernel commit: 9a14d6ce4135 ("block: remove debugfs blk_mq_ctx
> dispatched/merged/completed attributes")
> crash commit: 98b417fc6346 ("Handle blk_mq_ctx member changes for kernels
> 5.16-rc1 and later")
> 
> Could you please share your kernel version? Thanks.

Hello Lianbo,

Thanks again for the details.

Above test was on the kernel/vmcore for which this BZ was opened.

RELEASE: 4.18.0-193.28.1.el8_2.x86_64

However while testing on RHEL9 kernel 

$ uname -r
5.14.0-70.5.1.el9_0.x86_64

$ crash -v
crash 8.0.1

I am getting


Without patch

crash> dev -d
MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC 
  259 ffff996af95b7200   pmem0      ffff996afae5ce30       0     0     0 
  259 ffff997e478a0400   pmem1s     ffff997e47aca2c0       0     0     0 
    8 ffff996acb092200   sdb        ffff996afb241160     (not supported) 
    8 ffff996aca7f1e00   sda        ffff996afb242b70     (not supported) 
    8 ffff996aca7eb600   sdc        ffff996afe573cd0     (not supported) 
  259 ffff997e90191000   nvme0c0n1  ffff997e48003420     (not supported) 
  259 ffff997e9028d200   nvme1c1n1  ffff997e47b5d6e0     (not supported) 
  259 ffff997e90191200   nvme0n1    ffff997e48002b70       0     0     0 
  259 ffff997e9028e800   nvme1n1    ffff997e47b5b420       0     0     0 
  259 ffff997e9019ec00   nvme1c1n2  ffff997e624f1a10     (not supported) 
  259 ffff997e9019cc00   nvme1n2    ffff997e624f6840       0     0     0 
  259 ffff997e48247400   nvme1c1n3  ffff997e624f56e0     (not supported) 
  259 ffff997e48244600   nvme1n3    ffff997e624f3420       0     0     0 
  259 ffff997e901a3e00   nvme0c0n2  ffff997e48001160     (not supported) 
  259 ffff997e901a3c00   nvme0n2    ffff997e48000000       0     0     0 
  259 ffff997e901a8e00   nvme0c0n3  ffff997e48004e30     (not supported) 
  259 ffff997e901aae00   nvme0n3    ffff997e480008b0       0     0     0 
  259 ffff997e6338e000   nvme0c0n4  ffff997e480022c0     (not supported) 
  259 ffff997e6338f200   nvme0n4    ffff997e48005f90       0     0     0 
    8 ffff996aca7fec00   sdd        ffff997ec02dbcd0     (not supported) 
    8 ffff996aca5be600   sde        ffff997ec02fd6e0     (not supported) 
    8 ffff996acb0a0e00   sdf        ffff997ec02fb420     (not supported) 
    8 ffff996acb0cd800   sdg        ffff997ec02fab70     (not supported) 
    8 ffff996acb03bc00   sdh        ffff997ec02f9160     (not supported) 
    8 ffff996b286bfc00   sdi        ffff997ec02f8000     (not supported) 
    8 ffff996acb4a4e00   sdj        ffff997e488d9160     (not supported) 
    8 ffff996ac87b3200   sdk        ffff997e488d8000     (not supported) 
  253 ffff997ec0129600   dm-0       ffff997e46be3420       0     0     0 
  253 ffff997e4824c000   dm-1       ffff997e624f2b70       0     0     0 
    8 ffff996acb4a5000   sdl        ffff996aca729160     (not supported) 
    8 ffff996ac87b8200   sdm        ffff996aca728000     (not supported) 
    8 ffff996acb0a4200   sdn        ffff996aca72ce30     (not supported) 
    8 ffff996acb10c200   sdo        ffff996aca7288b0     (not supported) 
    8 ffff996b286bd200   sdp        ffff996aca72a2c0     (not supported) 
   65 ffff996acb038000   sdq        ffff996aca72df90     (not supported) 
   65 ffff996acb10e200   sdr        ffff996aca72f0f0     (not supported) 
    9 ffff996acd7c1800   md127      ffff996af91d88b0       0     0     0 
  253 ffff997e44ae0800   dm-2       ffff996ac854ab70       0     0     0 
  253 ffff996ae463ec00   dm-3       ffff996b430a5f90       0     0     0 
  253 ffff997e448cb800   dm-4       ffff996c32928000     (not supported) 
  253 ffff996b4988ea00   dm-5       ffff996c3292ce30     (not supported) 
  253 ffff996b488ad000   dm-6       ffff996c329288b0     (not supported) 
  253 ffff996bbe973800   dm-7       ffff996c3292a2c0     (not supported)    <-------------
  253 ffff996b423bda00   dm-8       ffff996b8f51f0f0       0     0     0 
  253 ffff996ae4349a00   dm-9       ffff996b8f51c580       0     0     0 
  253 ffff996ae4349000   dm-10      ffff996b8f51bcd0       0     0     0 
  253 ffff996b48bdb200   dm-11      ffff996c3292df90     (not supported) 
  253 ffff996bd6f57400   dm-12      ffff996c3292f0f0     (not supported) 
  253 ffff997e49bc5c00   dm-13      ffff996afe571a10       0     0     0 
  253 ffff996bed2a0e00   dm-14      ffff996c3292c580     (not supported) 
  253 ffff997e60d05000   dm-15      ffff996b49a6df90       0     0     0 
  253 ffff996b7233dc00   dm-16      ffff996b49a6f0f0       0     0     0 
  253 ffff997e4a079600   dm-17      ffff996b430a70f0       0     0     0 
  253 ffff997e4a07a200   dm-18      ffff996b430a4580       0     0     0 
  253 ffff997e637f0800   dm-19      ffff996c32a44580       0     0     0 
  253 ffff996b89b67400   dm-20      ffff996c32a43cd0       0     0     0 
crash>                     


With patches

crash> dev -D
MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC 
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
  253 ffff996bbe973800   dm-7       ffff996c3292a2c0       9     9     0          <------------------

I will see in case I am missing something.

Thank you.

Comment 24 Nitin U. Yewale 2022-05-10 07:02:19 UTC
Hello Lianbo,

I am still getting same issue with another vmcore.

Could you please suggest if I am missing something.



Without patch 

crash> dev -D
MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC 
crash> dev -d
MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC 
  259 ffff8931d9af9200   pmem0      ffff8931d9ac8000       0     0     0 
  259 ffff894560568200   pmem1s     ffff894560dd22c0       0     0     0 
    8 ffff8931d0626000   sdc        ffff894560dd1a10     (not supported) 
    8 ffff89345b277a00   sdb        ffff8931f833f0f0     (not supported) 
    8 ffff8931d156ee00   sda        ffff8931f8339a10     (not supported) 
  259 ffff89454c3f1a00   nvme1c1n1  ffff894560dd70f0     (not supported) 
  259 ffff894560575c00   nvme0c0n1  ffff89454a492b70     (not supported) 
  259 ffff89454c3f2800   nvme1n1    ffff894560dd5f90       0     0     0 
  259 ffff894560576c00   nvme0n1    ffff89454a491160       0     0     0 
  259 ffff89454c3fc000   nvme0c0n2  ffff89454a493420     (not supported) 
  259 ffff8945c1401a00   nvme0n2    ffff89454a4956e0       0     0     0 
  259 ffff8945c140a000   nvme0c0n3  ffff89454a493cd0     (not supported) 
  259 ffff89456060c000   nvme1c1n2  ffff89456079ab70     (not supported) 
  259 ffff8945c140a200   nvme0n3    ffff89454a4922c0       0     0     0 
  259 ffff89456060fe00   nvme1n2    ffff894560799160       0     0     0 
  259 ffff89454c773800   nvme0c0n4  ffff89454a491a10     (not supported) 
  259 ffff89456061bc00   nvme1c1n3  ffff89456079b420     (not supported) 
  259 ffff89454c771000   nvme0n4    ffff89454a4970f0       0     0     0 
  259 ffff894560618a00   nvme1n3    ffff89456079d6e0       0     0     0 
    8 ffff8931d157ce00   sdd        ffff8931d993c580     (not supported) 
    8 ffff8931c92ed000   sde        ffff8931d99388b0     (not supported) 
    8 ffff8931d0626c00   sdf        ffff8931d993ce30     (not supported) 
    8 ffff89345b832200   sdg        ffff8931d993e840     (not supported) 
    8 ffff8931d1266400   sdh        ffff8931eab1ab70     (not supported) 
    8 ffff8931c576c000   sdi        ffff8931eab19160     (not supported) 
    8 ffff8931d90d9400   sdj        ffff8931eab1b420     (not supported) 
    8 ffff8931d93de600   sdk        ffff89456410d6e0     (not supported) 
  253 ffff89345b34cc00   dm-0       ffff8931ea1dab70       0     0     0 
  253 ffff8931d90db800   dm-1       ffff89345a6db420       0     0     0 
    8 ffff8931d93dc000   sdl        ffff8931ea1d9160     (not supported) 
    8 ffff8931d17d1000   sdm        ffff8931ea1db420     (not supported) 
    8 ffff8931d109f000   sdn        ffff8931ea1dd6e0     (not supported) 
    8 ffff8931c576f600   sdo        ffff8931ea1dbcd0     (not supported) 
    8 ffff8931d17d4c00   sdp        ffff8931ea1da2c0     (not supported) 
   65 ffff8931c5775600   sdq        ffff8931cf0bd6e0     (not supported) 
   65 ffff8931d147dc00   sdr        ffff8931cf0bbcd0     (not supported) 
  253 ffff894564f04800   dm-2       ffff8931ea1d9a10       0     0     0 
  253 ffff894564f04c00   dm-3       ffff8931ea1df0f0       0     0     0 
    9 ffff8931c6fd4c00   md127      ffff893210bace30       0     0     0 
  253 ffff8946500f4200   dm-4       ffff8946207ce840     (not supported) 
  253 ffff894564f07c00   dm-5       ffff8946207c8000     (not supported) 
  253 ffff89454764f000   dm-6       ffff8946207cab70     (not supported) 
  253 ffff8945613f2600   dm-7       ffff8946207c9160     (not supported) 
  253 ffff8931d1168600   dm-10      ffff8931e107e840       0     0     0 
  253 ffff8931e4920400   dm-11      ffff8931e1078000       0     0     0 
  253 ffff894560c78c00   dm-12      ffff8931e107ab70       0     0     0 
  253 ffff8945613e6e00   dm-14      ffff894560709160       0     0     0 
  253 ffff8945c144d800   dm-15      ffff894590f34e30       0     0     0 
  253 ffff8945c144ea00   dm-16      ffff894590f36840       0     0     0 
  253 ffff894591609400   dm-17      ffff89456410bcd0       0     0     0 
  253 ffff8945619b8e00   dm-18      ffff89456410a2c0       0     0     0 
  253 ffff894547e55c00   dm-19      ffff89454a495f90       0     0     0 
  253 ffff894560c6b200   dm-20      ffff89454a494580       0     0     0 
  253 ffff89462b5d0600   dm-8       ffff894591f43cd0     (not supported) 
  253 ffff893200d4de00   dm-9       ffff894591f422c0     (not supported) 
  253 ffff8946b5783800   dm-13      ffff894591f41a10     (not supported) 
crash>           


--------------------------------------------------------------------------------------------

With patch

$ uname -r
5.14.0-70.5.1.el9_0.x86_64

$ rpm -qa |grep 5.14.0-70.5.1.el9
kernel-headers-5.14.0-70.5.1.el9_0.x86_64
kernel-devel-5.14.0-70.5.1.el9_0.x86_64
kernel-tools-libs-5.14.0-70.5.1.el9_0.x86_64
kernel-core-5.14.0-70.5.1.el9_0.x86_64
kernel-modules-5.14.0-70.5.1.el9_0.x86_64
kernel-5.14.0-70.5.1.el9_0.x86_64
kernel-tools-5.14.0-70.5.1.el9_0.x86_64
kernel-debuginfo-common-x86_64-5.14.0-70.5.1.el9_0.x86_64
kernel-debuginfo-5.14.0-70.5.1.el9_0.x86_64
$ 

$ crash -v
crash 8.0.1++


crash> dev -D
MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC 
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"

crash> dev -d
MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC 
  259 ffff8931d9af9200   pmem0      ffff8931d9ac8000       0     0     0 
  259 ffff894560568200   pmem1s     ffff894560dd22c0       0     0     0 
    8 ffff8931d0626000   sdc        ffff894560dd1a10       0     0     0 
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
    8 ffff89345b277a00   sdb        ffff8931f833f0f0       0     0     0 
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
    8 ffff8931d156ee00   sda        ffff8931f8339a10       0     0     0 
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
  259 ffff89454c3f1a00   nvme1c1n1  ffff894560dd70f0       0     0     0 
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
  259 ffff894560575c00   nvme0c0n1  ffff89454a492b70       0     0     0 
  259 ffff89454c3f2800   nvme1n1    ffff894560dd5f90       0     0     0 
  259 ffff894560576c00   nvme0n1    ffff89454a491160       0     0     0 
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
  259 ffff89454c3fc000   nvme0c0n2  ffff89454a493420       0     0     0 
  259 ffff8945c1401a00   nvme0n2    ffff89454a4956e0       0     0     0 
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
  259 ffff8945c140a000   nvme0c0n3  ffff89454a493cd0       0     0     0 
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
  259 ffff89456060c000   nvme1c1n2  ffff89456079ab70       0     0     0 
  259 ffff8945c140a200   nvme0n3    ffff89454a4922c0       0     0     0 
  259 ffff89456060fe00   nvme1n2    ffff894560799160       0     0     0 
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
  259 ffff89454c773800   nvme0c0n4  ffff89454a491a10       0     0     0 
dev: seek error: kernel virtual address: ffffffff00007530  type: "blk_mq_hw_ctx"
  259 ffff89456061bc00   nvme1c1n3  ffff89456079b420       0     0     0 
  259 ffff89454c771000   nvme0n4    ffff89454a4970f0       0     0     0 
  259 ffff894560618a00   nvme1n3    ffff89456079d6e0       0     0     0 
    8 ffff8931d157ce00   sdd        ffff8931d993c580       0     0     0 
    8 ffff8931c92ed000   sde        ffff8931d99388b0       0     0     0 
    8 ffff8931d0626c00   sdf        ffff8931d993ce30       0     0     0 
    8 ffff89345b832200   sdg        ffff8931d993e840       0     0     0 
    8 ffff8931d1266400   sdh        ffff8931eab1ab70       0     0     0 
    8 ffff8931c576c000   sdi        ffff8931eab19160       0     0     0 
    8 ffff8931d90d9400   sdj        ffff8931eab1b420       0     0     0 
    8 ffff8931d93de600   sdk        ffff89456410d6e0       0     0     0 
  253 ffff89345b34cc00   dm-0       ffff8931ea1dab70       0     0     0 
  253 ffff8931d90db800   dm-1       ffff89345a6db420       0     0     0 
    8 ffff8931d93dc000   sdl        ffff8931ea1d9160       0     0     0 
    8 ffff8931d17d1000   sdm        ffff8931ea1db420       0     0     0 
    8 ffff8931d109f000   sdn        ffff8931ea1dd6e0       0     0     0 
    8 ffff8931c576f600   sdo        ffff8931ea1dbcd0       0     0     0 
    8 ffff8931d17d4c00   sdp        ffff8931ea1da2c0       0     0     0 
   65 ffff8931c5775600   sdq        ffff8931cf0bd6e0       0     0     0 
   65 ffff8931d147dc00   sdr        ffff8931cf0bbcd0       0     0     0 
  253 ffff894564f04800   dm-2       ffff8931ea1d9a10       0     0     0 
  253 ffff894564f04c00   dm-3       ffff8931ea1df0f0       0     0     0 
    9 ffff8931c6fd4c00   md127      ffff893210bace30       0     0     0 
  253 ffff8946500f4200   dm-4       ffff8946207ce840       0     0     0 
  253 ffff894564f07c00   dm-5       ffff8946207c8000       0     0     0 
  253 ffff89454764f000   dm-6       ffff8946207cab70       0     0     0 
  253 ffff8945613f2600   dm-7       ffff8946207c9160       0     0     0 
  253 ffff8931d1168600   dm-10      ffff8931e107e840       0     0     0 
  253 ffff8931e4920400   dm-11      ffff8931e1078000       0     0     0 
  253 ffff894560c78c00   dm-12      ffff8931e107ab70       0     0     0 
  253 ffff8945613e6e00   dm-14      ffff894560709160       0     0     0 
  253 ffff8945c144d800   dm-15      ffff894590f34e30       0     0     0 
  253 ffff8945c144ea00   dm-16      ffff894590f36840       0     0     0 
  253 ffff894591609400   dm-17      ffff89456410bcd0       0     0     0 
  253 ffff8945619b8e00   dm-18      ffff89456410a2c0       0     0     0 
  253 ffff894547e55c00   dm-19      ffff89454a495f90       0     0     0 
  253 ffff894560c6b200   dm-20      ffff89454a494580       0     0     0 
  253 ffff89462b5d0600   dm-8       ffff894591f43cd0       0     0     0 
  253 ffff893200d4de00   dm-9       ffff894591f422c0       0     0     0 
  253 ffff8946b5783800   dm-13      ffff894591f41a10       0     0     0 
crash> 

------------------------------------------------------------------------------


Checking on galvatron.

Thank you.

Comment 25 lijiang 2022-05-12 01:07:14 UTC
> With patches
> 
> crash> dev -D
> MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC 
> dev: seek error: kernel virtual address: ffffffff00007530  type:
> "blk_mq_hw_ctx"
> dev: seek error: kernel virtual address: ffffffff00007530  type:
> "blk_mq_hw_ctx"
> dev: seek error: kernel virtual address: ffffffff00007530  type:
> "blk_mq_hw_ctx"
> dev: seek error: kernel virtual address: ffffffff00007530  type:
> "blk_mq_hw_ctx"
> dev: seek error: kernel virtual address: ffffffff00007530  type:
> "blk_mq_hw_ctx"
> dev: seek error: kernel virtual address: ffffffff00007530  type:
> "blk_mq_hw_ctx"
> dev: seek error: kernel virtual address: ffffffff00007530  type:
> "blk_mq_hw_ctx"
> dev: seek error: kernel virtual address: ffffffff00007530  type:
> "blk_mq_hw_ctx"
> dev: seek error: kernel virtual address: ffffffff00007530  type:
> "blk_mq_hw_ctx"
>   253 ffff996bbe973800   dm-7       ffff996c3292a2c0       9     9     0    
> <------------------
> 
Thank you for the feedback, Nitin.

That should be expected, because the kernel virtual address is invalid, but I'm not sure why kernel doesn't handle(or sync) the address correctly in the queue_hw_ctx[].

But anyway, crash should consider it to avoid "seek error" for the invalid address:

diff --git a/dev.c b/dev.c
index 64caaf4bd88d..77b097d15cf0 100644
--- a/dev.c
+++ b/dev.c
@@ -4467,8 +4467,8 @@ static void get_mq_diskio_from_hw_queues(unsigned long q, struct diskio *io_coun
                        continue;
 
                if (!readmem(queue_hw_ctx[i], KVADDR, &queue_hw_ctx_addr,
-                               sizeof(ulong), "blk_mq_hw_ctx", RETURN_ON_ERROR))
-                       goto queue_hw_ctx_free;
+                               sizeof(ulong), "blk_mq_hw_ctx", QUIET|RETURN_ON_ERROR))
+                       continue;
 
                if(!IS_KVADDR(queue_hw_ctx_addr))
                        continue;

Could you help to apply additional patch and try it again? Thank.

Comment 26 lijiang 2022-05-13 11:32:44 UTC
Hi, Nitin

I will try to improve the patch v1, and post the v2 later.

We can continue to do more tests based patch v2.

Thanks.

Comment 27 lijiang 2022-05-23 10:46:06 UTC
For the patchset V2:
Link: https://www.mail-archive.com/crash-utility@redhat.com/msg09182.html

But, need to apply another patchset before testing the dev -d command because it depends on the implementation of sbitmap.c

Link: https://www.mail-archive.com/crash-utility@redhat.com/msg09177.html

Thanks.

Comment 39 errata-xmlrpc 2022-11-08 09:39:43 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (crash bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:7561