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

Re: [PATCH] domain: skip more stuff for idle's vCPU-s in vcpu_create()


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 16 Feb 2026 16:06:41 +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=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=MYfNenKyR18WxXZHcpEj8NdKDJuavWDVFgYFxMCy2RU=; b=bfCeNi46qQhp7XmtdUkedkgW5ubYLdPUCI1i6jhuSx1bKinzNOem4ZEoe72bOSR4psfL2QUQ8BkBUtoNLyIQiE+REJ7ty7voBD6HuLcIsrH8/tkuB+QOMJqVz92BQ0w2beyrp74tcCfxNR3d2wjPO6it0grq3F2neR23v6NzNMiJdolslrQgdNHt5oNwP190o3BCfqiqw4yR60TK0qzdADDVSp5t+gKtLTeEA7hzqdZPwDjzKixPUJrWIEWNebEPzGqoKt0OMkudA+Sxsxqrkngq6+saphAkCjap7OImF3WWrOzMqUWvSYSD1gq8bwoCydVAj9JwTRBrQWQ/4+LNeQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FKvEFGKkY8tZYJztgJgJFztz/vYu92/wSTkD29EYMFueOi75q8tSk6l6s+LnLQRoGrQIorOKAByyLD4bhaFI2hyUyeAx2mI7H7H9Nd8VTVzPCJCjNL168cX2d09sSqEQLxH4pfmNOX8FZ1BPjC++T1pwaOaumlJcIRM8e0XDvMfd5ZVdYde6pO/tnzFsEYR6V0gdXKkXY6BkwSNLFaQJNdOlCMLjSbDSzOFMh77Hv+W8jziGkumuv0K8eAkhKgP7qIJltUdEEJ8/531SIz8FBJDAfvBR++ji563z44KoDBP6mpa5ZaIgp4UYrzFnQzKiT6H1nKE2Wp7DOGKU9K8jYg==
  • 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>
  • Delivery-date: Mon, 16 Feb 2026 15:07:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Nov 26, 2025 at 11:31:46AM +0100, Jan Beulich wrote:
> Nothing hypercall-related needs setting up there. Nor do we need to
> check whether the idle domain is shutting down - it never will.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> ---
> For vmtrace_alloc_buffer() adding the conditional may be questionable: The
> function checks d->vmtrace_size first thing, bailing immediately when it's
> zero (which it always will be for the idle domain).

Oh, I notice this now (after having written the comment below).  I
would then add a comment rather than the extra check.  And possibly an
ASSERT(!is_idle_domain(d)); inside of `vmtrace_alloc_buffer()` after
the vmtrace_size check.

> --- a/xen/common/domain.c
> +++ b/xen/common/domain.c
> @@ -427,12 +427,6 @@ struct vcpu *vcpu_create(struct domain *
>      v->vcpu_id = vcpu_id;
>      v->dirty_cpu = VCPU_CPU_CLEAN;
>  
> -    rwlock_init(&v->virq_lock);
> -
> -    tasklet_init(&v->continue_hypercall_tasklet, NULL, NULL);
> -
> -    grant_table_init_vcpu(v);
> -
>      if ( is_idle_domain(d) )
>      {
>          v->runstate.state = RUNSTATE_running;
> @@ -440,6 +434,12 @@ struct vcpu *vcpu_create(struct domain *
>      }
>      else
>      {
> +        rwlock_init(&v->virq_lock);
> +
> +        tasklet_init(&v->continue_hypercall_tasklet, NULL, NULL);
> +
> +        grant_table_init_vcpu(v);
> +
>          v->runstate.state = RUNSTATE_offline;
>          v->runstate.state_entry_time = NOW();
>          set_bit(_VPF_down, &v->pause_flags);
> @@ -450,7 +450,7 @@ struct vcpu *vcpu_create(struct domain *
>      if ( sched_init_vcpu(v) != 0 )
>          goto fail_wq;
>  
> -    if ( vmtrace_alloc_buffer(v) != 0 )
> +    if ( !is_idle_domain(d) && vmtrace_alloc_buffer(v) != 0 )
>          goto fail_wq;

There's an existing issue here, the usage of fail_rq is wrong here.
It should use fail_sched instead.  However I wonder whether we want to
move the `vmtrace_alloc_buffer()` call inside the existing `else {`
branch of the is_idle_domain() condition, as to avoid this extra
is_idle_domain() check here?

Thanks, Roger.



 


Rackspace

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