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

Re: [PATCH for-4.22? 6/9] domctl: handle XEN_DOMCTL_getvcpuinfo without acquiring domctl lock


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 16 Jun 2026 10:56:48 +0200
  • 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=arcselector10001; 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=A+TSV25DALnz94oXS6n5Wi7qRMedJIKxHFC4W9wf72Y=; b=sJFhw1rS3uCbc0hD2+NWX255qkc/F97Aus52SJRwWfFrNW5b0rcw1N+aoTi6jBTQilhd8uqVMuGhnbBBRl6IWeddnO3lsWgdQ6qef9qdbs6xbR+QxtkTIgHNE4d6Z6F6KGPxO05D4P8JO6a51pViV6AM7WD/E60Fos1GRypHQlY72g5KUY4G/XVVhd8IAVDsW4rHXvWzIbEETydDmkB1Xgc0pAwNpNrhao6srghk2rDxk/9dWu7ShHS9oQVDo2lrfOSB3Ir1lPVOhoS1h7qHqXLoYN840Lgv9Wv3dOJxVoq5LWVGKdpZDEZczQUZ+PFCOY2ZcpDlH0jyrH/SvrR2ag==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GzviwhUik65yPIauuBtlJ71WC4DjhUMKM2TWS9DGPx4Pws6pg7pgj5ICtcOMi2aLdo1KnetTh/Pk2VzPaugOeFJlOVIHXPtdTfyF5y7Rh9TJ/aH8YObEmMxiNxl++7GZTn1MkdVzxusK4tQflelvU26lHDuRfcgjNCkjS1RVQm2HRgWcx5hGVh1gOjBGIrmASd1/6AKbn9cNvGKSaAi5xqWDqABbXK+L/F1dcMVii3OIbInPMu/jsf4YXMrFd3499TDlyNtT8fXPB2Dp/VXdLU1ejWTO9eHETf+qbJfRt2GBXUeYDhxYHRreNgcwuP0ZOxE3qk9J/hanCZTrK0nHXg==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
  • Delivery-date: Tue, 16 Jun 2026 08:57:04 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Jun 15, 2026 at 04:15:12PM +0200, Jan Beulich wrote:
> Like for XEN_DOMCTL_getdomaininfo there's no need to hold the domctl
> lock for XEN_DOMCTL_getvcpuinfo. While moving the code also switch to
> using domain_vcpu().
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> Tentatively-acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

Some suggestions below.

> 
> --- a/xen/common/domctl.c
> +++ b/xen/common/domctl.c
> @@ -546,6 +546,33 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe
>      if ( ret )
>          goto domctl_out_unlock_rcuonly;
>  
> +    switch ( op->cmd )
> +    {
> +    case XEN_DOMCTL_getvcpuinfo:
> +    {
> +        const struct vcpu *v;
> +
> +        if ( (v = domain_vcpu(d, op->u.getvcpuinfo.vcpu)) == NULL )

Since you are moving the code anyway, I would rather do:

        const struct vcpu *v = domain_vcpu(d, op->u.getvcpuinfo.vcpu);

        if ( !v )
            ...

> +        {
> +            ret = -ENOENT;
> +            goto domctl_out_unlock_rcuonly;
> +        }
> +
> +        op->u.getvcpuinfo.online   = !(v->pause_flags & VPF_down);
> +        op->u.getvcpuinfo.blocked  = !!(v->pause_flags & VPF_blocked);
> +        op->u.getvcpuinfo.running  = v->is_running;
> +        op->u.getvcpuinfo.cpu_time = vcpu_runstate_get_running(v);
> +        op->u.getvcpuinfo.cpu      = v->processor;
> +
> +        copyback = true;
> +        goto domctl_out_unlock_rcuonly;
> +    }
> +
> +    default:
> +        /* Everything else handled further up or further down. */
> +        break;
> +    }

As you are introducing this here, we might want to also move
XEN_DOMCTL_shadow_op handling into this new switch block: with the RCU
taken and after the xsm_domctl() call.

Thanks, Roger.



 


Rackspace

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