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

Re: [PATCH 1/7] tools: Make some callers of xc_domain_getinfo use xc_domain_getinfolist


  • To: Alejandro Vallejo <alejandro.vallejo@xxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 27 Apr 2023 10:51:03 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Y8B8r2CQO5o0S0w0vbsn0/Lring0Lo106pFhpgXCuls=; b=VTiKV2TElX1rm1AsnIXMo5jBoZMwApvWeuRLHLrjS/oV1WBgt7e663dnKg/5fWDR3y01HqswbKqSz7nh/SnCbu+nHM2f+Ma1KpeGNARLYrZ1IYrh6EGhY4lIlWFBSfjf9Dk2ISQ3kD1q5OfK3qBOip/pw75TTbEwE7HU4UK/REdI26zVnFxBgPkcK5orsvwGi1vlQVZrJ8fiCPjtfquUL4ftOdZKYYFlcNNJucp7AH+yStE+6wCep5RTJ2+TVpZ0YGsJivt9AC+B3txhne7pZg81dgSj7kvp8bymJYswtGWNxnVLdftKlOYCrN4JY0hm22Bd4UY31S+kL2zYp4ZNnw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CefeabRc9C97zlwaQzwagDHtMY6glNHR2NkMwyIs94MWJh0nR7gR49L/muAaIj6IQAUiHIOTb8CVFSQWlYjRaUk4NhXWo2K8D2zmdFj6V8HoLJdWnmRT/qzasau7sMy9auUuXQ8/Dt2YTfp5abiNpVVHxEqc3hPwCQPUKhUg4OORDifLFnjEGsQQNL+SNcOrSdJGP52zvk8ybb2OUDUkerzSO0Z8m3XHoz29CcG6ZqRZ6HoOXFuwWFnDKC4+M5bP9ONDzn8tre5yowGinx9tNbWYfDfPb2Ra54VohPi+0sAW4ViOi6vwO0K3ZKmBX9wClwz/lX9bWrn0qSgtDkrw4A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Thu, 27 Apr 2023 09:51:34 +0000
  • Ironport-data: A9a23:AdxvVK/5q2BHkWSTzLdCDrUDRn+TJUtcMsCJ2f8bNWPcYEJGY0x3z jRKXjqPP/qMYzP2fNonPY3n8RgFu5HQmNI3HVRupC88E34SpcT7XtnIdU2Y0wF+jCHgZBk+s 5hBMImowOQcFCK0SsKFa+C5xZVE/fjUAOG6UKicYXoZqTZMEE8JkQhkl/MynrlmiN24BxLlk d7pqojUNUTNNwRcawr40Ire7kI+1BjOkGlA5AdmOaoU5AW2e0Q9V/rzG4ngdxMUfaEMdgKKb 76r5K20+Grf4yAsBruN+losWhRXKlJ6FVHmZkt+A8BOsDAbzsAB+v9T2M4nQVVWk120c+VZk 72hg3ASpTABZcUgkMxFO/VR/roX0aduoNcrKlDn2SCfItGvn9IBDJyCAWlvVbD09NqbDkl/z tc1MxsjYiy/rKXqmpjnZ8tIodoaeZyD0IM34hmMzBn/JNN/G9XpZfWP4tVVmjAtmspJAPDSI dIDbiZiZwjBZBsJPUoLDJU5n6GjgXyXnz9w8QrJ4/ZopTWOilUuidABM/KMEjCObexTklyVu STt+GPhDwtBHNee1SCE4jSngeqncSbTAdpNSOPhqa466LGV7mghMEUtSnumm/KCuwmiV4JdI RMxwyV7+MDe82TuFLERRSaQqXqJvBcaV8BXVfMz7AWAyK386AKeG2RCRTlEAPQ2uclzSTE02 1uhm9LyGScpoLCTUWia9LqfsXW1Iyd9BXAGTT8JS00C+daLiIM8lBXUVf54DbW4yNbyHFnNL yuiqSE/g/AZi54N3qDip1Tf2Wvz/97OUxI/4RjRUiS99ARlaYW5Zouur1/G8fJHK4XfRV6E1 JQZp/WjACk1JcnlvESwrC8lRdlFO97t3OXgvGNS
  • Ironport-hdrordr: A9a23:7n6X5amXCfZfwHjDW+Lr2xvocYXpDfKd3DAbv31ZSRFFG/Fw9v re58jzsCWetN9/YhwdcK+7Sc29qB/nn6KdmLNhWItKPzOWwFdAUrsM0WKK+VSJJwTE+uRczK dtdLVXBdDqAUJhrM7h4WCDYrAd6eKK+qCwhevY0l9hQBpncbtA4w91Bh3zKDwOeOAhP/QE/f GnivavyQDARV0nKuCAQlQUWODGp9fQ0LjhbBI+DxQk4AeDsj+y8r79FHGjr3UjegIK5Y1n3H jDmwj47L/mk/ag1xfa3WO71eU0pPLRjv94QOGdjcAQKj/3ziKlfp5oVbHHnB1dmoGSARIR4b 7xnys=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Just as a note for the subject, we more commonly write function names
