diff mbox series

[v3,3/9] xen/arm: dump cache colors in domain info debug-key

Message ID 20221022155120.7000-4-carlo.nonato@minervasys.tech (mailing list archive)
State New, archived
Headers show
Series Arm cache coloring | expand

Commit Message

Carlo Nonato Oct. 22, 2022, 3:51 p.m. UTC
From: Luca Miccio <lucmiccio@gmail.com>

This commit adds cache colors to the information dumped with the domain
info debug-key.

Signed-off-by: Luca Miccio <lucmiccio@gmail.com>
Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
---
 xen/arch/arm/coloring.c             | 16 ++++++++++++++++
 xen/arch/arm/domain.c               |  2 ++
 xen/arch/arm/include/asm/coloring.h |  2 ++
 3 files changed, 20 insertions(+)
diff mbox series

Patch

diff --git a/xen/arch/arm/coloring.c b/xen/arch/arm/coloring.c
index a7b59f5aba..cf8aa8a2ca 100644
--- a/xen/arch/arm/coloring.c
+++ b/xen/arch/arm/coloring.c
@@ -172,6 +172,16 @@  static unsigned int set_default_domain_colors(unsigned int *colors)
     return max_colors;
 }
 
+static void print_colors(unsigned int *colors, unsigned int num_colors)
+{
+    unsigned int i;
+
+    printk("[ ");
+    for ( i = 0; i < num_colors; i++ )
+        printk("%u ", colors[i]);
+    printk("]\n");
+}
+
 static void dump_coloring_info(unsigned char key)
 {
     printk("'%c' pressed -> dumping coloring general info\n", key);
@@ -289,6 +299,12 @@  void domain_coloring_free(struct domain *d)
         xfree(d->arch.colors);
 }
 
+void domain_dump_coloring_info(struct domain *d)
+{
+    printk("Domain %pd has %u colors: ", d, d->arch.num_colors);
+    print_colors(d->arch.colors, d->arch.num_colors);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index b4dd64dff4..b174a192d4 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -1083,6 +1083,8 @@  int domain_relinquish_resources(struct domain *d)
 void arch_dump_domain_info(struct domain *d)
 {
     p2m_dump_info(d);
+    if ( IS_ENABLED(CONFIG_CACHE_COLORING) )
+        domain_dump_coloring_info(d);
 }
 
 
diff --git a/xen/arch/arm/include/asm/coloring.h b/xen/arch/arm/include/asm/coloring.h
index 0d2dfada10..a16736819e 100644
--- a/xen/arch/arm/include/asm/coloring.h
+++ b/xen/arch/arm/include/asm/coloring.h
@@ -36,6 +36,7 @@  bool __init coloring_init(void);
 int domain_coloring_init(struct domain *d,
                          const struct xen_arch_domainconfig *config);
 void domain_coloring_free(struct domain *d);
+void domain_dump_coloring_info(struct domain *d);
 
 #else /* !CONFIG_CACHE_COLORING */
 
@@ -43,6 +44,7 @@  static inline bool __init coloring_init(void) { return true; }
 static inline int domain_coloring_init(
     struct domain *d, const struct xen_arch_domainconfig *config) { return 0; }
 static inline void domain_coloring_free(struct domain *d) {}
+static inline void domain_dump_coloring_info(struct domain *d) {}
 
 #endif /* CONFIG_CACHE_COLORING */
 #endif /* __ASM_ARM_COLORING_H__ */