From 2d328380d92563d779c75384749bef140c005367 Mon Sep 17 00:00:00 2001 From: Pavankumar Kondeti Date: Tue, 21 Mar 2017 14:00:09 +0530 Subject: [PATCH 1/3] core_ctl: Add a kernel parameter to disable core_ctl Add a kernel parameter called "core_ctl_disable_cpumask" to specify the CPUs for which core_ctl is not needed. As core_ctl operates on a cluster basis, all of the CPUs in a given cluster must be specified to disable core_ctl on that cluster. Change-Id: Idfdc5b3aa9f54bafe20489e5ded9d96da6eff21c Signed-off-by: Pavankumar Kondeti --- Documentation/kernel-parameters.txt | 6 +++++ kernel/sched/core_ctl.c | 42 +++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 45d680644dfe..7d6fef1aa136 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -750,6 +750,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted. seconds. Defaults to 10*60 = 10mins. A value of 0 disables the blank timer. + core_ctl_disable_cpumask= [SMP] + Exempt the CPUs from being managed by core_ctl. + core_ctl operates on a cluster basis. So all the + CPUs in a given cluster must be specified to disable + core_ctl for that cluster. + coredump_filter= [KNL] Change the default value for /proc//coredump_filter. diff --git a/kernel/sched/core_ctl.c b/kernel/sched/core_ctl.c index 983159cc0646..a904c18704de 100644 --- a/kernel/sched/core_ctl.c +++ b/kernel/sched/core_ctl.c @@ -931,6 +931,42 @@ static struct notifier_block __refdata cpu_notifier = { /* ============================ init code ============================== */ +static cpumask_var_t core_ctl_disable_cpumask; +static bool core_ctl_disable_cpumask_present; + +static int __init core_ctl_disable_setup(char *str) +{ + if (!*str) + return -EINVAL; + + alloc_bootmem_cpumask_var(&core_ctl_disable_cpumask); + + if (cpulist_parse(str, core_ctl_disable_cpumask) < 0) { + free_bootmem_cpumask_var(core_ctl_disable_cpumask); + return -EINVAL; + } + + core_ctl_disable_cpumask_present = true; + pr_info("disable_cpumask=%*pbl\n", + cpumask_pr_args(core_ctl_disable_cpumask)); + + return 0; +} +early_param("core_ctl_disable_cpumask", core_ctl_disable_setup); + +static bool should_skip(const struct cpumask *mask) +{ + if (!core_ctl_disable_cpumask_present) + return false; + + /* + * We operate on a cluster basis. Disable the core_ctl for + * a cluster, if all of it's cpus are specified in + * core_ctl_disable_cpumask + */ + return cpumask_subset(mask, core_ctl_disable_cpumask); +} + static struct cluster_data *find_cluster_by_first_cpu(unsigned int first_cpu) { unsigned int i; @@ -952,6 +988,9 @@ static int cluster_init(const struct cpumask *mask) unsigned int cpu; struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 }; + if (should_skip(mask)) + return 0; + if (find_cluster_by_first_cpu(first_cpu)) return 0; @@ -1052,6 +1091,9 @@ static int __init core_ctl_init(void) { unsigned int cpu; + if (should_skip(cpu_possible_mask)) + return 0; + core_ctl_check_interval = (rq_avg_period_ms - RQ_AVG_TOLERANCE) * NSEC_PER_MSEC; From 2ab7675364d7510b1e0f8cd43b1aca6d12dafa08 Mon Sep 17 00:00:00 2001 From: Pavankumar Kondeti Date: Tue, 21 Mar 2017 14:21:21 +0530 Subject: [PATCH 2/3] core_ctl: Bail out early from the boost API when core_ctl is disabled core_ctl can be completely disabled from a kernel parameter now. Add a check to bail out early from the boost API. Change-Id: Ib825500b0cb2c06af2cfcb82e5d79f91e9dd7b3b Signed-off-by: Pavankumar Kondeti --- kernel/sched/core_ctl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/sched/core_ctl.c b/kernel/sched/core_ctl.c index a904c18704de..1dde338d30f2 100644 --- a/kernel/sched/core_ctl.c +++ b/kernel/sched/core_ctl.c @@ -653,6 +653,9 @@ int core_ctl_set_boost(bool boost) int ret = 0; bool boost_state_changed = false; + if (unlikely(!initialized)) + return 0; + spin_lock_irqsave(&state_lock, flags); for_each_cluster(cluster, index) { if (cluster->is_big_cluster) { From 16aa0854d5f7522efa1be565ab166e799031319a Mon Sep 17 00:00:00 2001 From: Pavankumar Kondeti Date: Tue, 21 Mar 2017 14:27:50 +0530 Subject: [PATCH 3/3] ARM: dts: msm: disable core_ctl for SDM630 core_ctl is needed for SDM660 but not for SDM630. Both targets share the same defconfig. So it can not be compiled out. Use core_ctl_disable_cpumask kernel parameter to disable core_ctl for SDM630. Change-Id: I35883ac6c03d13268d351fdc707a54cec8569ed3 Signed-off-by: Pavankumar Kondeti --- arch/arm/boot/dts/qcom/sdm630.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/qcom/sdm630.dtsi b/arch/arm/boot/dts/qcom/sdm630.dtsi index 623ca54de94b..5a7b4943db9d 100644 --- a/arch/arm/boot/dts/qcom/sdm630.dtsi +++ b/arch/arm/boot/dts/qcom/sdm630.dtsi @@ -34,7 +34,7 @@ chosen { stdout-path = "serial0"; - bootargs = "rcupdate.rcu_expedited=1"; + bootargs = "rcupdate.rcu_expedited=1 core_ctl_disable_cpumask=0-7"; }; psci {