with ()'s.

On 26/04/2023 3:59 pm, Alejandro Vallejo wrote:
> diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
> index 05967ecc92..90b33aa3a7 100644
> --- a/tools/include/xenctrl.h
> +++ b/tools/include/xenctrl.h
> @@ -468,6 +468,11 @@ typedef struct xc_dominfo {
>  
>  typedef xen_domctl_getdomaininfo_t xc_domaininfo_t;
>  
> +static inline unsigned int dominfo_shutdown_reason(const xc_domaininfo_t 
> *info)
> +{
> +    return (info->flags >> XEN_DOMINF_shutdownshift) & 
> XEN_DOMINF_shutdownmask;
> +}
> +
>  typedef union 
>  {
>  #if defined(__i386__) || defined(__x86_64__)
> diff --git a/tools/python/xen/lowlevel/xc/xc.c 
> b/tools/python/xen/lowlevel/xc/xc.c
> index 35901c2d63..38212e8091 100644
> --- a/tools/python/xen/lowlevel/xc/xc.c
> +++ b/tools/python/xen/lowlevel/xc/xc.c
> @@ -368,21 +368,22 @@ static PyObject *pyxc_domain_getinfo(XcObject *self,
>          info_dict = Py_BuildValue(
>              "{s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i"
>              ",s:L,s:L,s:L,s:i,s:i,s:i}",
> -            "domid",           (int)info[i].domid,
> +            "domid",           (int)info[i].domain,
>              "online_vcpus",    info[i].nr_online_vcpus,
>              "max_vcpu_id",     info[i].max_vcpu_id,
> -            "hvm",             info[i].hvm,
> -            "dying",           info[i].dying,
> -            "crashed",         info[i].crashed,
> -            "shutdown",        info[i].shutdown,
> -            "paused",          info[i].paused,
> -            "blocked",         info[i].blocked,
> -            "running",         info[i].running,
> -            "mem_kb",          (long 
> long)info[i].nr_pages*(XC_PAGE_SIZE/1024),
> +            "hvm",             !!(info[i].flags & XEN_DOMINF_hvm_guest),
> +            "dying",           !!(info[i].flags & XEN_DOMINF_dying),
> +            "crashed",         (info[i].flags & XEN_DOMINF_shutdown) &&
> +                                 (dominfo_shutdown_reason(&info[i]) == 
> SHUTDOWN_crash),

Isn't this your dominfo_shutdown_with() from patch 6 ?

I'd pull that forward to this patch too, and use it here.

> +            "shutdown",        !!(info[i].flags & XEN_DOMINF_shutdown),
> +            "paused",          !!(info[i].flags & XEN_DOMINF_paused),
> +            "blocked",         !!(info[i].flags & XEN_DOMINF_blocked),
> +            "running",         !!(info[i].flags & XEN_DOMINF_running),
> +            "mem_kb",          (long 
> long)info[i].tot_pages*(XC_PAGE_SIZE/1024),
>              "cpu_time",        (long long)info[i].cpu_time,
> -            "maxmem_kb",       (long long)info[i].max_memkb,
> +            "maxmem_kb",       (long long)(info[i].max_pages << 
> (XC_PAGE_SHIFT - 10)),
>              "ssidref",         (int)info[i].ssidref,
> -            "shutdown_reason", info[i].shutdown_reason,
> +            "shutdown_reason", dominfo_shutdown_reason(&info[i]),
>              "cpupool",         (int)info[i].cpupool);
>          pyhandle = PyList_New(sizeof(xen_domain_handle_t));
>          if ( (pyhandle == NULL) || (info_dict == NULL) )
> diff --git a/tools/xenmon/xenbaked.c b/tools/xenmon/xenbaked.c
> index 4dddbd20e2..8632b10ea4 100644
> --- a/tools/xenmon/xenbaked.c
> +++ b/tools/xenmon/xenbaked.c
> @@ -775,7 +775,7 @@ static void global_init_domain(int domid, int idx)
>  static int indexof(int domid)
>  {
>      int idx;
> -    xc_dominfo_t dominfo[NDOMAINS];
> +    xc_domaininfo_t dominfo[NDOMAINS];
>      xc_interface *xc_handle;
>      int ndomains;
>    
> @@ -797,7 +797,7 @@ static int indexof(int domid)
>  
>      // call domaininfo hypercall to try and garbage collect unused entries
>      xc_handle = xc_interface_open(0,0,0);
> -    ndomains = xc_domain_getinfo(xc_handle, 0, NDOMAINS, dominfo);
> +    ndomains = xc_domain_getinfolist(xc_handle, 0, NDOMAINS, dominfo);
>      xc_interface_close(xc_handle);

Not to do with your patch, but this is logic is mad.  xenbaked open and
closes a xenctrl handle every time its set of domids changes.

I'm very seriously tempted to delete all of tools/xenmon because it
shows no signs of being in use, and right now all it does is spit out an
unending stream of

gotten<100ns in qos_switchout(domid=32767)
gotten<100ns in qos_switchout(domid=0)

to stdout, which is antisocial for something calling itself a daemon.

~Andrew



 


Rackspace

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