[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 4/9] xen: sched: add .init_pdata hook to the scheduler interface
On Thu, 2015-10-01 at 07:21 +0200, Juergen Gross wrote: > On 09/29/2015 06:55 PM, Dario Faggioli wrote: > > --- a/xen/common/schedule.c > > +++ b/xen/common/schedule.c > > @@ -1407,6 +1407,9 @@ static int cpu_schedule_callback( > > > > switch ( action ) > > { > > + case CPU_STARTING: > > + SCHED_OP(&ops, init_pdata, cpu); > > + break; > > case CPU_UP_PREPARE: > > rc = cpu_schedule_up(cpu); > > break; > > @@ -1484,6 +1487,7 @@ void __init scheduler_init(void) > > if ( ops.alloc_pdata && > > !(this_cpu(schedule_data).sched_priv = > > ops.alloc_pdata(&ops, 0)) ) > > BUG(); > > + SCHED_OP(&ops, init_pdata, 0); > > You can't call this without having it set in all schedulers. > > I guess using the init_pdata hook has to be introduced after or in > patch 5. > But, if it is not set, it is NULL, in which case, SCHED_OP does the trick for me, doesn't it? #define SCHED_OP(opsptr, fn, ...) \ (( (opsptr)->fn != NULL ) ? (opsptr)->fn(opsptr, ##__VA_ARGS__ ) \ : (typeof((opsptr)->fn(opsptr, ##__VA_ARGS__)))0 ) AFAICT, the cases where we want to be absolutely sure whether the hook "exists" is when we care about its return value, especially if it may return NULL to report an error (like, for instance, alloc_pdata()), as that would make it impossible to distinguish between "hook not there" and "hook failed". All other cases, should be fine handled like this. Thanks and Regards, Dario -- <<This happens because I choose it to happen!>> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) Attachment:
signature.asc _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |