[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] schedulers: validate / correct global data just once
Also mark command line parsing routine __init. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> --- For credit2 I'm not sure the relatively verbose logging of all parameters should really happen upon every initialization. Otoh emitting it at boot time when the scheduler isn't actually used may also be confusing. --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -2156,6 +2156,36 @@ csched_dump(const struct scheduler *ops) spin_unlock_irqrestore(&prv->lock, flags); } +static int __init +csched_global_init(void) +{ + if ( sched_credit_tslice_ms > XEN_SYSCTL_CSCHED_TSLICE_MAX + || sched_credit_tslice_ms < XEN_SYSCTL_CSCHED_TSLICE_MIN ) + { + printk("WARNING: sched_credit_tslice_ms outside of valid range [%d,%d].\n" + " Resetting to default %u\n", + XEN_SYSCTL_CSCHED_TSLICE_MIN, + XEN_SYSCTL_CSCHED_TSLICE_MAX, + CSCHED_DEFAULT_TSLICE_MS); + sched_credit_tslice_ms = CSCHED_DEFAULT_TSLICE_MS; + } + + if ( MICROSECS(sched_ratelimit_us) > MILLISECS(sched_credit_tslice_ms) ) + printk("WARNING: sched_ratelimit_us >" + "sched_credit_tslice_ms is undefined\n" + "Setting ratelimit to tslice\n"); + + if ( vcpu_migration_delay_us > XEN_SYSCTL_CSCHED_MGR_DLY_MAX_US ) + { + vcpu_migration_delay_us = 0; + printk("WARNING: vcpu_migration_delay outside of valid range [0,%d]us.\n" + "Resetting to default: %u\n", + XEN_SYSCTL_CSCHED_MGR_DLY_MAX_US, vcpu_migration_delay_us); + } + + return 0; +} + static int csched_init(struct scheduler *ops) { @@ -2186,36 +2216,13 @@ csched_init(struct scheduler *ops) INIT_LIST_HEAD(&prv->active_sdom); prv->master = UINT_MAX; - if ( sched_credit_tslice_ms > XEN_SYSCTL_CSCHED_TSLICE_MAX - || sched_credit_tslice_ms < XEN_SYSCTL_CSCHED_TSLICE_MIN ) - { - printk("WARNING: sched_credit_tslice_ms outside of valid range [%d,%d].\n" - " Resetting to default %u\n", - XEN_SYSCTL_CSCHED_TSLICE_MIN, - XEN_SYSCTL_CSCHED_TSLICE_MAX, - CSCHED_DEFAULT_TSLICE_MS); - sched_credit_tslice_ms = CSCHED_DEFAULT_TSLICE_MS; - } - __csched_set_tslice(prv, sched_credit_tslice_ms); if ( MICROSECS(sched_ratelimit_us) > MILLISECS(sched_credit_tslice_ms) ) - { - printk("WARNING: sched_ratelimit_us >" - "sched_credit_tslice_ms is undefined\n" - "Setting ratelimit to tslice\n"); prv->ratelimit = prv->tslice; - } else prv->ratelimit = MICROSECS(sched_ratelimit_us); - if ( vcpu_migration_delay_us > XEN_SYSCTL_CSCHED_MGR_DLY_MAX_US ) - { - vcpu_migration_delay_us = 0; - printk("WARNING: vcpu_migration_delay outside of valid range [0,%d]us.\n" - "Resetting to default: %u\n", - XEN_SYSCTL_CSCHED_MGR_DLY_MAX_US, vcpu_migration_delay_us); - } prv->vcpu_migr_delay = MICROSECS(vcpu_migration_delay_us); return 0; @@ -2266,6 +2273,8 @@ static const struct scheduler sched_cred .sched_id = XEN_SCHEDULER_CREDIT, .sched_data = NULL, + .global_init = csched_global_init, + .insert_vcpu = csched_vcpu_insert, .remove_vcpu = csched_vcpu_remove, --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -448,7 +448,7 @@ static const char *const opt_runqueue_st }; static int __read_mostly opt_runqueue = OPT_RUNQUEUE_SOCKET; -static int parse_credit2_runqueue(const char *s) +static int __init parse_credit2_runqueue(const char *s) { unsigned int i; @@ -3937,6 +3937,33 @@ csched2_deinit_pdata(const struct schedu return; } +static int __init +csched2_global_init(void) +{ + if ( opt_load_precision_shift < LOADAVG_PRECISION_SHIFT_MIN ) + { + printk("WARNING: %s: opt_load_precision_shift %u below min %d, resetting\n", + __func__, opt_load_precision_shift, LOADAVG_PRECISION_SHIFT_MIN); + opt_load_precision_shift = LOADAVG_PRECISION_SHIFT_MIN; + } + + if ( opt_load_window_shift <= LOADAVG_GRANULARITY_SHIFT ) + { + printk("WARNING: %s: opt_load_window_shift %u too short, resetting\n", + __func__, opt_load_window_shift); + opt_load_window_shift = LOADAVG_WINDOW_SHIFT; + } + + if ( CSCHED2_BDGT_REPL_PERIOD < CSCHED2_MIN_TIMER ) + { + printk("WARNING: %s: opt_cap_period %u too small, resetting\n", + __func__, opt_cap_period); + opt_cap_period = 10; /* ms */ + } + + return 0; +} + static int csched2_init(struct scheduler *ops) { @@ -3958,29 +3985,9 @@ csched2_init(struct scheduler *ops) opt_runqueue_str[opt_runqueue], opt_cap_period); - if ( opt_load_precision_shift < LOADAVG_PRECISION_SHIFT_MIN ) - { - printk("WARNING: %s: opt_load_precision_shift %d below min %d, resetting\n", - __func__, opt_load_precision_shift, LOADAVG_PRECISION_SHIFT_MIN); - opt_load_precision_shift = LOADAVG_PRECISION_SHIFT_MIN; - } - - if ( opt_load_window_shift <= LOADAVG_GRANULARITY_SHIFT ) - { - printk("WARNING: %s: opt_load_window_shift %d too short, resetting\n", - __func__, opt_load_window_shift); - opt_load_window_shift = LOADAVG_WINDOW_SHIFT; - } printk(XENLOG_INFO "load tracking window length %llu ns\n", 1ULL << opt_load_window_shift); - if ( CSCHED2_BDGT_REPL_PERIOD < CSCHED2_MIN_TIMER ) - { - printk("WARNING: %s: opt_cap_period %d too small, resetting\n", - __func__, opt_cap_period); - opt_cap_period = 10; /* ms */ - } - /* * Basically no CPU information is available at this point; just * set up basic structures, and a callback when the CPU info is @@ -4031,6 +4038,8 @@ static const struct scheduler sched_cred .sched_id = XEN_SCHEDULER_CREDIT2, .sched_data = NULL, + .global_init = csched2_global_init, + .insert_vcpu = csched2_vcpu_insert, .remove_vcpu = csched2_vcpu_remove, _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |