Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/814874/?format=api
{ "id": 814874, "url": "http://patchwork.ozlabs.org/api/patches/814874/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170918101709.30421-14-aik@ozlabs.ru/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170918101709.30421-14-aik@ozlabs.ru>", "list_archive_url": null, "date": "2017-09-18T10:17:09", "name": "[qemu,v3,13/13] memory: Add flat views to HMP \"info mtree\"", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "fbf3d08eb6442719fed99f8be81c0749ba77a776", "submitter": { "id": 7621, "url": "http://patchwork.ozlabs.org/api/people/7621/?format=api", "name": "Alexey Kardashevskiy", "email": "aik@ozlabs.ru" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170918101709.30421-14-aik@ozlabs.ru/mbox/", "series": [ { "id": 3617, "url": "http://patchwork.ozlabs.org/api/series/3617/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=3617", "date": "2017-09-18T10:16:57", "name": "memory: Reduce memory use", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/3617/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/814874/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/814874/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xwhtS5cXGz9s78\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 18 Sep 2017 20:23:44 +1000 (AEST)", "from localhost ([::1]:35614 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dttDK-0002HL-Pw\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 06:23:42 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:42092)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <aik@ozlabs.ru>) id 1dtt7P-0005pV-Mm\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 06:17:39 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <aik@ozlabs.ru>) id 1dtt7N-0004Hz-2F\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 06:17:35 -0400", "from ozlabs.ru ([107.173.13.209]:35254)\n\tby eggs.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <aik@ozlabs.ru>) id 1dtt7M-0004Dh-PJ\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 06:17:32 -0400", "from vpl1.ozlabs.ibm.com (localhost [IPv6:::1])\n\tby ozlabs.ru (Postfix) with ESMTP id 64CCE3A60055;\n\tMon, 18 Sep 2017 06:18:47 -0400 (EDT)" ], "From": "Alexey Kardashevskiy <aik@ozlabs.ru>", "To": "qemu-devel@nongnu.org", "Date": "Mon, 18 Sep 2017 20:17:09 +1000", "Message-Id": "<20170918101709.30421-14-aik@ozlabs.ru>", "X-Mailer": "git-send-email 2.11.0", "In-Reply-To": "<20170918101709.30421-1-aik@ozlabs.ru>", "References": "<20170918101709.30421-1-aik@ozlabs.ru>", "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 3.x [fuzzy]", "X-Received-From": "107.173.13.209", "Subject": "[Qemu-devel] [PATCH qemu v3 13/13] memory: Add flat views to HMP\n\t\"info mtree\"", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.21", "Precedence": "list", "List-Id": "<qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Cc": "Alexey Kardashevskiy <aik@ozlabs.ru>, Paolo Bonzini <pbonzini@redhat.com>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>" }, "content": "This adds a new switch to \"info mtree\" to print dispatch tree internals.\n\nSigned-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>\n---\nChanges:\nv3:\n* reimplemented as there is no more global FlatView list\n\n---\n\nExample:\n\naik@fstn1-p1:~$ echo \"info mtree -f -d\" | nc localhost 30000\nQEMU 2.10.50 monitor - type 'help' for more information\n(qemu) info mtree -f -d\nFlatView #0\n AS \"nec-usb-xhci\", root: bus master container\n Root memory region: bus master container\n 0000000000000000-000000003fffffff (prio 0, i/o): tce-iommu-80000000\n 0000040000000000-000004000000ffff (prio 0, i/o): msi\n Dispatch\n Physical sections\n #0 @0000000000000000..ffffffffffffffff (noname) [unassigned]\n #1 @0000000000000000..ffffffffffffffff (noname) [not dirty]\n #2 @0000000000000000..ffffffffffffffff (noname) [ROM]\n #3 @0000000000000000..ffffffffffffffff (noname) [watch]\n #4 @0000000000000000..000000003fffffff tce-iommu-80000000 [iommu]\n #5 @0000040000000000..000004000000ffff msi\n Nodes (9 bits per level, 6 levels) ptr=[2] skip=3\n [0]\n\t 0 skip=2 ptr=[2]\n\t 1..511 skip=1 ptr=NIL\n [1]\n\t 0 skip=1 ptr=[2]\n\t 1..511 skip=1 ptr=NIL\n [2]\n\t 0 skip=0 ptr=#4\n\t 1..7 skip=1 ptr=NIL\n\t 8 skip=3 ptr=[6]\n\t 9..511 skip=1 ptr=NIL\n [3]\n\t 0 skip=0 ptr=#4\n\t 1..511 skip=1 ptr=NIL\n [4]\n\t 0 skip=2 ptr=[6]\n\t 1..511 skip=1 ptr=NIL\n [5]\n\t 0 skip=1 ptr=[6]\n\t 1..511 skip=1 ptr=NIL\n [6]\n\t 0..15 skip=0 ptr=#5\n\t 16..511 skip=0 ptr=#0\n\nFlatView #1\n AS \"vfio-pci\", root: bus master container\n Root memory region: bus master container\n 0000000000000000-000000003fffffff (prio 0, i/o): tce-iommu-80000000\n 0000040000000000-000004000000ffff (prio 0, i/o): msi\n Dispatch\n Physical sections\n #0 @0000000000000000..ffffffffffffffff (noname) [unassigned]\n #1 @0000000000000000..ffffffffffffffff (noname) [not dirty]\n #2 @0000000000000000..ffffffffffffffff (noname) [ROM]\n #3 @0000000000000000..ffffffffffffffff (noname) [watch]\n #4 @0000000000000000..000000003fffffff tce-iommu-80000000 [iommu]\n #5 @0000040000000000..000004000000ffff msi\n Nodes (9 bits per level, 6 levels) ptr=[2] skip=3\n [0]\n\t 0 skip=2 ptr=[2]\n\t 1..511 skip=1 ptr=NIL\n [1]\n\t 0 skip=1 ptr=[2]\n\t 1..511 skip=1 ptr=NIL\n [2]\n\t 0 skip=0 ptr=#4\n\t 1..7 skip=1 ptr=NIL\n\t 8 skip=3 ptr=[6]\n\t 9..511 skip=1 ptr=NIL\n [3]\n\t 0 skip=0 ptr=#4\n\t 1..511 skip=1 ptr=NIL\n [4]\n\t 0 skip=2 ptr=[6]\n\t 1..511 skip=1 ptr=NIL\n [5]\n\t 0 skip=1 ptr=[6]\n\t 1..511 skip=1 ptr=NIL\n [6]\n\t 0..15 skip=0 ptr=#5\n\t 16..511 skip=0 ptr=#0\n\nFlatView #2\n AS \"pci@800000020000000\", root: pci@800000020000000.iommu-root\n Root memory region: pci@800000020000000.iommu-root\n 0000000000000000-000000003fffffff (prio 0, i/o): tce-iommu-80000000\n 0000040000000000-000004000000ffff (prio 0, i/o): msi\n Dispatch\n Physical sections\n #0 @0000000000000000..ffffffffffffffff (noname) [unassigned]\n #1 @0000000000000000..ffffffffffffffff (noname) [not dirty]\n #2 @0000000000000000..ffffffffffffffff (noname) [ROM]\n #3 @0000000000000000..ffffffffffffffff (noname) [watch]\n #4 @0000000000000000..000000003fffffff tce-iommu-80000000 [iommu]\n #5 @0000040000000000..000004000000ffff msi\n Nodes (9 bits per level, 6 levels) ptr=[2] skip=3\n [0]\n\t 0 skip=2 ptr=[2]\n\t 1..511 skip=1 ptr=NIL\n [1]\n\t 0 skip=1 ptr=[2]\n\t 1..511 skip=1 ptr=NIL\n [2]\n\t 0 skip=0 ptr=#4\n\t 1..7 skip=1 ptr=NIL\n\t 8 skip=3 ptr=[6]\n\t 9..511 skip=1 ptr=NIL\n [3]\n\t 0 skip=0 ptr=#4\n\t 1..511 skip=1 ptr=NIL\n [4]\n\t 0 skip=2 ptr=[6]\n\t 1..511 skip=1 ptr=NIL\n [5]\n\t 0 skip=1 ptr=[6]\n\t 1..511 skip=1 ptr=NIL\n [6]\n\t 0..15 skip=0 ptr=#5\n\t 16..511 skip=0 ptr=#0\n\nFlatView #3\n AS \"memory\", root: system\n AS \"cpu-memory\", root: system\n AS \"cpu-memory\", root: system\n AS \"cpu-memory\", root: system\n AS \"cpu-memory\", root: system\n AS \"cpu-memory\", root: system\n AS \"cpu-memory\", root: system\n AS \"cpu-memory\", root: system\n AS \"cpu-memory\", root: system\n Root memory region: system\n 0000000000000000-000000007fffffff (prio 0, ram): ppc_spapr.ram\n 0000200000000020-000020000000003f (prio 1, i/o): virtio-pci\n 0000200080000000-000020008000003f (prio 0, i/o): capabilities\n 0000200080000040-000020008000043f (prio 0, i/o): operational\n 0000200080000440-000020008000044f (prio 0, i/o): usb3 port #1\n 0000200080000450-000020008000045f (prio 0, i/o): usb3 port #2\n 0000200080000460-000020008000046f (prio 0, i/o): usb3 port #3\n 0000200080000470-000020008000047f (prio 0, i/o): usb3 port #4\n 0000200080000480-000020008000048f (prio 0, i/o): usb2 port #1\n 0000200080000490-000020008000049f (prio 0, i/o): usb2 port #2\n 00002000800004a0-00002000800004af (prio 0, i/o): usb2 port #3\n 00002000800004b0-00002000800004bf (prio 0, i/o): usb2 port #4\n 0000200080001000-000020008000121f (prio 0, i/o): runtime\n 0000200080002000-000020008000281f (prio 0, i/o): doorbell\n 0000200080003000-00002000800030ff (prio 0, i/o): msix-table\n 0000200080003800-0000200080003807 (prio 0, i/o): msix-pba\n 0000200080010000-000020008001ffff (prio 0, ramd): 0021:09:00.0 BAR 0 mmaps[0]\n 0000200080020000-000020008002007f (prio 0, i/o): msix-table\n 0000200080020080-0000200080021fff (prio 1, i/o): 0021:09:00.0 BAR 2 @0000000000000080\n 0000200080030000-000020008003002f (prio 0, i/o): msix-table\n 0000200080030800-0000200080030807 (prio 0, i/o): msix-pba\n 0000210000000000-0000210000000fff (prio 0, i/o): virtio-pci-common\n 0000210000001000-0000210000001fff (prio 0, i/o): virtio-pci-isr\n 0000210000002000-0000210000002fff (prio 0, i/o): virtio-pci-device\n 0000210000003000-0000210000003fff (prio 0, i/o): virtio-pci-notify\n Dispatch\n Physical sections\n #0 @0000000000000000..ffffffffffffffff (noname) [unassigned]\n #1 @0000000000000000..ffffffffffffffff (noname) [not dirty]\n #2 @0000000000000000..ffffffffffffffff (noname) [ROM]\n #3 @0000000000000000..ffffffffffffffff (noname) [watch]\n #4 @0000000000000000..000000007fffffff ppc_spapr.ram [MRU]\n #5 @0000200000000000..0000200000000fff (noname)\n #6 @0000200000000020..000020000000003f virtio-pci\n #7 @0000200080000000..0000200080000fff (noname)\n #8 @0000200080000000..000020008000003f capabilities\n #9 @0000200080000040..000020008000043f operational\n #10 @0000200080000440..000020008000044f usb3 port #1\n #11 @0000200080000450..000020008000045f usb3 port #2\n #12 @0000200080000460..000020008000046f usb3 port #3\n #13 @0000200080000470..000020008000047f usb3 port #4\n #14 @0000200080000480..000020008000048f usb2 port #1\n #15 @0000200080000490..000020008000049f usb2 port #2\n #16 @00002000800004a0..00002000800004af usb2 port #3\n #17 @00002000800004b0..00002000800004bf usb2 port #4\n #18 @0000200080001000..0000200080001fff (noname)\n #19 @0000200080001000..000020008000121f runtime\n #20 @0000200080002000..0000200080002fff (noname)\n #21 @0000200080002000..000020008000281f doorbell\n #22 @0000200080003000..0000200080003fff (noname)\n #23 @0000200080003000..00002000800030ff msix-table\n #24 @0000200080003800..0000200080003807 msix-pba\n #25 @0000200080010000..000020008001ffff 0021:09:00.0 BAR 0 mmaps[0]\n #26 @0000200080020000..0000200080020fff (noname)\n #27 @0000200080020000..000020008002007f msix-table\n #28 @0000200080020080..000020008002207f 0021:09:00.0 BAR 2\n #29 @0000200080021000..0000200080022fff 0021:09:00.0 BAR 2\n #30 @0000200080030000..0000200080030fff (noname)\n #31 @0000200080030000..000020008003002f msix-table\n #32 @0000200080030800..0000200080030807 msix-pba\n #33 @0000210000000000..0000210000000fff virtio-pci-common\n #34 @0000210000001000..0000210000001fff virtio-pci-isr\n #35 @0000210000002000..0000210000002fff virtio-pci-device\n #36 @0000210000003000..0000210000003fff virtio-pci-notify\n Nodes (9 bits per level, 6 levels) ptr=[2] skip=3\n [0]\n\t 0 skip=2 ptr=[2]\n\t 1..511 skip=1 ptr=NIL\n [1]\n\t 0 skip=1 ptr=[2]\n\t 1..511 skip=1 ptr=NIL\n [2]\n\t 0 skip=1 ptr=[3]\n\t 1..63 skip=1 ptr=NIL\n\t 64 skip=1 ptr=[4]\n\t 65 skip=1 ptr=NIL\n\t 66 skip=3 ptr=[11]\n\t 67..511 skip=1 ptr=NIL\n [3]\n\t 0..1 skip=0 ptr=#4\n\t 2..511 skip=1 ptr=NIL\n [4]\n\t 0 skip=2 ptr=[6]\n\t 1 skip=1 ptr=NIL\n\t 2 skip=2 ptr=[8]\n\t 3..511 skip=1 ptr=NIL\n [5]\n\t 0 skip=1 ptr=[6]\n\t 1..511 skip=1 ptr=NIL\n [6]\n\t 0 skip=0 ptr=#5\n\t 1..511 skip=0 ptr=#0\n [7]\n\t 0 skip=1 ptr=[8]\n\t 1..511 skip=1 ptr=NIL\n [8]\n\t 0 skip=0 ptr=#7\n\t 1 skip=0 ptr=#18\n\t 2 skip=0 ptr=#20\n\t 3 skip=0 ptr=#22\n\t 4..15 skip=0 ptr=#0\n\t 16..31 skip=0 ptr=#25\n\t 32 skip=0 ptr=#26\n\t 33 skip=0 ptr=#29\n\t 34..47 skip=0 ptr=#0\n\t 48 skip=0 ptr=#30\n\t 49..511 skip=0 ptr=#0\n [9]\n\t 0 skip=2 ptr=[11]\n\t 1..511 skip=1 ptr=NIL\n [10]\n\t 0 skip=1 ptr=[11]\n\t 1..511 skip=1 ptr=NIL\n [11]\n\t 0 skip=0 ptr=#33\n\t 1 skip=0 ptr=#34\n\t 2 skip=0 ptr=#35\n\t 3 skip=0 ptr=#36\n\t 4..511 skip=0 ptr=#0\n\nFlatView #4\n AS \"virtio-net-pci\", root: bus master container\n Root memory region: bus master container\n 0000000000000000-000000003fffffff (prio 0, i/o): tce-iommu-80000000\n 0000040000000000-000004000000ffff (prio 0, i/o): msi\n Dispatch\n Physical sections\n #0 @0000000000000000..ffffffffffffffff (noname) [unassigned]\n #1 @0000000000000000..ffffffffffffffff (noname) [not dirty]\n #2 @0000000000000000..ffffffffffffffff (noname) [ROM]\n #3 @0000000000000000..ffffffffffffffff (noname) [watch]\n #4 @0000000000000000..000000003fffffff tce-iommu-80000000 [iommu]\n #5 @0000040000000000..000004000000ffff msi\n Nodes (9 bits per level, 6 levels) ptr=[2] skip=3\n [0]\n\t 0 skip=2 ptr=[2]\n\t 1..511 skip=1 ptr=NIL\n [1]\n\t 0 skip=1 ptr=[2]\n\t 1..511 skip=1 ptr=NIL\n [2]\n\t 0 skip=0 ptr=#4\n\t 1..7 skip=1 ptr=NIL\n\t 8 skip=3 ptr=[6]\n\t 9..511 skip=1 ptr=NIL\n [3]\n\t 0 skip=0 ptr=#4\n\t 1..511 skip=1 ptr=NIL\n [4]\n\t 0 skip=2 ptr=[6]\n\t 1..511 skip=1 ptr=NIL\n [5]\n\t 0 skip=1 ptr=[6]\n\t 1..511 skip=1 ptr=NIL\n [6]\n\t 0..15 skip=0 ptr=#5\n\t 16..511 skip=0 ptr=#0\n\nFlatView #5\n AS \"I/O\", root: io\n Root memory region: io\n 0000000000000000-000000000000ffff (prio 0, i/o): io\n Dispatch\n Physical sections\n #0 @0000000000000000..ffffffffffffffff (noname) [unassigned]\n #1 @0000000000000000..ffffffffffffffff (noname) [not dirty]\n #2 @0000000000000000..ffffffffffffffff (noname) [ROM]\n #3 @0000000000000000..ffffffffffffffff (noname) [watch]\n #4 @0000000000000000..000000000000ffff io [ROOT]\n Nodes (9 bits per level, 6 levels) ptr=[5] skip=6\n [0]\n\t 0 skip=5 ptr=[5]\n\t 1..511 skip=1 ptr=NIL\n [1]\n\t 0 skip=4 ptr=[5]\n\t 1..511 skip=1 ptr=NIL\n [2]\n\t 0 skip=3 ptr=[5]\n\t 1..511 skip=1 ptr=NIL\n [3]\n\t 0 skip=2 ptr=[5]\n\t 1..511 skip=1 ptr=NIL\n [4]\n\t 0 skip=1 ptr=[5]\n\t 1..511 skip=1 ptr=NIL\n [5]\n\t 0..15 skip=0 ptr=#4\n\t 16..511 skip=0 ptr=#0\n\nFlatView #6\n AS \"virtio-pci-cfg-as\", root: virtio-pci-cfg, alias virtio-pci\n Root memory region: virtio-pci\n 0000210000000000-0000210000000fff (prio 0, i/o): virtio-pci-common\n 0000210000001000-0000210000001fff (prio 0, i/o): virtio-pci-isr\n 0000210000002000-0000210000002fff (prio 0, i/o): virtio-pci-device\n 0000210000003000-0000210000003fff (prio 0, i/o): virtio-pci-notify\n Dispatch\n Physical sections\n #0 @0000000000000000..ffffffffffffffff (noname) [unassigned]\n #1 @0000000000000000..ffffffffffffffff (noname) [not dirty]\n #2 @0000000000000000..ffffffffffffffff (noname) [ROM]\n #3 @0000000000000000..ffffffffffffffff (noname) [watch]\n #4 @0000210000000000..0000210000000fff virtio-pci-common\n #5 @0000210000001000..0000210000001fff virtio-pci-isr\n #6 @0000210000002000..0000210000002fff virtio-pci-device\n #7 @0000210000003000..0000210000003fff virtio-pci-notify\n Nodes (9 bits per level, 6 levels) ptr=[5] skip=6\n [0]\n\t 0 skip=5 ptr=[5]\n\t 1..511 skip=1 ptr=NIL\n [1]\n\t 0 skip=4 ptr=[5]\n\t 1..511 skip=1 ptr=NIL\n [2]\n\t 0..65 skip=1 ptr=NIL\n\t 66 skip=3 ptr=[5]\n\t 67..511 skip=1 ptr=NIL\n [3]\n\t 0 skip=2 ptr=[5]\n\t 1..511 skip=1 ptr=NIL\n [4]\n\t 0 skip=1 ptr=[5]\n\t 1..511 skip=1 ptr=NIL\n [5]\n\t 0 skip=0 ptr=#4\n\t 1 skip=0 ptr=#5\n\t 2 skip=0 ptr=#6\n\t 3 skip=0 ptr=#7\n\t 4..511 skip=0 ptr=#0\n---\n include/exec/memory-internal.h | 4 ++\n include/exec/memory.h | 3 +-\n exec.c | 84 +++++++++++++++++++++++++++++++++++++++\n memory.c | 90 +++++++++++++++++++++++++++++++++++++-----\n monitor.c | 3 +-\n hmp-commands-info.hx | 7 ++--\n 6 files changed, 176 insertions(+), 15 deletions(-)", "diff": "diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h\nindex d4a35c6e96..647e9bd5c4 100644\n--- a/include/exec/memory-internal.h\n+++ b/include/exec/memory-internal.h\n@@ -35,5 +35,9 @@ AddressSpaceDispatch *address_space_to_dispatch(AddressSpace *as);\n AddressSpaceDispatch *flatview_to_dispatch(FlatView *fv);\n void address_space_dispatch_free(AddressSpaceDispatch *d);\n \n+void mtree_print_dispatch(fprintf_function mon, void *f,\n+ struct AddressSpaceDispatch *d,\n+ MemoryRegion *root);\n+\n #endif\n #endif\ndiff --git a/include/exec/memory.h b/include/exec/memory.h\nindex d73430b543..402824c6f2 100644\n--- a/include/exec/memory.h\n+++ b/include/exec/memory.h\n@@ -1513,7 +1513,8 @@ void memory_global_dirty_log_start(void);\n */\n void memory_global_dirty_log_stop(void);\n \n-void mtree_info(fprintf_function mon_printf, void *f, bool flatview);\n+void mtree_info(fprintf_function mon_printf, void *f, bool flatview,\n+ bool dispatch_tree);\n \n /**\n * memory_region_request_mmio_ptr: request a pointer to an mmio\ndiff --git a/exec.c b/exec.c\nindex b1f29d35d8..3110e38565 100644\n--- a/exec.c\n+++ b/exec.c\n@@ -3617,3 +3617,87 @@ void page_size_init(void)\n }\n qemu_host_page_mask = -(intptr_t)qemu_host_page_size;\n }\n+\n+#if !defined(CONFIG_USER_ONLY)\n+\n+static void mtree_print_phys_entries(fprintf_function mon, void *f,\n+ int start, int end, int skip, int ptr)\n+{\n+ if (start == end - 1) {\n+ mon(f, \"\\t%3d \", start);\n+ } else {\n+ mon(f, \"\\t%3d..%-3d \", start, end - 1);\n+ }\n+ mon(f, \" skip=%d \", skip);\n+ if (ptr == PHYS_MAP_NODE_NIL) {\n+ mon(f, \" ptr=NIL\");\n+ } else if (!skip) {\n+ mon(f, \" ptr=#%d\", ptr);\n+ } else {\n+ mon(f, \" ptr=[%d]\", ptr);\n+ }\n+ mon(f, \"\\n\");\n+}\n+\n+#define MR_SIZE(size) (int128_nz(size) ? (hwaddr)int128_get64( \\\n+ int128_sub((size), int128_one())) : 0)\n+\n+void mtree_print_dispatch(fprintf_function mon, void *f,\n+ AddressSpaceDispatch *d, MemoryRegion *root)\n+{\n+ int i;\n+\n+ mon(f, \" Dispatch\\n\");\n+ mon(f, \" Physical sections\\n\");\n+\n+ for (i = 0; i < d->map.sections_nb; ++i) {\n+ MemoryRegionSection *s = d->map.sections + i;\n+ const char *names[] = { \" [unassigned]\", \" [not dirty]\",\n+ \" [ROM]\", \" [watch]\" };\n+\n+ mon(f, \" #%d @\" TARGET_FMT_plx \"..\" TARGET_FMT_plx \" %s%s%s%s%s\",\n+ i,\n+ s->offset_within_address_space,\n+ s->offset_within_address_space + MR_SIZE(s->mr->size),\n+ s->mr->name ? s->mr->name : \"(noname)\",\n+ i < ARRAY_SIZE(names) ? names[i] : \"\",\n+ s->mr == root ? \" [ROOT]\" : \"\",\n+ s == d->mru_section ? \" [MRU]\" : \"\",\n+ s->mr->is_iommu ? \" [iommu]\" : \"\");\n+\n+ if (s->mr->alias) {\n+ mon(f, \" alias=%s\", s->mr->alias->name ?\n+ s->mr->alias->name : \"noname\");\n+ }\n+ mon(f, \"\\n\");\n+ }\n+\n+ mon(f, \" Nodes (%d bits per level, %d levels) ptr=[%d] skip=%d\\n\",\n+ P_L2_BITS, P_L2_LEVELS, d->phys_map.ptr, d->phys_map.skip);\n+ for (i = 0; i < d->map.nodes_nb; ++i) {\n+ int j, jprev;\n+ PhysPageEntry prev;\n+ Node *n = d->map.nodes + i;\n+\n+ mon(f, \" [%d]\\n\", i);\n+\n+ for (j = 0, jprev = 0, prev = *n[0]; j < ARRAY_SIZE(*n); ++j) {\n+ PhysPageEntry *pe = *n + j;\n+\n+ if (pe->ptr == prev.ptr && pe->skip == prev.skip) {\n+ continue;\n+ }\n+\n+ mtree_print_phys_entries(mon, f, jprev, j, prev.skip, prev.ptr);\n+\n+ jprev = j;\n+ prev = *pe;\n+ }\n+\n+ if (jprev != ARRAY_SIZE(*n)) {\n+ mtree_print_phys_entries(mon, f, jprev, j, prev.skip, prev.ptr);\n+ }\n+ }\n+}\n+\n+#endif\ndiff --git a/memory.c b/memory.c\nindex c12507d26d..be08cb3915 100644\n--- a/memory.c\n+++ b/memory.c\n@@ -2854,18 +2854,44 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f,\n }\n }\n \n-static void mtree_print_flatview(fprintf_function p, void *f,\n- AddressSpace *as)\n+struct FlatViewInfo {\n+ fprintf_function mon_printf;\n+ void *f;\n+ int counter;\n+ bool dispatch_tree;\n+};\n+\n+static void mtree_print_flatview(gpointer key, gpointer value,\n+ gpointer user_data)\n {\n- FlatView *view = address_space_get_flatview(as);\n+ FlatView *view = key;\n+ GArray *fv_address_spaces = value;\n+ struct FlatViewInfo *fvi = user_data;\n+ fprintf_function p = fvi->mon_printf;\n+ void *f = fvi->f;\n FlatRange *range = &view->ranges[0];\n MemoryRegion *mr;\n int n = view->nr;\n+ int i;\n+ AddressSpace *as;\n+\n+ p(f, \"FlatView #%d\\n\", fvi->counter);\n+ ++fvi->counter;\n+\n+ for (i = 0; i < fv_address_spaces->len; ++i) {\n+ as = g_array_index(fv_address_spaces, AddressSpace*, i);\n+ p(f, \" AS \\\"%s\\\", root: %s\", as->name, memory_region_name(as->root));\n+ if (as->root->alias) {\n+ p(f, \", alias %s\", memory_region_name(as->root->alias));\n+ }\n+ p(f, \"\\n\");\n+ }\n+\n+ p(f, \" Root memory region: %s\\n\", memory_region_name(view->root));\n \n if (n <= 0) {\n- p(f, MTREE_INDENT \"No rendered FlatView for \"\n- \"address space '%s'\\n\", as->name);\n- flatview_unref(view);\n+ p(f, MTREE_INDENT \"No rendered FlatView, root MR is %s\\n\\n\",\n+ view->root->enabled ? \"enabled\" : \"disabled\");\n return;\n }\n \n@@ -2892,21 +2918,65 @@ static void mtree_print_flatview(fprintf_function p, void *f,\n range++;\n }\n \n+#if !defined(CONFIG_USER_ONLY)\n+ if (fvi->dispatch_tree) {\n+ mtree_print_dispatch(p, f, view->dispatch, view->root);\n+ }\n+#endif\n+\n+ p(f, \"\\n\");\n+}\n+\n+static gboolean mtree_info_flatview_free(gpointer key, gpointer value,\n+ gpointer user_data)\n+{\n+ FlatView *view = key;\n+ GArray *fv_address_spaces = value;\n+\n+ g_array_unref(fv_address_spaces);\n flatview_unref(view);\n+\n+ return true;\n }\n \n-void mtree_info(fprintf_function mon_printf, void *f, bool flatview)\n+void mtree_info(fprintf_function mon_printf, void *f, bool flatview,\n+ bool dispatch_tree)\n {\n MemoryRegionListHead ml_head;\n MemoryRegionList *ml, *ml2;\n AddressSpace *as;\n \n if (flatview) {\n+ FlatView *view;\n+ struct FlatViewInfo fvi = {\n+ .mon_printf = mon_printf,\n+ .f = f,\n+ .counter = 0,\n+ .dispatch_tree = dispatch_tree\n+ };\n+ GArray *fv_address_spaces;\n+ GHashTable *views = g_hash_table_new(g_direct_hash, g_direct_equal);\n+\n+ /* Gather all FVs in one table */\n QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) {\n- mon_printf(f, \"address-space (flat view): %s\\n\", as->name);\n- mtree_print_flatview(mon_printf, f, as);\n- mon_printf(f, \"\\n\");\n+ view = address_space_get_flatview(as);\n+\n+ fv_address_spaces = g_hash_table_lookup(views, view);\n+ if (!fv_address_spaces) {\n+ fv_address_spaces = g_array_new(false, false, sizeof(as));\n+ g_hash_table_insert(views, view, fv_address_spaces);\n+ }\n+\n+ g_array_append_val(fv_address_spaces, as);\n }\n+\n+ /* Print */\n+ g_hash_table_foreach(views, mtree_print_flatview, &fvi);\n+\n+ /* Free */\n+ g_hash_table_foreach_remove(views, mtree_info_flatview_free, 0);\n+ g_hash_table_unref(views);\n+\n return;\n }\n \ndiff --git a/monitor.c b/monitor.c\nindex 058045b3cb..f4856b9268 100644\n--- a/monitor.c\n+++ b/monitor.c\n@@ -1703,8 +1703,9 @@ static void hmp_boot_set(Monitor *mon, const QDict *qdict)\n static void hmp_info_mtree(Monitor *mon, const QDict *qdict)\n {\n bool flatview = qdict_get_try_bool(qdict, \"flatview\", false);\n+ bool dispatch_tree = qdict_get_try_bool(qdict, \"dispatch_tree\", false);\n \n- mtree_info((fprintf_function)monitor_printf, mon, flatview);\n+ mtree_info((fprintf_function)monitor_printf, mon, flatview, dispatch_tree);\n }\n \n static void hmp_info_numa(Monitor *mon, const QDict *qdict)\ndiff --git a/hmp-commands-info.hx b/hmp-commands-info.hx\nindex 1c6772597d..4f1ece93e5 100644\n--- a/hmp-commands-info.hx\n+++ b/hmp-commands-info.hx\n@@ -250,9 +250,10 @@ ETEXI\n \n {\n .name = \"mtree\",\n- .args_type = \"flatview:-f\",\n- .params = \"[-f]\",\n- .help = \"show memory tree (-f: dump flat view for address spaces)\",\n+ .args_type = \"flatview:-f,dispatch_tree:-d\",\n+ .params = \"[-f][-d]\",\n+ .help = \"show memory tree (-f: dump flat view for address spaces;\"\n+ \"-d: dump dispatch tree, valid with -f only)\",\n .cmd = hmp_info_mtree,\n },\n \n", "prefixes": [ "qemu", "v3", "13/13" ] }