Skip to content

Commit

Permalink
Revert "Hotplug: Control Max Active CPU Cores with sysfs node"
Browse files Browse the repository at this point in the history
This reverts commit d58834c.
  • Loading branch information
ananjaser1211 committed Jan 7, 2024
1 parent f04ad2f commit 430c6b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 154 deletions.
138 changes: 8 additions & 130 deletions drivers/cpufreq/dm_cpu_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include <linux/sort.h>
#include <linux/reboot.h>
#include <linux/debugfs.h>
#include <linux/sysfs.h>
#include <linux/exynos-interface.h>

#include <linux/fs.h>
#include <asm/segment.h>
Expand All @@ -36,12 +34,6 @@
#define POLLING_MSEC 100
#define DEFAULT_LOW_STAY_THRSHD 0

#define MIN_NUM_ONLINE_CPU 1
#define MAX_NUM_ONLINE_CPU NR_CPUS

unsigned int min_num_cpu;
unsigned int max_num_cpu;

struct cpu_load_info {
cputime64_t cpu_idle;
cputime64_t cpu_iowait;
Expand Down Expand Up @@ -327,91 +319,6 @@ static ssize_t store_dm_hotplug_delay(struct kobject *kobj, struct attribute *at
return count;
}

static ssize_t show_cpucore_table(struct kobject *kobj,
struct attribute *attr, char *buf)
{
int i, num_cpu, count = 0;

num_cpu = num_online_cpus();
for (i = num_cpu; i > 0; i--)
count += sprintf(&buf[count], "%d ", i);

count += sprintf(&buf[count], "\n");
return count;
}

static ssize_t show_cpucore_min_num_limit(struct kobject *kobj,
struct attribute *attr, char *buf)
{
return sprintf(buf, "%d\n", min_num_cpu);
}

static ssize_t show_cpucore_max_num_limit(struct kobject *kobj,
struct attribute *attr, char *buf)
{
return sprintf(buf, "%d\n", max_num_cpu);
}

static ssize_t store_cpucore_min_num_limit(struct kobject *kobj,
struct attribute *attr, const char *buf, size_t count)
{
int input;

if (!sscanf(buf, "%u", &input))
return -EINVAL;

if (input < 0 || input > 7) {
pr_err("Must keep input range 0 ~ 7\n");
return -EINVAL;
}

pr_info("Not yet supported\n");

min_num_cpu = input;

return count;
}

static ssize_t __ref store_cpucore_max_num_limit(struct kobject *kobj,
struct attribute *attr, const char *buf, size_t count)
{
int input, delta, cpu;

if (!sscanf(buf, "%u", &input))
return -EINVAL;

if (input < 1 || input > 8) {
pr_err("Must keep input range 1 ~ 8\n");
return -EINVAL;
}

delta = input - num_online_cpus();

if (delta > 0) {
cpu = 1;
while (delta) {
if (!cpu_online(cpu)) {
cpu_up(cpu);
delta--;
}
cpu++;
}
} else if (delta < 0) {
cpu = 7;
while (delta) {
if (cpu_online(cpu)) {
cpu_down(cpu);
delta++;
}
cpu--;
}
}

max_num_cpu = input;

return count;
}

static struct global_attr enable_dm_hotplug =
__ATTR(enable_dm_hotplug, S_IRUGO | S_IWUSR,
show_enable_dm_hotplug, store_enable_dm_hotplug);
Expand All @@ -433,20 +340,6 @@ static struct global_attr dm_hotplug_stay_threshold =
static struct global_attr dm_hotplug_delay =
__ATTR(dm_hotplug_delay, S_IRUGO | S_IWUSR,
show_dm_hotplug_delay, store_dm_hotplug_delay);

static struct sysfs_attr cpucore_table =
__ATTR(cpucore_table, S_IRUGO,
show_cpucore_table, NULL);

static struct sysfs_attr cpucore_min_num_limit =
__ATTR(cpucore_min_num_limit, S_IRUGO | S_IWUSR,
show_cpucore_min_num_limit,
store_cpucore_min_num_limit);

static struct sysfs_attr cpucore_max_num_limit =
__ATTR(cpucore_max_num_limit, S_IRUGO | S_IWUSR,
show_cpucore_max_num_limit,
store_cpucore_max_num_limit);
#endif

static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall)
Expand Down Expand Up @@ -582,7 +475,7 @@ static int __ref __cpu_hotplug(bool out_flag, enum hotplug_cmd cmd)
}
}
}else if (cmd == CMD_BIG_OUT && !in_low_power_mode) {
for (i = max_num_cpu - 1; i >= NR_CA7; i--) {
for (i = setup_max_cpus - 1; i >= NR_CA7; i--) {
if (cpu_online(i)) {
ret = cpu_down(i);
if (ret)
Expand All @@ -605,7 +498,7 @@ static int __ref __cpu_hotplug(bool out_flag, enum hotplug_cmd cmd)
if (little_hotplug_in)
hotplug_out_limit = NR_CA7 - 2;

for (i = max_num_cpu - 1; i > hotplug_out_limit; i--) {
for (i = setup_max_cpus - 1; i > hotplug_out_limit; i--) {
if (cpu_online(i)) {
ret = cpu_down(i);
if (ret)
Expand All @@ -622,7 +515,7 @@ static int __ref __cpu_hotplug(bool out_flag, enum hotplug_cmd cmd)
if (in_low_power_mode)
goto blk_out;

for (i = NR_CA7; i < max_num_cpu; i++) {
for (i = NR_CA7; i < setup_max_cpus; i++) {
if (!cpu_online(i)) {
ret = cpu_up(i);
if (ret)
Expand All @@ -649,7 +542,7 @@ static int __ref __cpu_hotplug(bool out_flag, enum hotplug_cmd cmd)
}
} else {
if (lcd_is_on) {
for (i = NR_CA7; i < max_num_cpu; i++) {
for (i = NR_CA7; i < setup_max_cpus; i++) {
if (do_hotplug_out)
goto blk_out;

Expand All @@ -671,7 +564,7 @@ static int __ref __cpu_hotplug(bool out_flag, enum hotplug_cmd cmd)
}
}
} else {
for (i = 1; i < max_num_cpu; i++) {
for (i = 1; i < setup_max_cpus; i++) {
if (do_hotplug_out && i >= NR_CA7)
goto blk_out;

Expand All @@ -690,7 +583,7 @@ static int __ref __cpu_hotplug(bool out_flag, enum hotplug_cmd cmd)
if (do_disable_hotplug)
goto blk_out;

for (i = max_num_cpu - 1; i > 0; i--) {
for (i = setup_max_cpus - 1; i > 0; i--) {
if (cpu_online(i)) {
ret = cpu_down(i);
if (ret)
Expand All @@ -701,7 +594,7 @@ static int __ref __cpu_hotplug(bool out_flag, enum hotplug_cmd cmd)
if (in_suspend_prepared)
goto blk_out;

for (i = 1; i < max_num_cpu; i++) {
for (i = 1; i < setup_max_cpus; i++) {
if (!cpu_online(i)) {
ret = cpu_up(i);
if (ret)
Expand Down Expand Up @@ -1203,8 +1096,6 @@ const static struct file_operations cputime_fops = {
static int __init dm_cpu_hotplug_init(void)
{
int ret = 0;
min_num_cpu = 0;
max_num_cpu = NR_CPUS;
#ifdef CONFIG_ARM_EXYNOS_MP_CPUFREQ
struct cpufreq_policy *policy;
#endif
Expand Down Expand Up @@ -1255,18 +1146,7 @@ static int __init dm_cpu_hotplug_init(void)
__func__);
goto err_dm_hotplug_delay;
}
ret = sysfs_create_file(power_kobj, &cpucore_table.attr);
if (ret)
goto err;

ret = sysfs_create_file(power_kobj, &cpucore_min_num_limit.attr);
if (ret)
goto err;

ret = sysfs_create_file(power_kobj, &cpucore_max_num_limit.attr);
if (ret)
goto err;
#endif
#endif

#ifdef CONFIG_ARM_EXYNOS_MP_CPUFREQ
policy = cpufreq_cpu_get(NR_CA7);
Expand Down Expand Up @@ -1329,8 +1209,6 @@ static int __init dm_cpu_hotplug_init(void)
sysfs_remove_file(power_kobj, &enable_dm_hotplug.attr);
err_enable_dm_hotplug:
#endif
err:
pr_err("%s: failed to create sysfs interface\n", __func__);
fb_unregister_client(&fb_block);
kthread_stop(dm_hotplug_task);

Expand Down
24 changes: 0 additions & 24 deletions include/linux/exynos-interface.h

This file was deleted.

0 comments on commit 430c6b6

Please sign in to comment.