]>
Commit | Line | Data |
---|---|---|
ecf6e423 GKH |
1 | From 27ecddc2a9f99ce4ac9a59a0acd77f7100b6d034 Mon Sep 17 00:00:00 2001 |
2 | From: Jacob Shin <jacob.shin@amd.com> | |
3 | Date: Wed, 27 Apr 2011 13:32:11 -0500 | |
4 | Subject: [CPUFREQ] CPU hotplug, re-create sysfs directory and symlinks | |
5 | ||
6 | From: Jacob Shin <jacob.shin@amd.com> | |
7 | ||
8 | commit 27ecddc2a9f99ce4ac9a59a0acd77f7100b6d034 upstream. | |
9 | ||
10 | When we discover CPUs that are affected by each other's | |
11 | frequency/voltage transitions, the first CPU gets a sysfs directory | |
12 | created, and rest of the siblings get symlinks. Currently, when we | |
13 | hotplug off only the first CPU, all of the symlinks and the sysfs | |
14 | directory gets removed. Even though rest of the siblings are still | |
15 | online and functional, they are orphaned, and no longer governed by | |
16 | cpufreq. | |
17 | ||
18 | This patch, given the above scenario, creates a sysfs directory for | |
19 | the first sibling and symlinks for the rest of the siblings. | |
20 | ||
21 | Please note the recursive call, it was rather too ugly to roll it | |
22 | out. And the removal of redundant NULL setting (it is already taken | |
23 | care of near the top of the function). | |
24 | ||
25 | Signed-off-by: Jacob Shin <jacob.shin@amd.com> | |
26 | Acked-by: Mark Langsdorf <mark.langsdorf@amd.com> | |
27 | Reviewed-by: Thomas Renninger <trenn@suse.de> | |
28 | Signed-off-by: Dave Jones <davej@redhat.com> | |
29 | Signed-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 |