]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.38.8/cpu-hotplug-re-create-sysfs-directory-and-symlinks.patch
Fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 2.6.38.8 / cpu-hotplug-re-create-sysfs-directory-and-symlinks.patch
CommitLineData
ecf6e423
GKH
1From 27ecddc2a9f99ce4ac9a59a0acd77f7100b6d034 Mon Sep 17 00:00:00 2001
2From: Jacob Shin <jacob.shin@amd.com>
3Date: Wed, 27 Apr 2011 13:32:11 -0500
4Subject: [CPUFREQ] CPU hotplug, re-create sysfs directory and symlinks
5
6From: Jacob Shin <jacob.shin@amd.com>
7
8commit 27ecddc2a9f99ce4ac9a59a0acd77f7100b6d034 upstream.
9
10When we discover CPUs that are affected by each other's
11frequency/voltage transitions, the first CPU gets a sysfs directory
12created, and rest of the siblings get symlinks. Currently, when we
13hotplug off only the first CPU, all of the symlinks and the sysfs
14directory gets removed. Even though rest of the siblings are still
15online and functional, they are orphaned, and no longer governed by
16cpufreq.
17
18This patch, given the above scenario, creates a sysfs directory for
19the first sibling and symlinks for the rest of the siblings.
20
21Please note the recursive call, it was rather too ugly to roll it
22out. And the removal of redundant NULL setting (it is already taken
23care of near the top of the function).
24
25Signed-off-by: Jacob Shin <jacob.shin@amd.com>
26Acked-by: Mark Langsdorf <mark.langsdorf@amd.com>
27Reviewed-by: Thomas Renninger <trenn@suse.de>
28Signed-off-by: Dave Jones <davej@redhat.com>
29Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
30
31---
32 drivers/cpufreq/cpufreq.c | 20 ++++++++++++++++++--
33 1 file changed, 18 insertions(+), 2 deletions(-)
34
35--- a/drivers/cpufreq/cpufreq.c
36+++ b/drivers/cpufreq/cpufreq.c
37@@ -1207,12 +1207,28 @@ static int __cpufreq_remove_dev(struct s
38 cpufreq_driver->exit(data);
39 unlock_policy_rwsem_write(cpu);
40
41+ cpufreq_debug_enable_ratelimit();
42+
43+#ifdef CONFIG_HOTPLUG_CPU
44+ /* when the CPU which is the parent of the kobj is hotplugged
45+ * offline, check for siblings, and create cpufreq sysfs interface
46+ * and symlinks
47+ */
48+ if (unlikely(cpumask_weight(data->cpus) > 1)) {
49+ /* first sibling now owns the new sysfs dir */
50+ cpumask_clear_cpu(cpu, data->cpus);
51+ cpufreq_add_dev(get_cpu_sysdev(cpumask_first(data->cpus)));
52+
53+ /* finally remove our own symlink */
54+ lock_policy_rwsem_write(cpu);
55+ __cpufreq_remove_dev(sys_dev);
56+ }
57+#endif
58+
59 free_cpumask_var(data->related_cpus);
60 free_cpumask_var(data->cpus);
61 kfree(data);
62- per_cpu(cpufreq_cpu_data, cpu) = NULL;
63
64- cpufreq_debug_enable_ratelimit();
65 return 0;
66 }
67