VT-d: make print_vtd_entries() less verbose
PATCH 1/1 VT-d: make print_vtd_entries() less verbose
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.
---
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.
xen/drivers/passthrough/vtd/utils.c +9 -14
@@ -95,8 +95,8 @@ void print_vtd_entries(struct iommu *iomu64 *l, val;u32 l_index, level; -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);if ( iommu->root_maddr ==0 )
@@ -112,12 +112,11 @@ void print_vtd_entries(struct iommu *iomreturn ; } -printk (" root_entry = %p\n" , root_entry); -printk (" root_entry[%x] = %" PRIx64"\n" , bus, root_entry[bus].val); +printk (" root_entry[%02x] = %" PRIx64"\n" , bus, root_entry[bus].val);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 ; }
@@ -130,14 +129,13 @@ void print_vtd_entries(struct iommu *iomreturn ; } -printk (" context = %p\n" , ctxt_entry); val = ctxt_entry[devfn].lo; -printk (" context[%x] = %" PRIx64"_%" PRIx64"\n" , +printk (" context[%02x] = %" 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 ; }
@@ -153,22 +151,19 @@ void print_vtd_entries(struct iommu *iom do { l = map_vtd_domain_page(val); - printk(" l%d = %p\n", level, l); if ( l == NULL ) { - printk(" l%d == NULL\n", level); + printk(" l%u == NULL\n", level); break; } l_index = get_level_index(gmfn, level); - printk(" l%d_index = %x\n", level, l_index); - pte.val = l[l_index]; unmap_vtd_domain_page(l); - printk(" l%d[%x] = %"PRIx64"\n", level, l_index, pte.val); + printk(" l%u[%03x] = %"PRIx64"\n", level, l_index, pte.val); 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) )
VT-d: make print_vtd_entries() less verbose
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.
---
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.
xen/drivers/passthrough/vtd/utils.c +9 -14
@@ -95,8 +95,8 @@ void print_vtd_entries(struct iommu *iomu64 *l, val;u32 l_index, level; -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);if ( iommu->root_maddr ==0 )
@@ -112,12 +112,11 @@ void print_vtd_entries(struct iommu *iomreturn ; } -printk (" root_entry = %p\n" , root_entry); -printk (" root_entry[%x] = %" PRIx64"\n" , bus, root_entry[bus].val); +printk (" root_entry[%02x] = %" PRIx64"\n" , bus, root_entry[bus].val);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 ; }
@@ -130,14 +129,13 @@ void print_vtd_entries(struct iommu *iomreturn ; } -printk (" context = %p\n" , ctxt_entry); val = ctxt_entry[devfn].lo; -printk (" context[%x] = %" PRIx64"_%" PRIx64"\n" , +printk (" context[%02x] = %" 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 ; }
@@ -153,22 +151,19 @@ void print_vtd_entries(struct iommu *iom do { l = map_vtd_domain_page(val); - printk(" l%d = %p\n", level, l); if ( l == NULL ) { - printk(" l%d == NULL\n", level); + printk(" l%u == NULL\n", level); break; } l_index = get_level_index(gmfn, level); - printk(" l%d_index = %x\n", level, l_index); - pte.val = l[l_index]; unmap_vtd_domain_page(l); - printk(" l%d[%x] = %"PRIx64"\n", level, l_index, pte.val); + printk(" l%u[%03x] = %"PRIx64"\n", level, l_index, pte.val); 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) )
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 9 lines
From: Jan Beulich [mailto:[email protected]]
Sent: Monday, February 06, 2017 8:37 PMEspecially 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.
Quoted 5 lines
Take the opportunity and also
- adjust some format specifiers,
- widen (zero-pad) array indexes to their nominal width.Signed-off-by Jan Beulich <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel