From: Juergen Gross Subject: [PATCH] Avoid panic when adjusting sedf parameters Date: Thu, 17 Nov 2011 14:03:42 +0100 Message-ID: <8eea2b53adb207b8ab92.1321535022@nehalem1> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2267812866842333141==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============2267812866842333141== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit When using sedf scheduler in a cpupool the system might panic when setting sedf scheduling parameters for a domain. Introduces for_each_domain_in_cpupool macro as it is usable 4 times now. Signed-off-by: juergen.gross@ts.fujitsu.com 4 files changed, 12 insertions(+), 11 deletions(-) xen/common/cpupool.c | 4 +--- xen/common/sched_sedf.c | 8 ++++---- xen/common/schedule.c | 5 +---- xen/include/xen/sched.h | 6 ++++++ --===============2267812866842333141== Content-Type: text/x-patch; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=xen-staging.hg.patch # HG changeset patch # User Juergen Gross # Date 1321534918 -3600 # Node ID 8eea2b53adb207b8ab92148c8248b60831639e52 # Parent dbdc840f8f62db58321b5009e5e0f7833066386f Avoid panic when adjusting sedf parameters When using sedf scheduler in a cpupool the system might panic when setting sedf scheduling parameters for a domain. Introduces for_each_domain_in_cpupool macro as it is usable 4 times now. Signed-off-by: juergen.gross@ts.fujitsu.com diff -r dbdc840f8f62 -r 8eea2b53adb2 xen/common/cpupool.c --- a/xen/common/cpupool.c Wed Nov 16 18:21:14 2011 +0000 +++ b/xen/common/cpupool.c Thu Nov 17 14:01:58 2011 +0100 @@ -309,10 +309,8 @@ int cpupool_unassign_cpu(struct cpupool if ( (c->n_dom > 0) && (cpumask_weight(c->cpu_valid) == 1) && (cpu != cpupool_moving_cpu) ) { - for_each_domain(d) + for_each_domain_in_cpupool(d, c) { - if ( d->cpupool != c ) - continue; if ( !d->is_dying ) { ret = -EBUSY; diff -r dbdc840f8f62 -r 8eea2b53adb2 xen/common/sched_sedf.c --- a/xen/common/sched_sedf.c Wed Nov 16 18:21:14 2011 +0000 +++ b/xen/common/sched_sedf.c Thu Nov 17 14:01:58 2011 +0100 @@ -1304,6 +1304,8 @@ static void sedf_dump_cpu_state(const st rcu_read_lock(&domlist_read_lock); for_each_domain ( d ) { + if ( (d->cpupool ? d->cpupool->sched : &sched_sedf_def) != ops ) + continue; for_each_vcpu(d, ed) { if ( !__task_on_queue(ed) && (ed->processor == i) ) @@ -1335,10 +1337,8 @@ static int sedf_adjust_weights(struct cp /* Sum across all weights. */ rcu_read_lock(&domlist_read_lock); - for_each_domain( d ) + for_each_domain_in_cpupool( d, c ) { - if ( c != d->cpupool ) - continue; for_each_vcpu( d, p ) { if ( (cpu = p->processor) >= nr_cpus ) @@ -1367,7 +1367,7 @@ static int sedf_adjust_weights(struct cp /* Adjust all slices (and periods) to the new weight. */ rcu_read_lock(&domlist_read_lock); - for_each_domain( d ) + for_each_domain_in_cpupool( d, c ) { for_each_vcpu ( d, p ) { diff -r dbdc840f8f62 -r 8eea2b53adb2 xen/common/schedule.c --- a/xen/common/schedule.c Wed Nov 16 18:21:14 2011 +0000 +++ b/xen/common/schedule.c Thu Nov 17 14:01:58 2011 +0100 @@ -538,11 +538,8 @@ int cpu_disable_scheduler(unsigned int c if ( c == NULL ) return ret; - for_each_domain ( d ) + for_each_domain_in_cpupool ( d, c ) { - if ( d->cpupool != c ) - continue; - affinity_broken = 0; for_each_vcpu ( d, v ) diff -r dbdc840f8f62 -r 8eea2b53adb2 xen/include/xen/sched.h --- a/xen/include/xen/sched.h Wed Nov 16 18:21:14 2011 +0000 +++ b/xen/include/xen/sched.h Thu Nov 17 14:01:58 2011 +0100 @@ -569,6 +569,12 @@ extern struct domain *domain_list; (_d) != NULL; \ (_d) = rcu_dereference((_d)->next_in_list )) \ +#define for_each_domain_in_cpupool(_d,_c) \ + for ( (_d) = rcu_dereference(domain_list); \ + (_d) != NULL; \ + (_d) = rcu_dereference((_d)->next_in_list )) \ + if ((_d)->cpupool == (_c)) + #define for_each_vcpu(_d,_v) \ for ( (_v) = (_d)->vcpu ? (_d)->vcpu[0] : NULL; \ (_v) != NULL; \ --===============2267812866842333141== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============2267812866842333141==--