From nobody Mon Feb 9 07:55:30 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=1557125918; cv=none; d=zoho.com; s=zohoarc; b=dvTKarhdBERSlYc64vph3AvbR5Inc7mseAjKOT5t5plgiEnW0wlCy+eOuOmWw7bypflV+B3IURx3mpX00z6mWrOWNRFaqKkFGU0/wUfNx8x4BRTgUYDg1NlBgNcdOPMANyZ7w+cjutBfLSFYzKDCaOLgpBnlkWGfo5/wB/gii0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557125918; 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=NUrgIxP4CLip9n0tAWlg6ccFEj3wXWA1ZIcvZQS51TE=; b=nisJYRa72AEfn4W2UcVr0wJ3N5Rw/EC5n6VzFkmxJ/jOELLQgQbKfnkPvTzPJgW6GextjfM7msk5IG0k40pqU7wuWf82sCNbHPjOz74XdLLG5psu94olZERaPcXrbI11MERJ5w8vxkqdDi5V8PpNV9dEH4Ss1xvgiiUgNjFEoPU= 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 1557125918188223.6906856787482; Sun, 5 May 2019 23:58:38 -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 1hNXYc-0001xi-Qc; Mon, 06 May 2019 06:57:02 +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 1hNXYb-0001wp-NH for xen-devel@lists.xenproject.org; Mon, 06 May 2019 06:57:01 +0000 Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 1f18b870-6fcc-11e9-9193-ab607bdbffc7; Mon, 06 May 2019 06:56:50 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 6111BAD03; Mon, 6 May 2019 06:56:49 +0000 (UTC) X-Inumbo-ID: 1f18b870-6fcc-11e9-9193-ab607bdbffc7 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Mon, 6 May 2019 08:56:03 +0200 Message-Id: <20190506065644.7415-5-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190506065644.7415-1-jgross@suse.com> References: <20190506065644.7415-1-jgross@suse.com> Subject: [Xen-devel] [PATCH RFC V2 04/45] xen/sched: move per-vcpu scheduler private data pointer to sched_item 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 , Robert VanVossen , Dario Faggioli , Julien Grall , Josh Whitehead , 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" This prepares making the different schedulers vcpu agnostic. Signed-off-by: Juergen Gross --- xen/common/sched_arinc653.c | 4 ++-- xen/common/sched_credit.c | 6 +++--- xen/common/sched_credit2.c | 10 +++++----- xen/common/sched_null.c | 4 ++-- xen/common/sched_rt.c | 4 ++-- xen/common/schedule.c | 24 ++++++++++++------------ xen/include/xen/sched.h | 2 +- 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/xen/common/sched_arinc653.c b/xen/common/sched_arinc653.c index fffe23113e..f5af8b972d 100644 --- a/xen/common/sched_arinc653.c +++ b/xen/common/sched_arinc653.c @@ -53,7 +53,7 @@ * Return a pointer to the ARINC 653-specific scheduler data information * associated with the given VCPU (vc) */ -#define AVCPU(vc) ((arinc653_vcpu_t *)(vc)->sched_priv) +#define AVCPU(vc) ((arinc653_vcpu_t *)(vc)->sched_item->priv) =20 /** * Return the global scheduler private data given the scheduler ops pointer @@ -647,7 +647,7 @@ a653_switch_sched(struct scheduler *new_ops, unsigned i= nt cpu, =20 ASSERT(!pdata && svc && is_idle_vcpu(svc->vc)); =20 - idle_vcpu[cpu]->sched_priv =3D vdata; + idle_vcpu[cpu]->sched_item->priv =3D vdata; =20 per_cpu(scheduler, cpu) =3D new_ops; per_cpu(schedule_data, cpu).sched_priv =3D NULL; /* no pdata */ diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c index 3735486b4c..cb8e167fc9 100644 --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -83,7 +83,7 @@ ((struct csched_private *)((_ops)->sched_data)) #define CSCHED_PCPU(_c) \ ((struct csched_pcpu *)per_cpu(schedule_data, _c).sched_priv) -#define CSCHED_VCPU(_vcpu) ((struct csched_vcpu *) (_vcpu)->sched_priv) +#define CSCHED_VCPU(_vcpu) ((struct csched_vcpu *) (_vcpu)->sched_item->p= riv) #define CSCHED_DOM(_dom) ((struct csched_dom *) (_dom)->sched_priv) #define RUNQ(_cpu) (&(CSCHED_PCPU(_cpu)->runq)) =20 @@ -641,7 +641,7 @@ csched_switch_sched(struct scheduler *new_ops, unsigned= int cpu, =20 ASSERT(svc && is_idle_vcpu(svc->vcpu)); =20 - idle_vcpu[cpu]->sched_priv =3D vdata; + idle_vcpu[cpu]->sched_item->priv =3D vdata; =20 /* * We are holding the runqueue lock already (it's been taken in @@ -1031,7 +1031,7 @@ static void csched_item_insert(const struct scheduler *ops, struct sched_item *item) { struct vcpu *vc =3D item->vcpu; - struct csched_vcpu *svc =3D vc->sched_priv; + struct csched_vcpu *svc =3D item->priv; spinlock_t *lock; =20 BUG_ON( is_idle_vcpu(vc) ); diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c index f44286c2a5..9c052c24a7 100644 --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -572,7 +572,7 @@ static inline struct csched2_pcpu *csched2_pcpu(unsigne= d int cpu) =20 static inline struct csched2_vcpu *csched2_vcpu(const struct vcpu *v) { - return v->sched_priv; + return v->sched_item->priv; } =20 static inline struct csched2_dom *csched2_dom(const struct domain *d) @@ -970,7 +970,7 @@ _runq_assign(struct csched2_vcpu *svc, struct csched2_r= unqueue_data *rqd) static void runq_assign(const struct scheduler *ops, struct vcpu *vc) { - struct csched2_vcpu *svc =3D vc->sched_priv; + struct csched2_vcpu *svc =3D vc->sched_item->priv; =20 ASSERT(svc->rqd =3D=3D NULL); =20 @@ -997,7 +997,7 @@ _runq_deassign(struct csched2_vcpu *svc) static void runq_deassign(const struct scheduler *ops, struct vcpu *vc) { - struct csched2_vcpu *svc =3D vc->sched_priv; + struct csched2_vcpu *svc =3D vc->sched_item->priv; =20 ASSERT(svc->rqd =3D=3D c2rqd(ops, vc->processor)); =20 @@ -3108,7 +3108,7 @@ static void csched2_item_insert(const struct scheduler *ops, struct sched_item *item) { struct vcpu *vc =3D item->vcpu; - struct csched2_vcpu *svc =3D vc->sched_priv; + struct csched2_vcpu *svc =3D item->priv; struct csched2_dom * const sdom =3D svc->sdom; spinlock_t *lock; =20 @@ -3888,7 +3888,7 @@ csched2_switch_sched(struct scheduler *new_ops, unsig= ned int cpu, ASSERT(!local_irq_is_enabled()); write_lock(&prv->lock); =20 - idle_vcpu[cpu]->sched_priv =3D vdata; + idle_vcpu[cpu]->sched_item->priv =3D vdata; =20 rqi =3D init_pdata(prv, pdata, cpu); =20 diff --git a/xen/common/sched_null.c b/xen/common/sched_null.c index 7b508f35a4..eb51ddbccb 100644 --- a/xen/common/sched_null.c +++ b/xen/common/sched_null.c @@ -117,7 +117,7 @@ static inline struct null_private *null_priv(const stru= ct scheduler *ops) =20 static inline struct null_vcpu *null_vcpu(const struct vcpu *v) { - return v->sched_priv; + return v->sched_item->priv; } =20 static inline bool vcpu_check_affinity(struct vcpu *v, unsigned int cpu, @@ -391,7 +391,7 @@ static void null_switch_sched(struct scheduler *new_ops= , unsigned int cpu, =20 ASSERT(nvc && is_idle_vcpu(nvc->vcpu)); =20 - idle_vcpu[cpu]->sched_priv =3D vdata; + idle_vcpu[cpu]->sched_item->priv =3D vdata; =20 /* * We are holding the runqueue lock already (it's been taken in diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c index ab8fa02306..c830aac92f 100644 --- a/xen/common/sched_rt.c +++ b/xen/common/sched_rt.c @@ -235,7 +235,7 @@ static inline struct rt_private *rt_priv(const struct s= cheduler *ops) =20 static inline struct rt_vcpu *rt_vcpu(const struct vcpu *vcpu) { - return vcpu->sched_priv; + return vcpu->sched_item->priv; } =20 static inline struct list_head *rt_runq(const struct scheduler *ops) @@ -761,7 +761,7 @@ rt_switch_sched(struct scheduler *new_ops, unsigned int= cpu, dprintk(XENLOG_DEBUG, "RTDS: timer initialized on cpu %u\n", cpu); } =20 - idle_vcpu[cpu]->sched_priv =3D vdata; + idle_vcpu[cpu]->sched_item->priv =3D vdata; per_cpu(scheduler, cpu) =3D new_ops; per_cpu(schedule_data, cpu).sched_priv =3D NULL; /* no pdata */ =20 diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 071289b9c0..795d56a793 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -269,8 +269,8 @@ int sched_init_vcpu(struct vcpu *v, unsigned int proces= sor) init_timer(&v->poll_timer, poll_timer_fn, v, v->processor); =20 - v->sched_priv =3D sched_alloc_vdata(dom_scheduler(d), item, d->sched_p= riv); - if ( v->sched_priv =3D=3D NULL ) + item->priv =3D sched_alloc_vdata(dom_scheduler(d), item, d->sched_priv= ); + if ( item->priv =3D=3D NULL ) { v->sched_item =3D NULL; xfree(item); @@ -365,7 +365,7 @@ int sched_move_domain(struct domain *d, struct cpupool = *c) { spinlock_t *lock; =20 - vcpudata =3D v->sched_priv; + vcpudata =3D v->sched_item->priv; =20 migrate_timer(&v->periodic_timer, new_p); migrate_timer(&v->singleshot_timer, new_p); @@ -383,7 +383,7 @@ int sched_move_domain(struct domain *d, struct cpupool = *c) */ spin_unlock_irq(lock); =20 - v->sched_priv =3D vcpu_priv[v->vcpu_id]; + v->sched_item->priv =3D vcpu_priv[v->vcpu_id]; if ( !d->is_dying ) sched_move_irqs(v); =20 @@ -415,7 +415,7 @@ void sched_destroy_vcpu(struct vcpu *v) if ( test_and_clear_bool(v->is_urgent) ) atomic_dec(&per_cpu(schedule_data, v->processor).urgent_count); sched_remove_item(vcpu_scheduler(v), item); - sched_free_vdata(vcpu_scheduler(v), v->sched_priv); + sched_free_vdata(vcpu_scheduler(v), item->priv); xfree(item); v->sched_item =3D NULL; } @@ -1593,6 +1593,7 @@ static int cpu_schedule_up(unsigned int cpu) else { struct vcpu *idle =3D idle_vcpu[cpu]; + struct sched_item *item =3D idle->sched_item; =20 /* * During (ACPI?) suspend the idle vCPU for this pCPU is not freed, @@ -1604,11 +1605,10 @@ static int cpu_schedule_up(unsigned int cpu) * with a different scheduler, it is schedule_cpu_switch(), invoked * later, that will set things up as appropriate. */ - ASSERT(idle->sched_priv =3D=3D NULL); + ASSERT(item->priv =3D=3D NULL); =20 - idle->sched_priv =3D sched_alloc_vdata(&ops, idle->sched_item, - idle->domain->sched_priv); - if ( idle->sched_priv =3D=3D NULL ) + item->priv =3D sched_alloc_vdata(&ops, item, idle->domain->sched_p= riv); + if ( item->priv =3D=3D NULL ) return -ENOMEM; } if ( idle_vcpu[cpu] =3D=3D NULL ) @@ -1634,9 +1634,9 @@ static void cpu_schedule_down(unsigned int cpu) struct scheduler *sched =3D per_cpu(scheduler, cpu); =20 sched_free_pdata(sched, sd->sched_priv, cpu); - sched_free_vdata(sched, idle_vcpu[cpu]->sched_priv); + sched_free_vdata(sched, idle_vcpu[cpu]->sched_item->priv); =20 - idle_vcpu[cpu]->sched_priv =3D NULL; + idle_vcpu[cpu]->sched_item->priv =3D NULL; sd->sched_priv =3D NULL; =20 kill_timer(&sd->s_timer); @@ -1861,7 +1861,7 @@ int schedule_cpu_switch(unsigned int cpu, struct cpup= ool *c) */ old_lock =3D pcpu_schedule_lock_irq(cpu); =20 - vpriv_old =3D idle->sched_priv; + vpriv_old =3D idle->sched_item->priv; ppriv_old =3D per_cpu(schedule_data, cpu).sched_priv; sched_switch_sched(new_ops, cpu, ppriv, vpriv); =20 diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 85f9119d48..45857b4d35 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -162,7 +162,6 @@ struct vcpu struct timer poll_timer; /* timeout for SCHEDOP_poll */ =20 struct sched_item *sched_item; - void *sched_priv; /* scheduler-specific data */ =20 struct vcpu_runstate_info runstate; #ifndef CONFIG_COMPAT @@ -279,6 +278,7 @@ struct vcpu =20 struct sched_item { struct vcpu *vcpu; + void *priv; /* scheduler private data */ }; =20 /* Per-domain lock can be recursively acquired in fault handlers. */ --=20 2.16.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel