Can't agree you more. As I know, there is no such function to get mask of online and offline cpus in a cluster.
Thanks, Yuantian
-----Original Message----- From: Viresh Kumar [mailto:viresh.kumar@linaro.org] Sent: Wednesday, September 03, 2014 5:50 PM To: Tang Yuantian-B29983 Cc: Rafael Wysocki; linaro-kernel@lists.linaro.org; linux-pm@vger.kernel.org; Li Yang-Leo-R58472; Jia Hongtao-B38951 Subject: Re: [PATCH 2/2] cpufreq: ppc-corenet: remove per-cpu variable 'cpu_mask'
On 3 September 2014 13:32, Yuantian Tang Yuantian.Tang@freescale.com wrote:
Test confirmed what I am concerned. Patch 1 is working but patch 2 didn't
working in hotplug case.
(tested on t4240 platform with 3 cluster and 8 cpus in each cluster, kernel
version is 3.12).
:(
Log is as follows: root@t4240rdb:~# cd /sys/devices/system/ root@t4240rdb:/sys/devices/system# ls clockevents clocksource cpu edac root@t4240rdb:/sys/devices/system# cd cpu/ root@t4240rdb:/sys/devices/system/cpu# ls cpu0 cpu1 cpu10 cpu11 cpu12 cpu13 cpu14 cpu15 cpu16
cpu17
cpu18 cpu19 cpu2 cpu20 cpu21 cpu22 cpu23 cpu3 cpu4cpu5
cpu6 cpu7 cpu8 cpu9 kernel_max offline online possible present probe release uevent root@t4240rdb:/sys/devices/system/cpu# cat cpu8/
altivec_idle altivec_idle_wait_time cache/
cpufreq/ online physical_id pir pw20_state pw20_wait_time smt_snooze_delay subsystem/ topology/ uevent
root@t4240rdb:/sys/devices/system/cpu# cat cpu8/cpufreq/affected_cpus 8 9 10 11 12 13 14 15 root@t4240rdb:/sys/devices/system/cpu# echo 0 > cpu8/online Cannot set affinity for irq 467 root@t4240rdb:/sys/devices/system/cpu# echo 0 > cpu9/online root@t4240rdb:/sys/devices/system/cpu# cat cpu10/cpufreq/affected_cpus 10 11 12 13 14 15 root@t4240rdb:/sys/devices/system/cpu# echo 0 > cpu10/online root@t4240rdb:/sys/devices/system/cpu# echo 0 > cpu11/online root@t4240rdb:/sys/devices/system/cpu# echo 0 > cpu12/online root@t4240rdb:/sys/devices/system/cpu# echo 0 > cpu13/online root@t4240rdb:/sys/devices/system/cpu# echo 0 > cpu14/online root@t4240rdb:/sys/devices/system/cpu# echo 0 > cpu15/online root@t4240rdb:/sys/devices/system/cpu# echo 1 > cpu9/online smp_85xx_kick_cpu: Can not start CPU #9. Start CPU #8 first. smp: failed starting cpu 9 (rc -2) -sh: echo: write error: No such file or directory
I don't understand how is this related to my patch? And the successful sequence below has CPU14 here instead of 8.. So this error might come without my patch as well if this sequence is followed..
root@t4240rdb:/sys/devices/system/cpu# echo 1 > cpu10/online root@t4240rdb:/sys/devices/system/cpu# cat cpu10/cpufreq/affected_cpus 10 root@t4240rdb:/sys/devices/system/cpu# echo 1 > cpu11/online sysfs: cannot create duplicate filename '/devices/system/cpu/cpu10/cpufreq' ------------[ cut here ]------------ WARNING: at fs/sysfs/dir.c:526
I think I know why this happened.
Does cpu_core_mask() gives mask of ONLY Online CPUs ? I *strongly* believe YES looking at above crash.
If we can change that with some other routine which gives mask of all (online+offline) CPUs then this crash might go away..
Because of that, I believe there is another problem in your driver even without my patch. Do this to get similar crash:
- build driver as module and don't load it by default
- boot your system
- offline CPUs 8 to 15 as you did above.
- insert module
- try to online cores as you did above.
-- viresh