From patchwork Mon Apr 11 15:20:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Fancellu X-Patchwork-Id: 12809307 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1BA51C433F5 for ; Mon, 11 Apr 2022 15:21:32 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.303104.517112 (Exim 4.92) (envelope-from ) id 1ndvqu-0005Or-Fp; Mon, 11 Apr 2022 15:21:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 303104.517112; Mon, 11 Apr 2022 15:21:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ndvqu-0005ON-9x; Mon, 11 Apr 2022 15:21:16 +0000 Received: by outflank-mailman (input) for mailman id 303104; Mon, 11 Apr 2022 15:21:14 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ndvqs-0005MA-RN for xen-devel@lists.xenproject.org; Mon, 11 Apr 2022 15:21:14 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id 0611c4df-b9ab-11ec-a405-831a346695d4; Mon, 11 Apr 2022 17:21:13 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1B12C169E; Mon, 11 Apr 2022 08:21:13 -0700 (PDT) Received: from e125770.cambridge.arm.com (e125770.cambridge.arm.com [10.1.195.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A78F83F73B; Mon, 11 Apr 2022 08:21:11 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 0611c4df-b9ab-11ec-a405-831a346695d4 From: Luca Fancellu To: xen-devel@lists.xenproject.org Cc: bertrand.marquis@arm.com, wei.chen@arm.com, Juergen Gross , Dario Faggioli , George Dunlap , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH v7 2/7] xen/sched: create public function for cpupools creation Date: Mon, 11 Apr 2022 16:20:56 +0100 Message-Id: <20220411152101.17539-3-luca.fancellu@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220411152101.17539-1-luca.fancellu@arm.com> References: <20220411152101.17539-1-luca.fancellu@arm.com> Create new public function to create cpupools, can take as parameter the scheduler id or a negative value that means the default Xen scheduler will be used. Signed-off-by: Luca Fancellu Reviewed-by: Juergen Gross --- Changes in v7: - no changes Changes in v6: - add R-by Changes in v5: - no changes Changes in v4: - no changes Changes in v3: - Fixed comment (Andrew) Changes in v2: - cpupool_create_pool doesn't check anymore for pool id uniqueness before calling cpupool_create. Modified commit message accordingly --- xen/common/sched/cpupool.c | 15 +++++++++++++++ xen/include/xen/sched.h | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/xen/common/sched/cpupool.c b/xen/common/sched/cpupool.c index a6da4970506a..89a891af7076 100644 --- a/xen/common/sched/cpupool.c +++ b/xen/common/sched/cpupool.c @@ -1219,6 +1219,21 @@ static void cpupool_hypfs_init(void) #endif /* CONFIG_HYPFS */ +struct cpupool *__init cpupool_create_pool(unsigned int pool_id, int sched_id) +{ + struct cpupool *pool; + + if ( sched_id < 0 ) + sched_id = scheduler_get_default()->sched_id; + + pool = cpupool_create(pool_id, sched_id); + + BUG_ON(IS_ERR(pool)); + cpupool_put(pool); + + return pool; +} + static int __init cf_check cpupool_init(void) { unsigned int cpu; diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index ed8539f6d297..0164db996b8b 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -1153,6 +1153,22 @@ int cpupool_move_domain(struct domain *d, struct cpupool *c); int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op); unsigned int cpupool_get_id(const struct domain *d); const cpumask_t *cpupool_valid_cpus(const struct cpupool *pool); + +/* + * cpupool_create_pool - Creates a cpupool + * @pool_id: id of the pool to be created + * @sched_id: id of the scheduler to be used for the pool + * + * Creates a cpupool with pool_id id. + * The sched_id parameter identifies the scheduler to be used, if it is + * negative, the default scheduler of Xen will be used. + * + * returns: + * pointer to the struct cpupool just created, or Xen will panic in case of + * error + */ +struct cpupool *cpupool_create_pool(unsigned int pool_id, int sched_id); + extern void cf_check dump_runq(unsigned char key); void arch_do_physinfo(struct xen_sysctl_physinfo *pi);