Skip to content

Commit 5fd1808

Browse files
committed
Merge branch 'pm-cpufreq' into linux-next
* pm-cpufreq: (22 commits) cpufreq: intel_pstate: Populate the cpu_capacity sysfs entries arch_topology: Relocate cpu_scale to topology.[h|c] cpufreq/sched: Move cpufreq-specific EAS checks to cpufreq cpufreq/sched: schedutil: Add helper for governor checks amd-pstate-ut: Reset amd-pstate driver mode after running selftests cpufreq/amd-pstate: Add support for the "Requested CPU Min frequency" BIOS option cpufreq/amd-pstate: Add offline, online and suspend callbacks for amd_pstate_driver cpufreq: Force sync policy boost with global boost on sysfs update cpufreq: Preserve policy's boost state after resume cpufreq: Introduce policy_set_boost() cpufreq: Don't unnecessarily call set_boost() cpufreq/amd-pstate: Move max_perf limiting in amd_pstate_update cpufreq: Drop unused cpufreq_get_policy() cpufreq: Pass policy pointer to ->update_limits() cpufreq: Introduce cpufreq_policy_refresh() cpufreq: Use __free() for policy reference counting cleanup cpufreq: Drop cpufreq_cpu_acquire() and cpufreq_cpu_release() cpufreq: Use locking guard and __free() in cpufreq_update_policy() cpufreq: intel_pstate: Rearrange max frequency updates handling code cpufreq: Add and use cpufreq policy locking guards ...
2 parents 60f0ee1 + 41abd47 commit 5fd1808

13 files changed

Lines changed: 429 additions & 397 deletions

File tree

drivers/base/arch_topology.c

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,6 @@ void topology_set_freq_scale(const struct cpumask *cpus, unsigned long cur_freq,
154154
per_cpu(arch_freq_scale, i) = scale;
155155
}
156156

157-
DEFINE_PER_CPU(unsigned long, cpu_scale) = SCHED_CAPACITY_SCALE;
158-
EXPORT_PER_CPU_SYMBOL_GPL(cpu_scale);
159-
160-
void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity)
161-
{
162-
per_cpu(cpu_scale, cpu) = capacity;
163-
}
164-
165157
DEFINE_PER_CPU(unsigned long, hw_pressure);
166158

