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

Re: [PATCH 2/2] xen/sched: setup dom0 vCPUs affinity only once


  • To: Dario Faggioli <dfaggioli@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 3 Aug 2022 09:30:45 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=DxWMetrTgl7p4rMg2Ly8/M/Qw47nta0kpvluMzcZjZ8=; b=J03rtb9ll9vIyEY1V2uJrrcXRCF9izLtJKDOM5tR3LNDaJM614BUJ8S4SXX5gZrsnTGP3sTiZHJDDCZFodeEfoeKrOWgka9GTfXY53o3H6oyTSYoD67Uf/jRuNurFlZRQ+wH6FQvWGEBYsk37RfdhwphGnCBk/1XJfmZcgyfrT9R0OkUPPRRRv3K/NEMZOfqVchdJd9a3sYv6vZaiXV6ZkP1V5ez3QfSBznE7rFSHYJ2gh3B9+mmjuKd3WTIcCwMH8sooapXNzONSS6nXqnuuI5frW52Oi90+N+55/C+tVZ/PHuMDeioEINgLXNvLYIcnny4n6RAng0wAvp4FieZQg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lE1F1JEhn5bmeqhKDVM6IEW0wSsTY/TzjWTZ4pwRpc5cyAIoVRHxbevF7nvHCzSY+obtUbnuvvX/04dpDzg1/WX+fxGbkofAzwSD0VWAJleQPIDy/HG5lKEpGFySD5qJryppuV0m7JeljcY+Q7lr1Eoua/32lrFW+psvq3FP22JKuqDWnSI5ZLfegjF3lOVNbuXkB22tFh8HZEBMYHCSjzgW/yo8HhwKSgZrIPtJ+b2u2HgK/7qSfAJqPEIBc1Hue0hmNXIB5IsrILqWw/ZUO6Uxc2SufYB5fVF/yLUr/+5V/rN2iH4Gfc6HZBYmHf76eTm0v4V/t1PXoNyY+r+Qzg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Olaf Hering <ohering@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 03 Aug 2022 07:30:58 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 02.08.2022 15:51, Dario Faggioli wrote:
> Right now, affinity for dom0 vCPUs is setup in two steps. This is a
> problem as, at least in Credit2, unit_insert() sees and uses the
> "intermediate" affinity, and place the vCPUs on CPUs where they cannot
> be run. And this in turn results in boot hangs, if the "dom0_nodes"
> parameter is used.
> 
> Fix this by setting up the affinity properly once and for all, in
> sched_init_vcpu() called by create_vcpu().
> 
> Note that, unless a soft-affinity is explicitly specified for dom0 (by
> using the relaxed mode of "dom0_nodes") we set it to the default, which
> is all CPUs, instead of computing it basing on hard affinity (if any).
> This is because hard and soft affinity should be considered as
> independent user controlled properties. In fact, if we dor derive dom0's
> soft-affinity from its boot-time hard-affinity, such computed value will
> continue to be used even if later the user changes the hard-affinity.
> And this could result in the vCPUs behaving differently than what the
> user wanted and expects.
> 
> Fixes: dafd936ddd ("Make credit2 the default scheduler")

Nit: Please specify the first 12 digits of the hash here, as per
docs/process/sending-patches.pandoc.

> --- a/xen/common/sched/core.c
> +++ b/xen/common/sched/core.c
> @@ -571,12 +571,46 @@ int sched_init_vcpu(struct vcpu *v)
>          return 1;
>      }
>  
> -    /*
> -     * Initialize affinity settings. The idler, and potentially
> -     * domain-0 VCPUs, are pinned onto their respective physical CPUs.
> -     */
> -    if ( is_idle_domain(d) || (is_control_domain(d) && opt_dom0_vcpus_pin) )
> +    if ( is_idle_domain(d) )
> +    {
> +        /* Idle vCPUs are always pinned onto their respective pCPUs */
> +        sched_set_affinity(unit, cpumask_of(processor), &cpumask_all);
> +    }
> +    else if ( pv_shim && v->vcpu_id == 0 )
> +    {
> +        /*
> +         * PV-shim: vcpus are pinned 1:1. Initially only 1 cpu is online,
> +         * others will be dealt with when onlining them. This avoids pinning
> +         * a vcpu to a not yet online cpu here.
> +         */
> +        sched_set_affinity(unit, cpumask_of(0), cpumask_of(0));
> +    }
> +    else if ( is_control_domain(d) && opt_dom0_vcpus_pin )

Like with patch one: d->domain_id == 0?

> +    {
> +        /*
> +         * If dom0_vcpus_pin is specified, dom0 vCPUs are pinned 1:1 to
> +         * their respective pCPUs too.
> +         */
>          sched_set_affinity(unit, cpumask_of(processor), &cpumask_all);
> +    }
> +#ifdef CONFIG_X86
> +    else if ( is_control_domain(d) )

Same here then. With this and with the hard tabs taken care of
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

Jan



 


Rackspace

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