diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c index ad0a5d4..ac7a7f2 100644 --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -1918,7 +1918,8 @@ static void deactivate_runqueue(struct csched2_private *prv, int rqi) cpumask_clear_cpu(rqi, &prv->active_queues); } -static void init_pcpu(const struct scheduler *ops, int cpu) +static void * +csched2_alloc_pdata(const struct scheduler *ops, int cpu) { int rqi; unsigned long flags; @@ -1932,7 +1933,7 @@ static void init_pcpu(const struct scheduler *ops, int cpu) { printk("%s: Strange, cpu %d already initialized!\n", __func__, cpu); spin_unlock_irqrestore(&prv->lock, flags); - return; + return NULL; } /* Figure out which runqueue to put it in */ @@ -1980,20 +1981,6 @@ static void init_pcpu(const struct scheduler *ops, int cpu) spin_unlock_irqrestore(&prv->lock, flags); - return; -} - -static void * -csched2_alloc_pdata(const struct scheduler *ops, int cpu) -{ - /* Check to see if the cpu is online yet */ - /* Note: cpu 0 doesn't get a STARTING callback */ - if ( cpu == 0 || cpu_to_socket(cpu) >= 0 ) - init_pcpu(ops, cpu); - else - printk("%s: cpu %d not online yet, deferring initializatgion\n", - __func__, cpu); - return (void *)1; } @@ -2046,49 +2033,6 @@ csched2_free_pdata(const struct scheduler *ops, void *pcpu, int cpu) } static int -csched2_cpu_starting(int cpu) -{ - struct scheduler *ops; - - /* Hope this is safe from cpupools switching things around. :-) */ - ops = per_cpu(scheduler, cpu); - - if ( ops->alloc_pdata == csched2_alloc_pdata ) - init_pcpu(ops, cpu); - - return NOTIFY_DONE; -} - -static int cpu_credit2_callback( - struct notifier_block *nfb, unsigned long action, void *hcpu) -{ - unsigned int cpu = (unsigned long)hcpu; - int rc = 0; - - switch ( action ) - { - case CPU_STARTING: - csched2_cpu_starting(cpu); - break; - default: - break; - } - - return !rc ? NOTIFY_DONE : notifier_from_errno(rc); -} - -static struct notifier_block cpu_credit2_nfb = { - .notifier_call = cpu_credit2_callback -}; - -static int -csched2_global_init(void) -{ - register_cpu_notifier(&cpu_credit2_nfb); - return 0; -} - -static int csched2_init(struct scheduler *ops) { int i; @@ -2168,7 +2112,6 @@ const struct scheduler sched_credit2_def = { .dump_cpu_state = csched2_dump_pcpu, .dump_settings = csched2_dump, - .global_init = csched2_global_init, .init = csched2_init, .deinit = csched2_deinit, .alloc_vdata = csched2_alloc_vdata, diff --git a/xen/common/schedule.c b/xen/common/schedule.c index ef79847..5e7cdc9 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -1327,10 +1327,6 @@ static int cpu_schedule_up(unsigned int cpu) if ( idle_vcpu[cpu] == NULL ) return -ENOMEM; - if ( (ops.alloc_pdata != NULL) && - ((sd->sched_priv = ops.alloc_pdata(&ops, cpu)) == NULL) ) - return -ENOMEM; - return 0; } @@ -1348,10 +1344,16 @@ static int cpu_schedule_callback( struct notifier_block *nfb, unsigned long action, void *hcpu) { unsigned int cpu = (unsigned long)hcpu; + struct schedule_data *sd = &per_cpu(schedule_data, cpu); int rc = 0; switch ( action ) { + case CPU_STARTING: + if ( (ops.alloc_pdata != NULL) && + ((sd->sched_priv = ops.alloc_pdata(&ops, cpu)) == NULL) ) + return -ENOMEM; + break; case CPU_UP_PREPARE: rc = cpu_schedule_up(cpu); break;