xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools/xl: use libxl_domain_info to get domain type for vcpu-pin
@ 2019-04-05 20:51 Igor Druzhinin
  2019-04-05 20:51 ` [Xen-devel] " Igor Druzhinin
  2019-04-09  9:40 ` Wei Liu
  0 siblings, 2 replies; 4+ messages in thread
From: Igor Druzhinin @ 2019-04-05 20:51 UTC (permalink / raw)
  To: xen-devel; +Cc: ian.jackson, wei.liu2, 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.

Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
---
 tools/xl/xl_vcpu.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/tools/xl/xl_vcpu.c b/tools/xl/xl_vcpu.c
index 71d3a5c..4a4d0fa 100644
--- a/tools/xl/xl_vcpu.c
+++ b/tools/xl/xl_vcpu.c
@@ -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) {
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Xen-devel] [PATCH] tools/xl: use libxl_domain_info to get domain type for vcpu-pin
  2019-04-05 20:51 [PATCH] tools/xl: use libxl_domain_info to get domain type for vcpu-pin Igor Druzhinin
@ 2019-04-05 20:51 ` Igor Druzhinin
  2019-04-09  9:40 ` Wei Liu
  1 sibling, 0 replies; 4+ messages in thread
From: Igor Druzhinin @ 2019-04-05 20:51 UTC (permalink / raw)
  To: xen-devel; +Cc: ian.jackson, wei.liu2, 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.

Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
---
 tools/xl/xl_vcpu.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/tools/xl/xl_vcpu.c b/tools/xl/xl_vcpu.c
index 71d3a5c..4a4d0fa 100644
--- a/tools/xl/xl_vcpu.c
+++ b/tools/xl/xl_vcpu.c
@@ -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) {
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] tools/xl: use libxl_domain_info to get domain type for vcpu-pin
  2019-04-05 20:51 [PATCH] tools/xl: use libxl_domain_info to get domain type for vcpu-pin Igor Druzhinin
  2019-04-05 20:51 ` [Xen-devel] " Igor Druzhinin
@ 2019-04-09  9:40 ` Wei Liu
  2019-04-09  9:40   ` [Xen-devel] " Wei Liu
  1 sibling, 1 reply; 4+ messages in thread
From: Wei Liu @ 2019-04-09  9:40 UTC (permalink / raw)
  To: Igor Druzhinin; +Cc: xen-devel, wei.liu2, ian.jackson

On Fri, Apr 05, 2019 at 09:51:48PM +0100, Igor Druzhinin wrote:
> 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 ...

> 
> Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
> ---
>  tools/xl/xl_vcpu.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/tools/xl/xl_vcpu.c b/tools/xl/xl_vcpu.c
> index 71d3a5c..4a4d0fa 100644
> --- a/tools/xl/xl_vcpu.c
> +++ b/tools/xl/xl_vcpu.c
> @@ -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.

> -        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) {
> -- 
> 2.7.4
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xen-devel] [PATCH] tools/xl: use libxl_domain_info to get domain type for vcpu-pin
  2019-04-09  9:40 ` Wei Liu
@ 2019-04-09  9:40   ` Wei Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Wei Liu @ 2019-04-09  9:40 UTC (permalink / raw)
  To: Igor Druzhinin; +Cc: xen-devel, wei.liu2, ian.jackson

On Fri, Apr 05, 2019 at 09:51:48PM +0100, Igor Druzhinin wrote:
> 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 ...

> 
> Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
> ---
>  tools/xl/xl_vcpu.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/tools/xl/xl_vcpu.c b/tools/xl/xl_vcpu.c
> index 71d3a5c..4a4d0fa 100644
> --- a/tools/xl/xl_vcpu.c
> +++ b/tools/xl/xl_vcpu.c
> @@ -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.

> -        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) {
> -- 
> 2.7.4
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-04-09  9:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-05 20:51 [PATCH] tools/xl: use libxl_domain_info to get domain type for vcpu-pin Igor Druzhinin
2019-04-05 20:51 ` [Xen-devel] " Igor Druzhinin
2019-04-09  9:40 ` Wei Liu
2019-04-09  9:40   ` [Xen-devel] " Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).