tools: add support for cache coloring configuration

Add a new "llc_colors" parameter that defines the LLC color assignment for
a domain. The user can specify one or more color ranges using the same
syntax used everywhere else for color config described in the
documentation.
The parameter is defined as a list of strings that represent the color
ranges.

Documentation is also added.
Golang bindings are regenerated.

Based on original work from: Luca Miccio <lucmiccio@gmail.com>

Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
This commit is contained in:
Carlo Nonato authored and Michal Orzel committed 2024-12-19 19:24:31 +01:00
1 parent 6985aa5e0c
commit 748bd725fb
9 files changed
+127 -1

No files matched your search

+37 -1
View File
@@ -1296,7 +1296,7 @@ void parse_config_data(const char *config_source,
XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids, *vtpms,
*usbctrls, *usbdevs, *p9devs, *vdispls, *pvcallsifs_devs;
XLU_ConfigList *channels, *ioports, *irqs, *iomem, *viridian, *dtdevs,
*mca_caps, *smbios;
*mca_caps, *smbios, *llc_colors;
int num_ioports, num_irqs, num_iomem, num_cpus, num_viridian, num_mca_caps;
int num_smbios;
int pci_power_mgmt = 0;
@@ -1304,6 +1304,7 @@ void parse_config_data(const char *config_source,
int pci_permissive = 0;
int pci_seize = 0;
int i, e;
int num_llc_colors;
char *kernel_basename;
libxl_domain_create_info *c_info = &d_config->c_info;
@@ -1447,6 +1448,41 @@ void parse_config_data(const char *config_source,
if (!xlu_cfg_get_long (config, "maxmem", &l, 0))
b_info->max_memkb = l * 1024;
if (!xlu_cfg_get_list(config, "llc_colors", &llc_colors, &num_llc_colors, 0)) {
int cur_index = 0;
b_info->num_llc_colors = 0;
for (i = 0; i < num_llc_colors; i++) {
uint32_t start = 0, end = 0, k;
buf = xlu_cfg_get_listitem(llc_colors, i);
if (!buf) {
fprintf(stderr,
"xl: Can't get element %d in LLC color list\n", i);
exit(1);
}
if (sscanf(buf, "%" SCNu32 "-%" SCNu32, &start, &end) != 2) {
if (sscanf(buf, "%" SCNu32, &start) != 1) {
fprintf(stderr, "xl: Invalid LLC color range: %s\n", buf);
exit(1);
}
end = start;
} else if (start > end) {
fprintf(stderr,
"xl: Start LLC color is greater than end: %s\n", buf);
exit(1);
}
b_info->num_llc_colors += (end - start) + 1;
b_info->llc_colors = (uint32_t *)realloc(b_info->llc_colors,
sizeof(*b_info->llc_colors) * b_info->num_llc_colors);
for (k = start; k <= end; k++)
b_info->llc_colors[cur_index++] = k;
}
}
if (!xlu_cfg_get_long (config, "vcpus", &l, 0)) {
vcpus = l;
if (libxl_cpu_bitmap_alloc(ctx, &b_info->avail_vcpus, l)) {
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.