From: "Jan Beulich" Subject: [PATCH] VT-d: make print_vtd_entries() less verbose Date: Mon, 06 Feb 2017 05:36:31 -0700 Message-ID: <58987BDF0200007800136E1D@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part1A23D7DF.1__=" Return-path: Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1caiXC-0005Zl-DE for xen-devel@lists.xenproject.org; Mon, 06 Feb 2017 12:36:42 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: xen-devel Cc: Kevin Tian , Feng Wu List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part1A23D7DF.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Especially printing virtual addresses of mappings of the individual pages seems rather useless here - this mostly obfuscates the important numbers, and hinders comparing two printouts. Printing the page table level indexes isn't very useful either, as the immediately following lines will print the indexes again as part of printing the raw entries. Take the opportunity and also - adjust some format specifiers, - widen (zero-pad) array indexes to their nominal width. Signed-off-by: Jan Beulich --- I also wonder whether the three "... not present" messages are really all that useful, especially when an entry is zero - they all follow messages with the respective full entry. --- a/xen/drivers/passthrough/vtd/utils.c +++ b/xen/drivers/passthrough/vtd/utils.c @@ -95,8 +95,8 @@ void print_vtd_entries(struct iommu *iom u64 *l, val; u32 l_index, level; =20 - printk("print_vtd_entries: iommu %p dev %04x:%02x:%02x.%u gmfn = %"PRIx64"\n", - iommu, iommu->intel->drhd->segment, bus, + printk("print_vtd_entries: iommu #%u dev %04x:%02x:%02x.%u gmfn = %"PRI_gfn"\n", + iommu->index, iommu->intel->drhd->segment, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), gmfn); =20 if ( iommu->root_maddr =3D=3D 0 ) @@ -112,12 +112,11 @@ void print_vtd_entries(struct iommu *iom return; } =20 - printk(" root_entry =3D %p\n", root_entry); - printk(" root_entry[%x] =3D %"PRIx64"\n", bus, root_entry[bus].val)= ; + printk(" root_entry[%02x] =3D %"PRIx64"\n", bus, root_entry[bus].va= l); if ( !root_present(root_entry[bus]) ) { unmap_vtd_domain_page(root_entry); - printk(" root_entry[%x] not present\n", bus); + printk(" root_entry[%02x] not present\n", bus); return; } =20 @@ -130,14 +129,13 @@ void print_vtd_entries(struct iommu *iom return; } =20 - printk(" context =3D %p\n", ctxt_entry); val =3D ctxt_entry[devfn].lo; - printk(" context[%x] =3D %"PRIx64"_%"PRIx64"\n", + printk(" context[%02x] =3D %"PRIx64"_%"PRIx64"\n", devfn, ctxt_entry[devfn].hi, val); if ( !context_present(ctxt_entry[devfn]) ) { unmap_vtd_domain_page(ctxt_entry); - printk(" ctxt_entry[%x] not present\n", devfn); + printk(" ctxt_entry[%02x] not present\n", devfn); return; } =20 @@ -153,22 +151,19 @@ void print_vtd_entries(struct iommu *iom do { l =3D map_vtd_domain_page(val); - printk(" l%d =3D %p\n", level, l); if ( l =3D=3D NULL ) { - printk(" l%d =3D=3D NULL\n", level); + printk(" l%u =3D=3D NULL\n", level); break; } l_index =3D get_level_index(gmfn, level); - printk(" l%d_index =3D %x\n", level, l_index); - pte.val =3D l[l_index]; unmap_vtd_domain_page(l); - printk(" l%d[%x] =3D %"PRIx64"\n", level, l_index, pte.val); + printk(" l%u[%03x] =3D %"PRIx64"\n", level, l_index, pte.val); =20 if ( !dma_pte_present(pte) ) { - printk(" l%d[%x] not present\n", level, l_index); + printk(" l%u[%03x] not present\n", level, l_index); break; } if ( dma_pte_superpage(pte) ) --=__Part1A23D7DF.1__= Content-Type: text/plain; name="VT-d-print-abbreviate.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="VT-d-print-abbreviate.patch" VT-d: make print_vtd_entries() less verbose=0A=0AEspecially printing = virtual addresses of mappings of the individual=0Apages seems rather = useless here - this mostly obfuscates the important=0Anumbers, and hinders = comparing two printouts. Printing the page table=0Alevel indexes isn't = very useful either, as the immediately following=0Alines will print the = indexes again as part of printing the raw entries.=0A=0ATake the opportunit= y and also=0A- adjust some format specifiers,=0A- widen (zero-pad) array = indexes to their nominal width.=0A=0ASigned-off-by: Jan Beulich =0A---=0AI also wonder whether the three "... not present" = messages are really=0Aall that useful, especially when an entry is zero - = they all follow=0Amessages with the respective full entry.=0A=0A--- = a/xen/drivers/passthrough/vtd/utils.c=0A+++ b/xen/drivers/passthrough/vtd/u= tils.c=0A@@ -95,8 +95,8 @@ void print_vtd_entries(struct iommu *iom=0A = u64 *l, val;=0A u32 l_index, level;=0A =0A- printk("print_vtd_entrie= s: iommu %p dev %04x:%02x:%02x.%u gmfn %"PRIx64"\n",=0A- iommu, = iommu->intel->drhd->segment, bus,=0A+ printk("print_vtd_entries: iommu = #%u dev %04x:%02x:%02x.%u gmfn %"PRI_gfn"\n",=0A+ iommu->index, = iommu->intel->drhd->segment, bus,=0A PCI_SLOT(devfn), PCI_FUNC(d= evfn), gmfn);=0A =0A if ( iommu->root_maddr =3D=3D 0 )=0A@@ -112,12 = +112,11 @@ void print_vtd_entries(struct iommu *iom=0A return;=0A = }=0A =0A- printk(" root_entry =3D %p\n", root_entry);=0A- = printk(" root_entry[%x] =3D %"PRIx64"\n", bus, root_entry[bus].val);=0A+= printk(" root_entry[%02x] =3D %"PRIx64"\n", bus, root_entry[bus].val= );=0A if ( !root_present(root_entry[bus]) )=0A {=0A = unmap_vtd_domain_page(root_entry);=0A- printk(" root_entry[%x] = not present\n", bus);=0A+ printk(" root_entry[%02x] not = present\n", bus);=0A return;=0A }=0A =0A@@ -130,14 +129,13 @@ = void print_vtd_entries(struct iommu *iom=0A return;=0A }=0A = =0A- printk(" context =3D %p\n", ctxt_entry);=0A val =3D = ctxt_entry[devfn].lo;=0A- printk(" context[%x] =3D %"PRIx64"_%"PRIx64= "\n",=0A+ printk(" context[%02x] =3D %"PRIx64"_%"PRIx64"\n",=0A = devfn, ctxt_entry[devfn].hi, val);=0A if ( !context_present(ctxt_= entry[devfn]) )=0A {=0A unmap_vtd_domain_page(ctxt_entry);=0A- = printk(" ctxt_entry[%x] not present\n", devfn);=0A+ = printk(" ctxt_entry[%02x] not present\n", devfn);=0A return;=0A = }=0A =0A@@ -153,22 +151,19 @@ void print_vtd_entries(struct iommu = *iom=0A do=0A {=0A l =3D map_vtd_domain_page(val);=0A- = printk(" l%d =3D %p\n", level, l);=0A if ( l =3D=3D NULL = )=0A {=0A- printk(" l%d =3D=3D NULL\n", level);=0A+ = printk(" l%u =3D=3D NULL\n", level);=0A break;=0A = }=0A l_index =3D get_level_index(gmfn, level);=0A- = printk(" l%d_index =3D %x\n", level, l_index);=0A-=0A pte.val = =3D l[l_index];=0A unmap_vtd_domain_page(l);=0A- printk(" = l%d[%x] =3D %"PRIx64"\n", level, l_index, pte.val);=0A+ printk(" = l%u[%03x] =3D %"PRIx64"\n", level, l_index, pte.val);=0A =0A if ( = !dma_pte_present(pte) )=0A {=0A- printk(" l%d[%x] = not present\n", level, l_index);=0A+ printk(" l%u[%03x] not = present\n", level, l_index);=0A break;=0A }=0A = if ( dma_pte_superpage(pte) )=0A --=__Part1A23D7DF.1__= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwczovL2xpc3RzLnhlbi5v cmcveGVuLWRldmVsCg== --=__Part1A23D7DF.1__=--