[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] core-parking: use alternative_call()
commit 1bc07ebcac3b1bb2a378732bc0f9a19940e76faf Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Mon Jan 22 13:38:24 2024 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Mon Jan 22 13:38:24 2024 +0100 core-parking: use alternative_call() This way we can arrange for core_parking_{performance,power}()'s ENDBR to also be zapped. For the decision to be taken before the 2nd alternative patching pass, the initcall needs to become a pre-SMP one, though. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- xen/common/core_parking.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/xen/common/core_parking.c b/xen/common/core_parking.c index c4f01291c0..a970ffeab8 100644 --- a/xen/common/core_parking.c +++ b/xen/common/core_parking.c @@ -30,10 +30,11 @@ static DEFINE_SPINLOCK(accounting_lock); static uint32_t cur_idle_nums; static unsigned int core_parking_cpunum[NR_CPUS] = {[0 ... NR_CPUS-1] = -1}; -static const struct cp_policy { +struct cp_policy { char name[30]; unsigned int (*next)(unsigned int event); -} *__read_mostly core_parking_policy; +}; +static struct cp_policy __ro_after_init core_parking_policy; static enum core_parking_controller { POWER_FIRST, @@ -175,12 +176,13 @@ long cf_check core_parking_helper(void *data) unsigned int cpu; int ret = 0; - if ( !core_parking_policy ) + if ( !core_parking_policy.next ) return -EINVAL; while ( cur_idle_nums < idle_nums ) { - cpu = core_parking_policy->next(CORE_PARKING_INCREMENT); + cpu = alternative_call(core_parking_policy.next, + CORE_PARKING_INCREMENT); ret = cpu_down(cpu); if ( ret ) return ret; @@ -193,7 +195,8 @@ long cf_check core_parking_helper(void *data) while ( cur_idle_nums > idle_nums ) { - cpu = core_parking_policy->next(CORE_PARKING_DECREMENT); + cpu = alternative_call(core_parking_policy.next, + CORE_PARKING_DECREMENT); ret = cpu_up(cpu); if ( ret ) return ret; @@ -239,12 +242,12 @@ uint32_t get_cur_idle_nums(void) return cur_idle_nums; } -static const struct cp_policy power_first = { +static const struct cp_policy __initconst_cf_clobber power_first = { .name = "power", .next = core_parking_power, }; -static const struct cp_policy performance_first = { +static const struct cp_policy __initconst_cf_clobber performance_first = { .name = "performance", .next = core_parking_performance, }; @@ -254,7 +257,7 @@ static int __init register_core_parking_policy(const struct cp_policy *policy) if ( !policy || !policy->next ) return -EINVAL; - core_parking_policy = policy; + core_parking_policy = *policy; return 0; } @@ -269,4 +272,4 @@ static int __init cf_check core_parking_init(void) return ret; } -__initcall(core_parking_init); +presmp_initcall(core_parking_init); -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |