From nobody Mon Feb 9 16:38:28 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=1559039685; cv=none; d=zoho.com; s=zohoarc; b=XLs3yMqgFOdrtzsmgWEJx2JpS0mftieDZezphHQOus3dWEJfLzmDVtplR9UJUV5RPmyYWULigu+LnWaTj4ncxwcgfPIld9td1fs4GD7WH40OAW3wcpPUDxKlrDScjdejELVjxVc5JUdt4485JlwoH9cD9x4MhCegtkoL4Ow/qYE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559039685; 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=moTM8SJzpQTCYn2Kpb92SkSVahMd44IYtb/ftj9Iv1E=; b=WReUc1Qy/dfmPypM3QT1dsG85awLZTFV5cBIDjfrncJ+RGLiJxX5rdekqyYoH5IDjPFzZ+OwY9jRhEYWdeTsKZ6xaRw7wdrtSoNiJEoVKNZruH+yIHUWjGd5PgbC+hYXccBJ/I8C+ku0zAqXwafIt3M0XjaWyKEgDqYNP7R+1kM= 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 1559039685822343.60959692504355; Tue, 28 May 2019 03:34:45 -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 1hVZQd-0005mF-Ke; Tue, 28 May 2019 10:33:59 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hVZQD-0004qM-2v for xen-devel@lists.xenproject.org; Tue, 28 May 2019 10:33:33 +0000 Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 09f57bc9-8134-11e9-8980-bc764e045a96; Tue, 28 May 2019 10:33:32 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 5C800B039; Tue, 28 May 2019 10:33:31 +0000 (UTC) X-Inumbo-ID: 09f57bc9-8134-11e9-8980-bc764e045a96 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Tue, 28 May 2019 12:33:10 +0200 Message-Id: <20190528103313.1343-58-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190528103313.1343-1-jgross@suse.com> References: <20190528103313.1343-1-jgross@suse.com> Subject: [Xen-devel] [PATCH 57/60] 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 78eb055d07..6f6886d5c3 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 opt_sched_granularity =3D SCHED_GRAN_cpu; unsigned int sched_granularity =3D 1; bool 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); @@ -2288,8 +2288,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; @@ -2301,6 +2307,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 schedule_init(). */ if ( cpu =3D=3D 0 ) return 0; @@ -2336,6 +2344,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 @@ -2484,6 +2493,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 abf6d0522d..714d793815 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