From nobody Tue Nov 11 08:28:58 2025 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=1569820979; cv=none; d=zoho.com; s=zohoarc; b=Sj3R4FJ37LJ9N5wmHWVqQN3iErLPWs99ZUuxYsa4yta/hRTwztnE9Wum1Yh2gcF8vNoiqIKD2Sug+82aXoLFGXVaj0WBN9IC8MkZd4dj2dnC3VdeMmhrvCbeO22D7tuxiDMDNId9S17J2JKu22bQgD5WPahkT7l1kx9RwgFH8kw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569820979; 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=y/QM81XlCM2xxDolS79u7Ai6yiZ5GZ+ElR2/CFzqIrM=; b=EETR9zOpnMLw4MLb3erqmdOEO2y4shKYkdJxGei5PwT/bX/mjDFOFcLQRtRdDEjLggfTeYeSeQ73GC50egDBI2zUmzfwF2ic46uVi3p+rjeksA0H/A5wRTVsaQjumbihwnvKoJnaLvJXDF4jBFwWA4zOhOAq4kxnzRqWCVaaHZ8= 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 1569820979249422.73575953862985; Sun, 29 Sep 2019 22:22:59 -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 1iEo8G-00023v-Uj; Mon, 30 Sep 2019 05:22:00 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iEo8F-00022T-At for xen-devel@lists.xenproject.org; Mon, 30 Sep 2019 05:21:59 +0000 Received: from mx1.suse.de (unknown [195.135.220.15]) by localhost (Halon) with ESMTPS id 300de21a-e342-11e9-b588-bc764e2007e4; Mon, 30 Sep 2019 05:21:43 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 5B7C3B061; Mon, 30 Sep 2019 05:21:40 +0000 (UTC) X-Inumbo-ID: 300de21a-e342-11e9-b588-bc764e2007e4 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Mon, 30 Sep 2019 07:21:22 +0200 Message-Id: <20190930052135.11257-7-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190930052135.11257-1-jgross@suse.com> References: <20190930052135.11257-1-jgross@suse.com> Subject: [Xen-devel] [PATCH v5 06/19] xen/sched: add a percpu resource index 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 , George Dunlap , Dario Faggioli 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" Add a percpu variable holding the index of the cpu in the current sched_resource structure. This index is used to get the correct vcpu of a sched_unit on a specific cpu. For now this index will be zero for all cpus, but with core scheduling it will be possible to have higher values, too. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- RFC V2: new patch (carved out from RFC V1 patch 49) V4: - make function parameter const (Jan Beulich) --- xen/common/schedule.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 37002b4c0e..c8e2999407 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -77,6 +77,7 @@ static void poll_timer_fn(void *data); /* This is global for now so that private implementations can reach it */ DEFINE_PER_CPU(struct scheduler *, scheduler); DEFINE_PER_CPU_READ_MOSTLY(struct sched_resource *, sched_res); +static DEFINE_PER_CPU_READ_MOSTLY(unsigned int, sched_res_idx); =20 /* Scratch space for cpumasks. */ DEFINE_PER_CPU(cpumask_t, cpumask_scratch); @@ -144,6 +145,12 @@ static struct scheduler sched_idle_ops =3D { .switch_sched =3D sched_idle_switch_sched, }; =20 +static inline struct vcpu *sched_unit2vcpu_cpu(const struct sched_unit *un= it, + unsigned int cpu) +{ + return unit->domain->vcpu[unit->unit_id + per_cpu(sched_res_idx, cpu)]; +} + static inline struct scheduler *dom_scheduler(const struct domain *d) { if ( likely(d->cpupool !=3D NULL) ) @@ -2030,7 +2037,7 @@ static void sched_slave(void) =20 pcpu_schedule_unlock_irq(lock, cpu); =20 - sched_context_switch(vprev, next->vcpu_list, now); + sched_context_switch(vprev, sched_unit2vcpu_cpu(next, cpu), now); } =20 /* @@ -2091,7 +2098,7 @@ static void schedule(void) =20 pcpu_schedule_unlock_irq(lock, cpu); =20 - vnext =3D next->vcpu_list; + vnext =3D sched_unit2vcpu_cpu(next, cpu); sched_context_switch(vprev, vnext, now); } =20 --=20 2.16.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel