[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] tools/libxl: Remove unconditional XEN_DOMCTL_set_llc_colors hypercall



commit 576fca515e2d11645740790d1023ad0d81d6151b
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Thu Jul 24 11:19:23 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Jul 29 17:25:54 2025 +0100

    tools/libxl: Remove unconditional XEN_DOMCTL_set_llc_colors hypercall
    
    Hypercalls are not free; cache colouring is an experimental feature, and
    ignoring an -EOPNOTSUPP is bad form.
    
    Now that Xen has been fixed to initialise colouring information correctly 
for
    domains, xc_domain_set_llc_colors() only needs calling for domains with
    explicit configuration.
    
    Rearrange the logic to avoid the hypercall in the general case, leaving a
    comment explaining why it is performed so early.
    
    Fixes: 748bd725fbec ("tools: add support for cache coloring configuration")
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 tools/libs/light/libxl_create.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index 4301f17f90..4042ae1a89 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -699,19 +699,21 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config 
*d_config,
             /* A new domain now exists */
             *domid = local_domid;
 
-            ret = xc_domain_set_llc_colors(ctx->xch, local_domid,
-                                           b_info->llc_colors,
-                                           b_info->num_llc_colors);
-            if (ret < 0) {
-                if (errno == EOPNOTSUPP) {
-                    if (b_info->num_llc_colors > 0) {
+            /*
+             * If Cache Coloring is wanted for the guest, it must be
+             * communicated to Xen prior to allocating guest memory.
+             */
+            if (b_info->num_llc_colors) {
+                ret = xc_domain_set_llc_colors(ctx->xch, local_domid,
+                                               b_info->llc_colors,
+                                               b_info->num_llc_colors);
+                if (ret < 0) {
+                    if (errno == EOPNOTSUPP) {
                         LOGED(ERROR, local_domid,
-                            "LLC coloring not enabled in the hypervisor");
-                        rc = ERROR_FAIL;
-                        goto out;
+                              "LLC coloring not enabled in the hypervisor");
+                    } else {
+                        LOGED(ERROR, local_domid, "LLC colors allocation 
failed");
                     }
-                } else {
-                    LOGED(ERROR, local_domid, "LLC colors allocation failed");
                     rc = ERROR_FAIL;
                     goto out;
                 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.