From nobody Mon Feb 9 20:54:59 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=1559039683; cv=none; d=zoho.com; s=zohoarc; b=jNGrS9XBmt/noNxQm+N+vsfgnDNhCqdXN2eJQAmZt4BSDe4FG7tyIV3Z2i5JM8yKN3X2fkn+ibwZZ5eFCK9P8Me+H03+xT3pJQSW8szzMwqhenmhZfURbgykb7N5WMUVSTFIC7KoDpU6c4A7n0GvClHO8QQfNyma65gtVhAhvO0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559039683; 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=ee0663FOIJM9RwZSEFPZGcQ8dmvKMxjWmej2vqu8F5I=; b=KDto5bZL8TZsC7SduwmAXYP1QFGyBy3GXj3GXLxDB5AuMXydylQ49klMKL1YveDEnXdx/DNX6qVCkkOnhos9Gc202BU1wN8MCJfxx6oyp+9qssDGpfM4F9ukeIYBlgIU9k1bUlGzf4oRUj8M6KulNE83+ApGCIjxW5j8/Ec3KQY= 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 1559039683491610.3447135536171; Tue, 28 May 2019 03:34:43 -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 1hVZQC-0004ok-A6; Tue, 28 May 2019 10:33:32 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hVZQ6-0004dW-I9 for xen-devel@lists.xenproject.org; Tue, 28 May 2019 10:33:26 +0000 Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 05dc0bd3-8134-11e9-8980-bc764e045a96; Tue, 28 May 2019 10:33:25 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id B7AF8B04F; Tue, 28 May 2019 10:33:23 +0000 (UTC) X-Inumbo-ID: 05dc0bd3-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:32:41 +0200 Message-Id: <20190528103313.1343-29-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 28/60] xen/sched: switch schedule() from vcpus to sched_units 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" Use sched_units instead of vcpus in schedule(). This includes the introduction of sched_unit_runstate_change() as a replacement of vcpu_runstate_change() in schedule(). Signed-off-by: Juergen Gross --- xen/common/schedule.c | 70 +++++++++++++++++++++++++++++------------------= ---- 1 file changed, 40 insertions(+), 30 deletions(-) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 2c1ba32d83..11d1b73bfc 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -192,6 +192,20 @@ static inline void vcpu_runstate_change( v->runstate.state =3D new_state; } =20 +static inline void sched_unit_runstate_change(struct sched_unit *unit, + bool running, s_time_t new_entry_time) +{ + struct vcpu *v =3D unit->vcpu; + + if ( running ) + vcpu_runstate_change(v, RUNSTATE_running, new_entry_time); + else + vcpu_runstate_change(v, + ((v->pause_flags & VPF_blocked) ? RUNSTATE_blocked : + (vcpu_runnable(v) ? RUNSTATE_runnable : RUNSTATE_offline)), + new_entry_time); +} + void vcpu_runstate_get(struct vcpu *v, struct vcpu_runstate_info *runstate) { spinlock_t *lock =3D likely(v =3D=3D current) @@ -1531,7 +1545,7 @@ static void vcpu_periodic_timer_work(struct vcpu *v) */ static void schedule(void) { - struct vcpu *prev =3D current, *next =3D NULL; + struct sched_unit *prev =3D current->sched_unit, *next =3D NULL; s_time_t now; struct scheduler *sched; unsigned long *tasklet_work =3D &this_cpu(tasklet_work_to_do); @@ -1575,9 +1589,9 @@ static void schedule(void) sched =3D this_cpu(scheduler); next_slice =3D sched->do_schedule(sched, now, tasklet_work_scheduled); =20 - next =3D next_slice.task->vcpu; + next =3D next_slice.task; =20 - sd->curr =3D next->sched_unit; + sd->curr =3D next; =20 if ( next_slice.time >=3D 0 ) /* -ve means no limit */ set_timer(&sd->s_timer, now + next_slice.time); @@ -1586,60 +1600,56 @@ static void schedule(void) { pcpu_schedule_unlock_irq(lock, cpu); TRACE_4D(TRC_SCHED_SWITCH_INFCONT, - next->domain->domain_id, next->vcpu_id, - now - prev->runstate.state_entry_time, + next->domain->domain_id, next->unit_id, + now - prev->state_entry_time, next_slice.time); - trace_continue_running(next); - return continue_running(prev); + trace_continue_running(next->vcpu); + return continue_running(prev->vcpu); } =20 TRACE_3D(TRC_SCHED_SWITCH_INFPREV, - prev->domain->domain_id, prev->vcpu_id, - now - prev->runstate.state_entry_time); + prev->domain->domain_id, prev->unit_id, + now - prev->state_entry_time); TRACE_4D(TRC_SCHED_SWITCH_INFNEXT, - next->domain->domain_id, next->vcpu_id, - (next->runstate.state =3D=3D RUNSTATE_runnable) ? - (now - next->runstate.state_entry_time) : 0, + next->domain->domain_id, next->unit_id, + (next->vcpu->runstate.state =3D=3D RUNSTATE_runnable) ? + (now - next->state_entry_time) : 0, next_slice.time); =20 - ASSERT(prev->runstate.state =3D=3D RUNSTATE_running); + ASSERT(prev->vcpu->runstate.state =3D=3D RUNSTATE_running); =20 TRACE_4D(TRC_SCHED_SWITCH, - prev->domain->domain_id, prev->vcpu_id, - next->domain->domain_id, next->vcpu_id); + prev->domain->domain_id, prev->unit_id, + next->domain->domain_id, next->unit_id); =20 - vcpu_runstate_change( - prev, - ((prev->pause_flags & VPF_blocked) ? RUNSTATE_blocked : - (vcpu_runnable(prev) ? RUNSTATE_runnable : RUNSTATE_offline)), - now); - prev->sched_unit->last_run_time =3D now; + sched_unit_runstate_change(prev, false, now); + prev->last_run_time =3D now; =20 - ASSERT(next->runstate.state !=3D RUNSTATE_running); - vcpu_runstate_change(next, RUNSTATE_running, now); + ASSERT(next->vcpu->runstate.state !=3D RUNSTATE_running); + sched_unit_runstate_change(next, true, now); =20 /* * NB. Don't add any trace records from here until the actual context * switch, else lost_records resume will not work properly. */ =20 - ASSERT(!next->sched_unit->is_running); + ASSERT(!next->is_running); + next->vcpu->is_running =3D 1; next->is_running =3D 1; - next->sched_unit->is_running =3D 1; - next->sched_unit->state_entry_time =3D now; + next->state_entry_time =3D now; =20 pcpu_schedule_unlock_irq(lock, cpu); =20 SCHED_STAT_CRANK(sched_ctx); =20 - stop_timer(&prev->periodic_timer); + stop_timer(&prev->vcpu->periodic_timer); =20 if ( next_slice.migrated ) - sched_move_irqs(next); + sched_move_irqs(next->vcpu); =20 - vcpu_periodic_timer_work(next); + vcpu_periodic_timer_work(next->vcpu); =20 - context_switch(prev, next); + context_switch(prev->vcpu, next->vcpu); } =20 void context_saved(struct vcpu *prev) --=20 2.16.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel