ia64/linux-2.6.18-xen.hg

changeset 772:79e82ae1bad0

evtchn: Fix CPU offlining to switch all affected ports belonging to a
particular /dev/evcthn user.

Original patch by James Harper <james.harper@bendigoit.com.au>

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Jan 05 11:29:42 2009 +0000 (2009-01-05)
parents cfb171ddbb33
children 28acedb66302
files drivers/xen/evtchn/evtchn.c
line diff
     1.1 --- a/drivers/xen/evtchn/evtchn.c	Mon Jan 05 10:54:36 2009 +0000
     1.2 +++ b/drivers/xen/evtchn/evtchn.c	Mon Jan 05 11:29:42 2009 +0000
     1.3 @@ -497,20 +497,22 @@ static int __cpuinit evtchn_cpu_notify(s
     1.4  {
     1.5  	int hotcpu = (unsigned long)hcpu;
     1.6  	cpumask_t map = cpu_online_map;
     1.7 -	int port, newcpu;
     1.8 +	int i, j, newcpu;
     1.9  	struct per_user_data *u;
    1.10  
    1.11  	switch (action) {
    1.12  	case CPU_DOWN_PREPARE:
    1.13  		cpu_clear(hotcpu, map);
    1.14  		spin_lock_irq(&port_user_lock);
    1.15 -		for (port = 0; port < NR_EVENT_CHANNELS; port++) {
    1.16 -			if ((u = port_user[port]) != NULL && 
    1.17 -			    u->bind_cpu == hotcpu &&
    1.18 -			    (newcpu = next_bind_cpu(map)) < NR_CPUS) {
    1.19 -				rebind_evtchn_to_cpu(port, newcpu);
    1.20 -				u->bind_cpu = newcpu;
    1.21 -			}
    1.22 +		for (i = 0; i < NR_EVENT_CHANNELS; i++) {
    1.23 +			u = port_user[i];
    1.24 +			if ((u == NULL) || (u->bind_cpu != hotcpu))
    1.25 +				continue;
    1.26 +			newcpu = next_bind_cpu(map);
    1.27 +			for (j = i; j < NR_EVENT_CHANNELS; j++)
    1.28 +				if (port_user[j] == u)
    1.29 +					rebind_evtchn_to_cpu(j, newcpu);
    1.30 +			u->bind_cpu = newcpu;
    1.31  		}
    1.32  		spin_unlock_irq(&port_user_lock);
    1.33  		break;