From nobody Mon Feb 9 08:10:02 2026 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1565362791; cv=none; d=zoho.com; s=zohoarc; b=m2F3RrCrVwuqeCqe+ZANVbR5JzjF5Am0hWk/ROE2afY7n3Yg9r8OHkL7rJZbPm7cU1+fZeNZcQivb/lJoJ8ihmQ9/Fgzyr4SpQVKrFAbe8DbqMmhaedbs9iLSKzR6rfTnbEnK2l3+FX3/3mTG1HwQbPQP+UhPmf4z6TAy6uMd+A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565362791; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=3iqPojdLEjaLgwLgc83KmRAW/z8oRKFJU1eTO1AjgN4=; b=mxEz4iPbolqhGl37AgfptFkIeVo/l0y/7DTPZdNvqvn5aa6GxQmfTic2YrsG69E9mx0KY5oUZmGXW1SCtpGS2bmkgSsGPNHb8kSYEQUyNSwi7H0y7vwcBLCwBTtrPmkxezNqi5W5dvffOoYTRXlGvkBdiRJjfc4Pw/pmh0AdCDk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1565362791566269.4376300529234; Fri, 9 Aug 2019 07:59:51 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hw6MP-0007Q8-8T; Fri, 09 Aug 2019 14:59:17 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hw6M5-0006hN-Cv for xen-devel@lists.xenproject.org; Fri, 09 Aug 2019 14:58:57 +0000 Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 34a66604-bab6-11e9-8980-bc764e045a96; Fri, 09 Aug 2019 14:58:54 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D4B03B061; Fri, 9 Aug 2019 14:58:53 +0000 (UTC) X-Inumbo-ID: 34a66604-bab6-11e9-8980-bc764e045a96 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Fri, 9 Aug 2019 16:58:29 +0200 Message-Id: <20190809145833.1020-45-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190809145833.1020-1-jgross@suse.com> References: <20190809145833.1020-1-jgross@suse.com> Subject: [Xen-devel] [PATCH v2 44/48] xen/sched: support multiple cpus per scheduling resource X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Tim Deegan , Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Dario Faggioli , Julien Grall , Jan Beulich MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Prepare supporting multiple cpus per scheduling resource by allocating the cpumask per resource dynamically. Modify sched_res_mask to have only one bit per scheduling resource set. Signed-off-by: Juergen Gross --- V1: new patch (carved out from other patch) --- xen/common/schedule.c | 16 ++++++++++++++-- xen/include/xen/sched-if.h | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index f95d346330..948fe1b838 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -59,7 +59,7 @@ integer_param("sched_ratelimit_us", sched_ratelimit_us); enum sched_gran __read_mostly opt_sched_granularity =3D SCHED_GRAN_cpu; unsigned int __read_mostly sched_granularity =3D 1; bool __read_mostly sched_disable_smt_switching; -const cpumask_t *sched_res_mask =3D &cpumask_all; +cpumask_var_t sched_res_mask; =20 /* Common lock for free cpus. */ static DEFINE_SPINLOCK(sched_free_cpu_lock); @@ -2377,8 +2377,14 @@ static int cpu_schedule_up(unsigned int cpu) sd =3D xzalloc(struct sched_resource); if ( sd =3D=3D NULL ) return -ENOMEM; + if ( !zalloc_cpumask_var(&sd->cpus) ) + { + xfree(sd); + return -ENOMEM; + } + sd->processor =3D cpu; - sd->cpus =3D cpumask_of(cpu); + cpumask_copy(sd->cpus, cpumask_of(cpu)); set_sched_res(cpu, sd); =20 sd->scheduler =3D &sched_idle_ops; @@ -2390,6 +2396,8 @@ static int cpu_schedule_up(unsigned int cpu) /* We start with cpu granularity. */ sd->granularity =3D 1; =20 + cpumask_set_cpu(cpu, sched_res_mask); + /* Boot CPU is dealt with later in scheduler_init(). */ if ( cpu =3D=3D 0 ) return 0; @@ -2422,6 +2430,7 @@ static void sched_res_free(struct rcu_head *head) { struct sched_resource *sd =3D container_of(head, struct sched_resource= , rcu); =20 + free_cpumask_var(sd->cpus); xfree(sd); } =20 @@ -2570,6 +2579,9 @@ void __init scheduler_init(void) printk("Using '%s' (%s)\n", ops.name, ops.opt_name); } =20 + if ( !zalloc_cpumask_var(&sched_res_mask) ) + BUG(); + if ( cpu_schedule_up(0) ) BUG(); register_cpu_notifier(&cpu_schedule_nfb); diff --git a/xen/include/xen/sched-if.h b/xen/include/xen/sched-if.h index de50b4ebca..5a93ba3686 100644 --- a/xen/include/xen/sched-if.h +++ b/xen/include/xen/sched-if.h @@ -24,7 +24,7 @@ extern cpumask_t cpupool_free_cpus; extern int sched_ratelimit_us; =20 /* Scheduling resource mask. */ -extern const cpumask_t *sched_res_mask; +extern cpumask_var_t sched_res_mask; =20 /* Number of vcpus per struct sched_unit. */ enum sched_gran { @@ -58,7 +58,7 @@ struct sched_resource { atomic_t urgent_count; /* how many urgent vcpus = */ unsigned int processor; unsigned int granularity; - const cpumask_t *cpus; /* cpus covered by this struct = */ + cpumask_var_t cpus; /* cpus covered by this struct = */ struct rcu_head rcu; }; =20 --=20 2.16.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel