[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 3/3] tools: sched: add support for 'null' scheduler
On 06/04/17 11:49, Dario Faggioli wrote: > On Mon, 2017-03-27 at 11:50 +0100, George Dunlap wrote: >> On 17/03/17 18:43, Dario Faggioli wrote: >>> --- a/tools/libxl/libxl_sched.c >>> +++ b/tools/libxl/libxl_sched.c >>> @@ -178,6 +178,20 @@ static int sched_arinc653_domain_set(libxl__gc >>> *gc, uint32_t domid, >>> return 0; >>> } >>> >>> +static int sched_null_domain_set(libxl__gc *gc, uint32_t domid, >>> + const libxl_domain_sched_params >>> *scinfo) >>> +{ >>> + /* The null scheduler doesn't take any domain-specific >>> parameters. */ >>> + return 0; >>> +} >>> + >>> +static int sched_null_domain_get(libxl__gc *gc, uint32_t domid, >>> + libxl_domain_sched_params *scinfo) >>> +{ >>> + /* The null scheduler doesn't have any domain-specific >>> parameters. */ >>> + return ERROR_INVAL; >>> +} >> >> Why the different return value? Why not return either INVAL or >> SUCCESS >> for both? >> > Because domain_set() is called by libxl_domain_sched_params_set(), > which is in turn called unconditionally within libxl__build_post(), > with the purpose of setting the scheduling parameters chosen by the > user during domain creation. > > If that fails (I've tried that), domain creation fails too. So either > it returns success, or we'd have to modify (at least) > liblx__build_post(), teaching it about acceptable failures. > > OTOH, we indeed could return success for domain_get() too, for the sake > of having the two above functions return the same. But I really think > that call should fail, as an indication to the callers that they won't > get the value of any parameter for this scheduler. I see. So if *our* code doesn't know that there aren't any parameters to set, that's OK; but if *other people's code doesn't know that there aren't any parameters to get, it needs to be changed to know that. Got it. ;-) There is a sort of mathematical logic to the idea that setting a null set of parameters should always succeed; and it's certainly convenient for tools to be able to always just call libxl_domain_sched_params_set() without having to check what scheduler is there. But the same logic I think applies to get(), so I would say to return 0 for both. But Wei and Ian have the final say. -George _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |