From nobody Fri Apr 19 13:39:54 2024 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=1573196323; cv=none; d=zoho.com; s=zohoarc; b=lTaAAia0tLOpYPlpr9UFArY1xPuaNBElNXBGk2nD3x3oPuQa/aKlA8s9mOQ6dkDjXac4OFruy17DCDMvkjdj/SlBO3tLgZVjPUKFCBZr4+/pbewKcP8ZRtXr3YOHTsilJLZaeyMHEUHZY6gbi2e5Tz3tsWQjJ0QUy0Z0XzEoswg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573196323; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=DRqipQglqWFJnbdz2MDp4To+hyeBIUkBCWsmVYg8Hi4=; b=O5HrOLhaAK0jAZARIBF3RGvyXBeHWnx/oTj58gMumP2IdAVA09cAKUiIEC158cobXVzLX284rt+WDLyWqCPOMxXIkoSHlRZVbffRv+Fz1XBeFwwt5299Ab4ZXJcs+YGnhFRv2X+JsA8q4CPeshQm8evx5L7+zy1CoHorSa+QKLo= 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 1573196323448144.42615384275564; Thu, 7 Nov 2019 22:58:43 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iSyDJ-00027h-RF; Fri, 08 Nov 2019 06:57:45 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iSyDI-00027Z-3w for xen-devel@lists.xenproject.org; Fri, 08 Nov 2019 06:57:44 +0000 Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 0f7cb086-01f5-11ea-a1d0-12813bfff9fa; Fri, 08 Nov 2019 06:57:43 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 4ECABACE0; Fri, 8 Nov 2019 06:57:42 +0000 (UTC) X-Inumbo-ID: 0f7cb086-01f5-11ea-a1d0-12813bfff9fa X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Fri, 8 Nov 2019 07:57:39 +0100 Message-Id: <20191108065739.21345-1-jgross@suse.com> X-Mailer: git-send-email 2.16.4 Subject: [Xen-devel] [PATCH] xen/sched: fix a potential issue with core scheduling 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 , Stefano Stabellini , Julien Grall , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Dario Faggioli , Meng Xu , 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" cpupool_online_cpumask() is used by credit and rt scheduler. It returns all the cpus of a cpupool or all online cpus in case no cpupool is specified. The "no cpupool" case can be dropped, as no scheduler other than the init scheduler will ever work on cpus not associated with any cpupool. As the individual schedulers should only ever work on scheduling resources instead of individual cpus, their cpupool_online_cpumask() use should be replaced by cpupool->res_valid. Note that only with core scheduling active this might result in potential problems, as with cpu scheduling both masks are identical. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- xen/common/sched_credit.c | 3 +-- xen/common/sched_rt.c | 4 ++-- xen/include/xen/sched-if.h | 3 --- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c index fbffcf3996..645cdc5e9a 100644 --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -1684,12 +1684,11 @@ csched_load_balance(struct csched_private *prv, int= cpu, struct cpupool *c =3D get_sched_res(cpu)->cpupool; struct csched_unit *speer; cpumask_t workers; - cpumask_t *online; + cpumask_t *online =3D c->res_valid; int peer_cpu, first_cpu, peer_node, bstep; int node =3D cpu_to_node(cpu); =20 BUG_ON(get_sched_res(cpu) !=3D snext->unit->res); - online =3D cpupool_online_cpumask(c); =20 /* * If this CPU is going offline, or is not (yet) part of any cpupool diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c index 6e93e50acb..b2b29481f3 100644 --- a/xen/common/sched_rt.c +++ b/xen/common/sched_rt.c @@ -774,8 +774,8 @@ rt_deinit_pdata(const struct scheduler *ops, void *pcpu= , int cpu) =20 if ( prv->repl_timer.cpu =3D=3D cpu ) { - struct cpupool *c =3D get_sched_res(cpu)->cpupool; - unsigned int new_cpu =3D cpumask_cycle(cpu, cpupool_online_cpumask= (c)); + cpumask_t *online =3D get_sched_res(cpu)->cpupool->res_valid; + unsigned int new_cpu =3D cpumask_cycle(cpu, online); =20 /* * Make sure the timer run on one of the cpus that are still avail= able diff --git a/xen/include/xen/sched-if.h b/xen/include/xen/sched-if.h index 29715652bc..b0ac54e63d 100644 --- a/xen/include/xen/sched-if.h +++ b/xen/include/xen/sched-if.h @@ -545,9 +545,6 @@ struct cpupool enum sched_gran gran; }; =20 -#define cpupool_online_cpumask(_pool) \ - (((_pool) =3D=3D NULL) ? &cpu_online_map : (_pool)->cpu_valid) - static inline cpumask_t *cpupool_domain_master_cpumask(const struct domain= *d) { /* --=20 2.16.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel