All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <JBeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Brian Woods <brian.woods@amd.com>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Subject: [Xen-devel] [PATCH v4 11/12] AMD/IOMMU: don't needlessly log headers when dumping IRTs
Date: Thu, 25 Jul 2019 13:33:24 +0000	[thread overview]
Message-ID: <27308615-9199-2183-d987-180520d8afc3@suse.com> (raw)
In-Reply-To: <b8ae110a-f94a-4ed2-5cf9-c00ff1c0cb81@suse.com>

Log SBDF headers only when there are actual IRTEs to log. This is
particularly important for the total volume of output when the ACPI
tables describe far more than just the existing devices. On my Rome
system so far there was one line for every function of every device on
all 256 buses of segment 0, with extremely few exceptions (like the
IOMMUs themselves).

Also only log one of the "per-device" or "shared" overall headers.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v4: New.

--- a/xen/drivers/passthrough/amd/iommu_intr.c
+++ b/xen/drivers/passthrough/amd/iommu_intr.c
@@ -883,7 +883,8 @@ int __init amd_setup_hpet_msi(struct msi
  }
  
  static void dump_intremap_table(const struct amd_iommu *iommu,
-                                union irte_cptr tbl)
+                                union irte_cptr tbl,
+                                const struct ivrs_mappings *ivrs_mapping)
  {
      unsigned int count;
  
@@ -892,19 +893,25 @@ static void dump_intremap_table(const st
  
      for ( count = 0; count < INTREMAP_ENTRIES; count++ )
      {
-        if ( iommu->ctrl.ga_en )
-        {
-            if ( !tbl.ptr128[count].raw[0] && !tbl.ptr128[count].raw[1] )
+        if ( iommu->ctrl.ga_en
+             ? !tbl.ptr128[count].raw[0] && !tbl.ptr128[count].raw[1]
+             : !tbl.ptr32[count].raw )
                  continue;
+
+        if ( ivrs_mapping )
+        {
+            printk("  %04x:%02x:%02x:%u:\n", iommu->seg,
+                   PCI_BUS(ivrs_mapping->dte_requestor_id),
+                   PCI_SLOT(ivrs_mapping->dte_requestor_id),
+                   PCI_FUNC(ivrs_mapping->dte_requestor_id));
+            ivrs_mapping = NULL;
+        }
+
+        if ( iommu->ctrl.ga_en )
              printk("    IRTE[%03x] %016lx_%016lx\n",
                     count, tbl.ptr128[count].raw[1], tbl.ptr128[count].raw[0]);
-        }
          else
-        {
-            if ( !tbl.ptr32[count].raw )
-                continue;
              printk("    IRTE[%03x] %08x\n", count, tbl.ptr32[count].raw);
-        }
      }
  }
  
@@ -916,13 +923,8 @@ static int dump_intremap_mapping(const s
      if ( !ivrs_mapping )
          return 0;
  
-    printk("  %04x:%02x:%02x:%u:\n", iommu->seg,
-           PCI_BUS(ivrs_mapping->dte_requestor_id),
-           PCI_SLOT(ivrs_mapping->dte_requestor_id),
-           PCI_FUNC(ivrs_mapping->dte_requestor_id));
-
      spin_lock_irqsave(&(ivrs_mapping->intremap_lock), flags);
-    dump_intremap_table(iommu, ivrs_mapping->intremap_table);
+    dump_intremap_table(iommu, ivrs_mapping->intremap_table, ivrs_mapping);
      spin_unlock_irqrestore(&(ivrs_mapping->intremap_lock), flags);
  
      process_pending_softirqs();
@@ -932,17 +934,22 @@ static int dump_intremap_mapping(const s
  
  static void dump_intremap_tables(unsigned char key)
  {
-    unsigned long flags;
-
-    printk("--- Dumping Per-dev IOMMU Interrupt Remapping Table ---\n");
+    if ( !shared_intremap_table )
+    {
+        printk("--- Dumping Per-dev IOMMU Interrupt Remapping Table ---\n");
  
-    iterate_ivrs_entries(dump_intremap_mapping);
+        iterate_ivrs_entries(dump_intremap_mapping);
+    }
+    else
+    {
+        unsigned long flags;
  
-    printk("--- Dumping Shared IOMMU Interrupt Remapping Table ---\n");
+        printk("--- Dumping Shared IOMMU Interrupt Remapping Table ---\n");
  
-    spin_lock_irqsave(&shared_intremap_lock, flags);
-    dump_intremap_table(list_first_entry(&amd_iommu_head, struct amd_iommu,
-                                         list),
-                        shared_intremap_table);
-    spin_unlock_irqrestore(&shared_intremap_lock, flags);
+        spin_lock_irqsave(&shared_intremap_lock, flags);
+        dump_intremap_table(list_first_entry(&amd_iommu_head, struct amd_iommu,
+                                             list),
+                            shared_intremap_table, NULL);
+        spin_unlock_irqrestore(&shared_intremap_lock, flags);
+    }
  }

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-07-25 13:36 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-25 13:19 [Xen-devel] [PATCH v4 00/12] x86: AMD x2APIC support / AMD IOMMU improvements Jan Beulich
2019-07-25 13:29 ` [Xen-devel] [PATCH v4 01/12] AMD/IOMMU: use bit field for extended feature register Jan Beulich
2019-07-30  9:14   ` [Xen-devel] Ping: " Jan Beulich
2019-07-30 16:35   ` [Xen-devel] " Woods, Brian
2019-07-25 13:29 ` [Xen-devel] [PATCH v4 02/12] AMD/IOMMU: use bit field for control register Jan Beulich
2019-07-25 13:30 ` [Xen-devel] [PATCH v4 03/12] AMD/IOMMU: use bit field for IRTE Jan Beulich
2019-07-25 13:30 ` [Xen-devel] [PATCH v4 04/12] AMD/IOMMU: pass IOMMU to {get, free, update}_intremap_entry() Jan Beulich
2019-07-25 13:31 ` [Xen-devel] [PATCH v4 05/12] AMD/IOMMU: introduce 128-bit IRTE non-guest-APIC IRTE format Jan Beulich
2019-07-30 10:13   ` Andrew Cooper
2019-07-30 16:36   ` Woods, Brian
2019-07-25 13:31 ` [Xen-devel] [PATCH v4 06/12] AMD/IOMMU: split amd_iommu_init_one() Jan Beulich
2019-07-25 13:31 ` [Xen-devel] [PATCH v4 07/12] AMD/IOMMU: allow enabling with IRQ not yet set up Jan Beulich
2019-07-25 13:32 ` [Xen-devel] [PATCH v4 08/12] AMD/IOMMU: adjust setup of internal interrupt for x2APIC mode Jan Beulich
2019-07-25 13:32 ` [Xen-devel] [PATCH v4 09/12] AMD/IOMMU: enable x2APIC mode when available Jan Beulich
2019-07-25 13:33 ` [Xen-devel] [PATCH v4 10/12] AMD/IOMMU: correct IRTE updating Jan Beulich
2019-07-25 14:04   ` Woods, Brian
2019-07-25 13:33 ` Jan Beulich [this message]
2019-07-30 10:25   ` [Xen-devel] [PATCH v4 11/12] AMD/IOMMU: don't needlessly log headers when dumping IRTs Andrew Cooper
2019-07-30 16:36   ` Woods, Brian
2019-07-25 13:33 ` [Xen-devel] [PATCH v4 12/12] AMD/IOMMU: miscellaneous DTE handling adjustments Jan Beulich
2019-07-30 13:42   ` Andrew Cooper
2019-07-30 14:10     ` Jan Beulich
2019-08-06 19:41   ` Woods, Brian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27308615-9199-2183-d987-180520d8afc3@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=brian.woods@amd.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.