167159
/**
@@ -207,53 +199,9 @@ void topology_update_hw_pressure(const struct cpumask *cpus,
207199
}
208200
EXPORT_SYMBOL_GPL(topology_update_hw_pressure);
209201

210-
static ssize_t cpu_capacity_show(struct device *dev,
211-
struct device_attribute *attr,
212-
char *buf)
213-
{
214-
struct cpu *cpu = container_of(dev, struct cpu, dev);
215-
216-
return sysfs_emit(buf, "%lu\n", topology_get_cpu_scale(cpu->dev.id));
217-
}
218-
219202
static void update_topology_flags_workfn(struct work_struct *work);
220203
static DECLARE_WORK(update_topology_flags_work, update_topology_flags_workfn);
221204

222-
static DEVICE_ATTR_RO(cpu_capacity);
223-
224-
static int cpu_capacity_sysctl_add(unsigned int cpu)
225-
{
226-
struct device *cpu_dev = get_cpu_device(cpu);
227-
228-
if (!cpu_dev)
229-
return -ENOENT;
230-
231-
device_create_file(cpu_dev, &dev_attr_cpu_capacity);
232-
233-
return 0;
234-
}
235-
236-
static int cpu_capacity_sysctl_remove(unsigned int cpu)
237-
{
238-
struct device *cpu_dev = get_cpu_device(cpu);
239-
240-
if (!cpu_dev)
241-
return -ENOENT;
242-
243-
device_remove_file(cpu_dev, &dev_attr_cpu_capacity);
244-
245-
return 0;
246-
}
247-
248-
static int register_cpu_capacity_sysctl(void)
249-
{
250-
cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "topology/cpu-capacity",
251-
cpu_capacity_sysctl_add, cpu_capacity_sysctl_remove);
252-
253-
return 0;
254-
}
255-
subsys_initcall(register_cpu_capacity_sysctl);
256-
257205
static int update_topology;
258206

259207
int topology_update_cpu_topology(void)

drivers/base/topology.c

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,55 @@ static int __init topology_sysfs_init(void)
208208
}
209209

210210
device_initcall(topology_sysfs_init);
211+
212+
DEFINE_PER_CPU(unsigned long, cpu_scale) = SCHED_CAPACITY_SCALE;
213+
EXPORT_PER_CPU_SYMBOL_GPL(cpu_scale);
214+
215+
void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity)
216+
{
217+
per_cpu(cpu_scale, cpu) = capacity;
218+
}
219+
220+
static ssize_t cpu_capacity_show(struct device *dev,
221+
struct device_attribute *attr,
222+
char *buf)
223+
{
224+
struct cpu *cpu = container_of(dev, struct cpu, dev);
225+
226+
return sysfs_emit(buf, "%lu\n", topology_get_cpu_scale(cpu->dev.id));
227+
}
228+
229+
static DEVICE_ATTR_RO(cpu_capacity);
230+
231+
static int cpu_capacity_sysctl_add(unsigned int cpu)
232+
{
233+
struct device *cpu_dev = get_cpu_device(cpu);
234+
235+
if (!cpu_dev)
236+
return -ENOENT;
237+
238+
device_create_file(cpu_dev, &dev_attr_cpu_capacity);
239+
240+
return 0;
241+
}
242+
243+
static int cpu_capacity_sysctl_remove(unsigned int cpu)
244+
{
245+
struct device *cpu_dev = get_cpu_device(cpu);
246+
247+
if (!cpu_dev)
248+
return -ENOENT;
249+
250+
device_remove_file(cpu_dev, &dev_attr_cpu_capacity);
251+
252+
return 0;
253+
}
254+
255+
static int register_cpu_capacity_sysctl(void)
256+
{
257+
cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "topology/cpu-capacity",
258+
cpu_capacity_sysctl_add, cpu_capacity_sysctl_remove);
259+
260+
return 0;
261+
}
262+
subsys_initcall(register_cpu_capacity_sysctl);

drivers/cpufreq/amd-pstate-ut.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ static int amd_pstate_set_mode(enum amd_pstate_mode mode)
242242
static int amd_pstate_ut_check_driver(u32 index)
243243
{
244244
enum amd_pstate_mode mode1, mode2 = AMD_PSTATE_DISABLE;
245+
enum amd_pstate_mode orig_mode = amd_pstate_get_status();
246+
int ret;
245247

246248
for (mode1 = AMD_PSTATE_DISABLE; mode1 < AMD_PSTATE_MAX; mode1++) {
247249
int ret = amd_pstate_set_mode(mode1);
@@ -251,16 +253,19 @@ static int amd_pstate_ut_check_driver(u32 index)
251253
if (mode1 == mode2)
252254
continue;
253255
ret = amd_pstate_set_mode(mode2);
254-
if (ret) {
255-
pr_err("%s: failed to update status for %s->%s\n", __func__,
256-
amd_pstate_get_mode_string(mode1),
257-
amd_pstate_get_mode_string(mode2));
258-
return ret;
259-
}
256+
if (ret)
257+
goto out;
260258
}
261259
}
262260

263-
return 0;
261+
out:
262+
if (ret)
263+
pr_warn("%s: failed to update status for %s->%s: %d\n", __func__,
264+
amd_pstate_get_mode_string(mode1),
265+
amd_pstate_get_mode_string(mode2), ret);
266+
267+
amd_pstate_set_mode(orig_mode);
268+
return ret;
264269
}
265270

266271
static int __init amd_pstate_ut_init(void)

0 commit comments

Comments
 (0)