From nobody Tue Feb 10 01:15:39 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=1568451311; cv=none; d=zoho.com; s=zohoarc; b=bfygc3zdnWu4a0TEyY4rl3uuVDLA19nGnhDoj86eHzkSK6KAheHThqo5E2N9DTwIlErfjhcYTs/q7VyIcPunOyh7JHklJq6avppKcKk7fAEkV7M6gtn+Qca24T9nk2eSQzYwAd6NPpFOobT7hCkk0frl+xO7bxrbgoZsLECtZgA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568451311; 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=j1/+IbpWndR5ItBkMwtdy/ORXvkNiOT7JG12tQV6iJ4=; b=CaqhaMmUe9pa+DhW/bf/LYjgNjOvdd9kVR6ZikxM8Fyf1CdpSjBvnCfKnNeyhZ3H1x2XkGyRFW1Y/u/UtyCM4wqJxnW1J3r16thz/AwuTRyNu+Qmkys7dauB0Jr3/DWf0BkPO93IBiW9ep6mTFAVfjHYlHGPFgBi0zBqVqjl1ts= 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 156845131111725.675498129121934; Sat, 14 Sep 2019 01:55:11 -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 1i93or-0000gq-Ia; Sat, 14 Sep 2019 08:54:13 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i93oq-0000fY-Vc for xen-devel@lists.xenproject.org; Sat, 14 Sep 2019 08:54:13 +0000 Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 130ac5b0-d6cd-11e9-b76c-bc764e2007e4; Sat, 14 Sep 2019 08:53:09 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7A19EB664; Sat, 14 Sep 2019 08:53:08 +0000 (UTC) X-Inumbo-ID: 130ac5b0-d6cd-11e9-b76c-bc764e2007e4 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Sat, 14 Sep 2019 10:52:47 +0200 Message-Id: <20190914085251.18816-44-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190914085251.18816-1-jgross@suse.com> References: <20190914085251.18816-1-jgross@suse.com> Subject: [Xen-devel] [PATCH v3 43/47] 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 c2e5a9220d..882b3baf42 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); @@ -2388,8 +2388,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->master_cpu =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; @@ -2401,6 +2407,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; @@ -2433,6 +2441,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 @@ -2581,6 +2590,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 f10ed768b0..1770b9bca1 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 { @@ -59,7 +59,7 @@ struct sched_resource { /* Cpu with lowest id in scheduling resource. */ unsigned int master_cpu; 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