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

Re: [PATCH v2 5/7] tools: Modify single-domid callers of xc_domain_getinfolist()


  • To: Alejandro Vallejo <alejandro.vallejo@xxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Fri, 28 Apr 2023 16:22:23 +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=xSdch7VJ9CsOzzeQi4IbtZS6Bu3WNkTNR1mj+fvzyaQ=; b=AHrhwsQEkO0RR0QL7Nh9cXIyAxaOn7TztT/a0yy6HN61cvOlpgiAI/ndOgZmwuZt6IfCCGon90n0wKbQQjqL2gGMghbdV7+ko+1l3lt+mFyHoE8VLHdmXNwiu9OIH4rfpwdp8bXFo8uHmjGSqd67vRAHZ9jZXEfVxFxes0FmfM4lNxRmIyQAAc7ttyHof0DrwkXydQovakvUVbQ2k81bmvGmZKp+QNR83psAVqyAdw3rka6yJ0hPbdW4s89OREaPgXLWaVYo046lOVCDKGVsEs0t6r8hRNL7rTN9QLQXM8IVozKLJhZprDzr5/q6f9llQ+9nWHB+dLnGLnY6ID/ynA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WHxWobuNQQKqXDHqlkEQtqhMToQj/bc7FRdcmE843mMqTeAK3TXS7UAibBxsvnwWyADd8LtmrDrZc+KBU++c77iRKt39uFXGlnEowAT8ThwWUw7szXxVthATDNxl92Rcq5qojXtBByvaVcVnliSIm28dPM6Zx8QUzDqPyNiV3FVUT4Qp0DP7oO3mvznkrgygOvmdkIkIZjcVOOlb2dGMs/oWTDILw8SvXwA2OYUrNpmrQ7mRd/yJ0rZ48Qk5chhlxsiICTCmRSgRPnqhPDgy5OwblG2y6YgqAyC9Zhy1eQTHxsUOopLALY71bY05izNc798bSSSvmQta17vC0pJb6A==
  • 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: Fri, 28 Apr 2023 15:22:59 +0000
  • Ironport-data: A9a23:55hbYau7xEdyMEUs4+XnRf6+W+fnVJBfMUV32f8akzHdYApBsoF/q tZmKT2PM/uONjCmLo8lb4+xoRgDsZPWnd9hTwc/riA2EioV+JbJXdiXEBz9bniYRiHhoOCLz O1FM4Wdc5pkJpP4jk3wWlQ0hSAkjclkfpKlVKiffHg3HVQ+IMsYoUoLs/YjhYJ1isSODQqIu Nfjy+XSI1bg0DNvWo4uw/vrRChH4bKj6Vv0gnRkPaoQ5AOExyFJZH4iDfrZw0XQE9E88tGSH 44v/JnhlkvF8hEkDM+Sk7qTWiXmlZaLYGBiIlIPM0STqkAqSh4ai87XB9JFAatjsB2bnsgZ9 Tl4ncfYpTHFnEH7sL91vxFwS0mSNEDdkVPNCSDXXce7lyUqf5ZwqhnH4Y5f0YAwo45K7W9yG fMwMzJOfE6917+Kw7ecReAv3d8ccJHhI9ZK0p1g5Wmx4fcOZ7nmGv+PyfoGmTA6i4ZJAOrUY NcfZXx3dhPcbhZTO1ARTpUjgOOvgXq5eDpdwL6XjfNvvy6Pk0osgf60b4a9lt+iHK25mm6xo G7c8nu/KRYdLNGFkhKO8262h/+JliT+MG4XPOTgqaA22wXLlwT/DjUbRRySm9WFknS3cP19J xQuwRc+8IYtoRnDot7VGkfQTGS/lhcYVthZFeEg70eTw67Q7gSeLmMASSNNLtchsaceVTEsk 1OEgd7tLThuq6GOD2KQ8K+OqjG/MjRTKnUNDQcbSSMV7t+lp5s85jrNQcxkC7WdlcDuFHf7x DXikcQlr7AajMpO26Dl+1nC2miovsKQEVJz4RjLVGW46A8/fJSie4Gj9Vnc67BHMZqdSV6C+ nMDnqBy8dwzMH1ErwTVKM1lIV1jz6zt3OH06bK3I6Qcyg==
  • Ironport-hdrordr: A9a23:25TXOaxbNjpZA4i7RifbKrPwEr1zdoMgy1knxilNoH1uA7Wlfq WV954mPHDP+VUssU8b6Le90cW7IU80jKQFh7X5Xo3NYOCFghrREGgK1+KLrgEIfReOk9K1vp 0AT0ERMqyTMbD75vyKhDVRkb0brOVuq8iT6tvj8w==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 28/04/2023 11:41 am, Alejandro Vallejo wrote:
> xc_domain_getinfolist() internally relies on a sysctl that performs
> a linear search for the domids. Many callers of xc_domain_getinfolist()
> who require information about a precise domid are much better off calling
> xc_domain_getinfo_single() instead, that will use the getdomaininfo domctl
> instead and ensure the returned domid matches the requested one. The domtctl
> will find the domid faster too, because that uses hashed lists.
>
> Signed-off-by: Alejandro Vallejo <alejandro.vallejo@xxxxxxxxx>
> ---
> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Cc: Wei Liu <wl@xxxxxxx>
> Cc: Anthony PERARD <anthony.perard@xxxxxxxxxx>
> Cc: Juergen Gross <jgross@xxxxxxxx>
> ---
>  tools/libs/light/libxl_dom.c         | 15 +++++----------
>  tools/libs/light/libxl_dom_suspend.c |  7 +------
>  tools/libs/light/libxl_domain.c      | 13 +++++--------
>  tools/libs/light/libxl_mem.c         |  4 ++--
>  tools/libs/light/libxl_sched.c       | 12 ++++--------
>  tools/xenpaging/xenpaging.c          | 10 +++++-----
>  6 files changed, 22 insertions(+), 39 deletions(-)
>
> diff --git a/tools/libs/light/libxl_dom.c b/tools/libs/light/libxl_dom.c
> index 25fb716084..bd5d823581 100644
> --- a/tools/libs/light/libxl_dom.c
> +++ b/tools/libs/light/libxl_dom.c
> @@ -32,8 +32,8 @@ libxl_domain_type libxl__domain_type(libxl__gc *gc, 
> uint32_t domid)
>      xc_domaininfo_t info;
>      int ret;
>  
> -    ret = xc_domain_getinfolist(ctx->xch, domid, 1, &info);
> -    if (ret != 1 || info.domain != domid) {
> +    ret = xc_domain_getinfo_single(ctx->xch, domid, &info);
> +    if (ret < 0) {
>          LOG(ERROR, "unable to get domain type for domid=%"PRIu32, domid);

I think this LOG() would benefit from turning into a LOGED() like the
others.

Otherwise, everything LGTM.  I'm happy to adjust on commit.

Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>



 


Rackspace

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