Skip to contentSkip to conversation

tools/xl: use libxl_domain_info to get domain type for vcpu-pin

PATCH Superseded Igor Druzhinin 2 participants 2 messages Apr 5, 2019 – Apr 9, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/xl: use libxl_domain_info to get domain type for vcpu-pin

Parsing the config seems to be an overkill for this particular task and the config might simply be absent. Type returned should be either LIBXL_DOMAIN_TYPE_HVM or LIBXL_DOMAIN_TYPE_PV but in that context distinction between PVH and HVM should be irrelevant.

---
 tools/xl/xl_vcpu.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
tools/xl/xl_vcpu.c +4 -9
index 71d3a5c..4a4d0fa 100644
@@ -284,19 +284,14 @@ int main_vcpupin(int argc, char **argv)
 
     /* Only hard affinity matters here */
     if (!ignore_masks) {
-        libxl_domain_config d_config;
+        libxl_dominfo dominfo;
 
-        libxl_domain_config_init(&d_config);
-        rc = libxl_retrieve_domain_configuration(ctx, domid, &d_config);
-        if (rc) {
-            fprintf(stderr, "Could not retrieve domain configuration\n");
-            libxl_domain_config_dispose(&d_config);
+        if (libxl_domain_info(ctx, &dominfo, domid)) {
+            fprintf(stderr, "Could not get domain info\n");
             goto out;
         }
 
-        apply_global_affinity_masks(d_config.b_info.type, hard, 1);
-
-        libxl_domain_config_dispose(&d_config);
+        apply_global_affinity_masks(dominfo.domain_type, hard, 1);
     }
 
     if (force) {
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 4 lines · Igor Druzhinin

Parsing the config seems to be an overkill for this particular task and the config might simply be absent. Type returned should be either LIBXL_DOMAIN_TYPE_HVM or LIBXL_DOMAIN_TYPE_PV but in that context distinction between PVH and HVM should be irrelevant.

Right, this makes sense.

But please make it complete by removing the LIBXL_DOMAIN_TYPE_PVH branch in apply_global_affinity_masks, and add a comment to note that PVH and HVM use the same mask ...

Quoted 11 lines
---
 tools/xl/xl_vcpu.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
tools/xl/xl_vcpu.c +0 -0
index 71d3a5c..4a4d0fa 100644

tools/xl/xl_vcpu.c int main_vcpupin(int argc, char **argv) · line 288

Quoted 6 lines
tools/xl/xl_vcpu.c +1 -1
@@ -284,19 +284,14 @@ int main_vcpupin(int argc, char **argv)
 
     /* Only hard affinity matters here */
     if (!ignore_masks) {
-        libxl_domain_config d_config;
+        libxl_dominfo dominfo;
 

... here.

Quoted 20 lines
tools/xl/xl_vcpu.c +3 -8
-        libxl_domain_config_init(&d_config);
-        rc = libxl_retrieve_domain_configuration(ctx, domid, &d_config);
-        if (rc) {
-            fprintf(stderr, "Could not retrieve domain configuration\n");
-            libxl_domain_config_dispose(&d_config);
+        if (libxl_domain_info(ctx, &dominfo, domid)) {
+            fprintf(stderr, "Could not get domain info\n");
             goto out;
         }
 
-        apply_global_affinity_masks(d_config.b_info.type, hard, 1);
-
-        libxl_domain_config_dispose(&d_config);
+        apply_global_affinity_masks(dominfo.domain_type, hard, 1);
     }
 
     if (force) {
Signature · 1 line
2.7.4

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel