|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v4 06/11] xen/arm: add support for cache coloring configuration via device-tree
This commit adds the "llc-colors" Device Tree attribute that can be used
for DomUs and Dom0less color configurations. The syntax is the same used
for every color config.
Based on original work from: Luca Miccio <lucmiccio@xxxxxxxxx>
Signed-off-by: Carlo Nonato <carlo.nonato@xxxxxxxxxxxxxxx>
Signed-off-by: Marco Solieri <marco.solieri@xxxxxxxxxxxxxxx>
---
docs/misc/arm/cache-coloring.rst | 43 +++++++++++++++++++++++++
docs/misc/arm/device-tree/booting.txt | 4 +++
xen/arch/arm/domain_build.c | 18 ++++++++++-
xen/arch/arm/include/asm/llc_coloring.h | 3 ++
xen/arch/arm/llc_coloring.c | 10 ++++++
5 files changed, 77 insertions(+), 1 deletion(-)
diff --git a/docs/misc/arm/cache-coloring.rst b/docs/misc/arm/cache-coloring.rst
index c2e0e87426..a28f75dc26 100644
--- a/docs/misc/arm/cache-coloring.rst
+++ b/docs/misc/arm/cache-coloring.rst
@@ -116,6 +116,49 @@ LLC way size (as previously discussed) and Dom0 colors can
be set using the
appropriate command line parameters. See the relevant documentation
in "docs/misc/xen-command-line.pandoc".
+DomUs colors can be set either in the xl configuration file (relative
+documentation at "docs/man/xl.cfg.pod.5.in") or via Device Tree, also for
+Dom0less configurations (relative documentation in
+"docs/misc/arm/device-tree/booting.txt"), as in the following example:
+
+.. raw:: html
+
+ <pre>
+ xen,xen-bootargs = "console=dtuart dtuart=serial0 dom0_mem=1G
dom0_max_vcpus=1 sched=null llc-coloring=on llc-way-size=64K xen-llc-colors=0-1
dom0-llc-colors=2-6";
+ xen,dom0-bootargs "console=hvc0 earlycon=xen earlyprintk=xen
root=/dev/ram0"
+
+ dom0 {
+ compatible = "xen,linux-zimage" "xen,multiboot-module";
+ reg = <0x0 0x1000000 0x0 15858176>;
+ };
+
+ dom0-ramdisk {
+ compatible = "xen,linux-initrd" "xen,multiboot-module";
+ reg = <0x0 0x2000000 0x0 20638062>;
+ };
+
+ domU0 {
+ #address-cells = <0x1>;
+ #size-cells = <0x1>;
+ compatible = "xen,domain";
+ memory = <0x0 0x40000>;
+ llc-colors = "4-8,10,11,12";
+ cpus = <0x1>;
+ vpl011 = <0x1>;
+
+ module@2000000 {
+ compatible = "multiboot,kernel", "multiboot,module";
+ reg = <0x2000000 0xffffff>;
+ bootargs = "console=ttyAMA0";
+ };
+
+ module@30000000 {
+ compatible = "multiboot,ramdisk", "multiboot,module";
+ reg = <0x3000000 0xffffff>;
+ };
+ };
+ </pre>
+
**Note:** If no color configuration is provided for a domain, the default one,
which corresponds to all available colors, is used instead.
diff --git a/docs/misc/arm/device-tree/booting.txt
b/docs/misc/arm/device-tree/booting.txt
index 3879340b5e..ad71c16b00 100644
--- a/docs/misc/arm/device-tree/booting.txt
+++ b/docs/misc/arm/device-tree/booting.txt
@@ -162,6 +162,10 @@ with the following properties:
An integer specifying the number of vcpus to allocate to the guest.
+- llc-colors
+ A string specifying the LLC color configuration for the guest.
+ Refer to "docs/misc/arm/cache_coloring.rst" for syntax.
+
- vpl011
An empty property to enable/disable a virtual pl011 for the guest to
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 093d4ad6f6..2c1307d349 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -3854,6 +3854,8 @@ void __init create_domUs(void)
struct dt_device_node *node;
const struct dt_device_node *cpupool_node,
*chosen = dt_find_node_by_path("/chosen");
+ const char *llc_colors_str;
+ unsigned int *llc_colors = NULL, num_llc_colors = 0;
BUG_ON(chosen == NULL);
dt_for_each_child_node(chosen, node)
@@ -3960,12 +3962,26 @@ void __init create_domUs(void)
d_cfg.max_maptrack_frames = val;
}
+ if ( !dt_property_read_string(node, "llc-colors", &llc_colors_str) )
+ {
+ if ( !llc_coloring_enabled )
+ printk(XENLOG_WARNING
+ "'llc-colors' found, but LLC coloring is disabled\n");
+ else if ( dt_find_property(node, "xen,static-mem", NULL) )
+ panic("static-mem and LLC coloring are incompatible\n");
+ else
+ llc_colors = llc_colors_from_str(llc_colors_str,
+ &num_llc_colors);
+ }
+
/*
* The variable max_init_domid is initialized with zero, so here it's
* very important to use the pre-increment operator to call
* domain_create() with a domid > 0. (domid == 0 is reserved for Dom0)
*/
- d = domain_create(++max_init_domid, &d_cfg, flags);
+ d = domain_create_llc_colored(++max_init_domid, &d_cfg, flags,
+ llc_colors, num_llc_colors);
+
if ( IS_ERR(d) )
panic("Error creating domain %s\n", dt_node_name(node));
diff --git a/xen/arch/arm/include/asm/llc_coloring.h
b/xen/arch/arm/include/asm/llc_coloring.h
index 382ff7de47..7a01b8841c 100644
--- a/xen/arch/arm/include/asm/llc_coloring.h
+++ b/xen/arch/arm/include/asm/llc_coloring.h
@@ -18,12 +18,15 @@
bool __init llc_coloring_init(void);
unsigned int *dom0_llc_colors(unsigned int *num_colors);
+unsigned int *llc_colors_from_str(const char *str, unsigned int *num_colors);
#else /* !CONFIG_LLC_COLORING */
static inline bool __init llc_coloring_init(void) { return true; }
static inline unsigned int *dom0_llc_colors(
unsigned int *num_colors) { return NULL; }
+static inline unsigned int *llc_colors_from_str(
+ const char *str, unsigned int *num_colors) { return NULL; }
#endif /* CONFIG_LLC_COLORING */
diff --git a/xen/arch/arm/llc_coloring.c b/xen/arch/arm/llc_coloring.c
index 2d0457cdbc..ba5279a022 100644
--- a/xen/arch/arm/llc_coloring.c
+++ b/xen/arch/arm/llc_coloring.c
@@ -289,6 +289,16 @@ unsigned int *llc_colors_from_guest(struct
xen_domctl_createdomain *config)
return colors;
}
+unsigned int *llc_colors_from_str(const char *str, unsigned int *num_colors)
+{
+ unsigned int *colors = alloc_colors(nr_colors);
+
+ if ( parse_color_config(str, colors, num_colors) )
+ panic("Error parsing LLC color configuration\n");
+
+ return colors;
+}
+
/*
* Local variables:
* mode: C
--
2.34.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |