Hi Chanwoo, I love your patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v5.13-rc7 next-20210623] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Chanwoo-Choi/PM-devfreq-passive-Fix-get_target_freq-when-not-using-required-opp/20210617-150556 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 70585216fe7730d9fb5453d3e2804e149d0fe201 config: um-allmodconfig (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/53908c80cda313fc07cffa4f47611bda4fe7637c git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Chanwoo-Choi/PM-devfreq-passive-Fix-get_target_freq-when-not-using-required-opp/20210617-150556 git checkout 53908c80cda313fc07cffa4f47611bda4fe7637c # save the attached .config to linux build tree make W=1 ARCH=um If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All error/warnings (new ones prefixed by >>): In file included from arch/x86/um/asm/processor.h:41, from include/linux/spinlock_up.h:8, from include/linux/spinlock.h:92, from include/linux/mmzone.h:8, from include/linux/gfp.h:6, from include/linux/umh.h:4, from include/linux/kmod.h:9, from include/linux/module.h:16, from drivers/devfreq/governor_simpleondemand.c:10: >> arch/um/include/asm/processor-generic.h:97:19: error: expected identifier or '(' before '&' token 97 | #define cpu_data (&boot_cpu_data) | ^ include/linux/devfreq.h:331:27: note: in expansion of macro 'cpu_data' 331 | struct devfreq_cpu_data *cpu_data[NR_CPUS]; | ^~~~~~~~ In file included from drivers/devfreq/governor_simpleondemand.c:11: >> include/linux/devfreq.h:332:1: warning: no semicolon at end of struct or union 332 | }; | ^ -- In file included from arch/x86/um/asm/processor.h:41, from include/linux/spinlock_up.h:8, from include/linux/spinlock.h:92, from include/linux/mmzone.h:8, from include/linux/gfp.h:6, from include/linux/umh.h:4, from include/linux/kmod.h:9, from include/linux/module.h:16, from drivers/devfreq/governor_passive.c:10: >> arch/um/include/asm/processor-generic.h:97:19: error: expected identifier or '(' before '&' token 97 | #define cpu_data (&boot_cpu_data) | ^ include/linux/devfreq.h:331:27: note: in expansion of macro 'cpu_data' 331 | struct devfreq_cpu_data *cpu_data[NR_CPUS]; | ^~~~~~~~ In file included from drivers/devfreq/governor_passive.c:16: >> include/linux/devfreq.h:332:1: warning: no semicolon at end of struct or union 332 | }; | ^ In file included from arch/x86/um/asm/processor.h:41, from include/linux/spinlock_up.h:8, from include/linux/spinlock.h:92, from include/linux/mmzone.h:8, from include/linux/gfp.h:6, from include/linux/umh.h:4, from include/linux/kmod.h:9, from include/linux/module.h:16, from drivers/devfreq/governor_passive.c:10: drivers/devfreq/governor_passive.c: In function 'get_target_freq_with_cpufreq': >> arch/um/include/asm/processor-generic.h:97:19: error: expected identifier or '(' before '&' token 97 | #define cpu_data (&boot_cpu_data) | ^ drivers/devfreq/governor_passive.c:52:27: note: in expansion of macro 'cpu_data' 52 | struct devfreq_cpu_data *cpu_data; | ^~~~~~~~ >> arch/um/include/asm/processor-generic.h:97:18: error: expected identifier before '(' token 97 | #define cpu_data (&boot_cpu_data) | ^ drivers/devfreq/governor_passive.c:58:22: note: in expansion of macro 'cpu_data' 58 | cpu_data = p_data->cpu_data[cpu]; | ^~~~~~~~ >> drivers/devfreq/governor_passive.c:59:7: warning: the address of 'boot_cpu_data' will always evaluate as 'true' [-Waddress] 59 | if (!cpu_data || cpu_data->first_cpu != cpu) | ^ >> drivers/devfreq/governor_passive.c:59:28: error: 'struct cpuinfo_um' has no member named 'first_cpu' 59 | if (!cpu_data || cpu_data->first_cpu != cpu) | ^~ >> drivers/devfreq/governor_passive.c:63:21: error: 'struct cpuinfo_um' has no member named 'cur_freq' 63 | cpu_cur = cpu_data->cur_freq * HZ_PER_KHZ; | ^~ >> drivers/devfreq/governor_passive.c:64:49: error: 'struct cpuinfo_um' has no member named 'dev' 64 | freq = get_taget_freq_by_required_opp(cpu_data->dev, | ^~ >> drivers/devfreq/governor_passive.c:65:14: error: 'struct cpuinfo_um' has no member named 'opp_table' 65 | cpu_data->opp_table, | ^~ >> drivers/devfreq/governor_passive.c:75:21: error: 'struct cpuinfo_um' has no member named 'min_freq' 75 | cpu_min = cpu_data->min_freq; | ^~ >> drivers/devfreq/governor_passive.c:76:21: error: 'struct cpuinfo_um' has no member named 'max_freq' 76 | cpu_max = cpu_data->max_freq; | ^~ drivers/devfreq/governor_passive.c:77:21: error: 'struct cpuinfo_um' has no member named 'cur_freq' 77 | cpu_cur = cpu_data->cur_freq; | ^~ >> drivers/devfreq/governor_passive.c:50:31: warning: variable 'p_data' set but not used [-Wunused-but-set-variable] 50 | struct devfreq_passive_data *p_data = | ^~~~~~ In file included from arch/x86/um/asm/processor.h:41, from include/linux/spinlock_up.h:8, from include/linux/spinlock.h:92, from include/linux/mmzone.h:8, from include/linux/gfp.h:6, from include/linux/umh.h:4, from include/linux/kmod.h:9, from include/linux/module.h:16, from drivers/devfreq/governor_passive.c:10: drivers/devfreq/governor_passive.c: In function 'cpufreq_passive_notifier_call': >> arch/um/include/asm/processor-generic.h:97:19: error: expected identifier or '(' before '&' token 97 | #define cpu_data (&boot_cpu_data) | ^ drivers/devfreq/governor_passive.c:215:27: note: in expansion of macro 'cpu_data' 215 | struct devfreq_cpu_data *cpu_data; | ^~~~~~~~ >> arch/um/include/asm/processor-generic.h:97:18: error: expected identifier before '(' token 97 | #define cpu_data (&boot_cpu_data) | ^ drivers/devfreq/governor_passive.c:221:10: note: in expansion of macro 'cpu_data' 221 | !data->cpu_data[freqs->policy->cpu]) | ^~~~~~~~ >> arch/um/include/asm/processor-generic.h:97:18: error: expected identifier before '(' token 97 | #define cpu_data (&boot_cpu_data) | ^ drivers/devfreq/governor_passive.c:224:19: note: in expansion of macro 'cpu_data' 224 | cpu_data = data->cpu_data[freqs->policy->cpu]; | ^~~~~~~~ drivers/devfreq/governor_passive.c:225:14: error: 'struct cpuinfo_um' has no member named 'cur_freq' 225 | if (cpu_data->cur_freq == freqs->new) | ^~ drivers/devfreq/governor_passive.c:228:21: error: 'struct cpuinfo_um' has no member named 'cur_freq' 228 | cur_freq = cpu_data->cur_freq; | ^~ drivers/devfreq/governor_passive.c:229:10: error: 'struct cpuinfo_um' has no member named 'cur_freq' 229 | cpu_data->cur_freq = freqs->new; | ^~ drivers/devfreq/governor_passive.c:235:11: error: 'struct cpuinfo_um' has no member named 'cur_freq' 235 | cpu_data->cur_freq = cur_freq; | ^~ In file included from arch/x86/um/asm/processor.h:41, from include/linux/spinlock_up.h:8, from include/linux/spinlock.h:92, from include/linux/mmzone.h:8, from include/linux/gfp.h:6, from include/linux/umh.h:4, from include/linux/kmod.h:9, from include/linux/module.h:16, from drivers/devfreq/governor_passive.c:10: drivers/devfreq/governor_passive.c: In function 'cpufreq_passive_register_notifier': >> arch/um/include/asm/processor-generic.h:97:19: error: expected identifier or '(' before '&' token 97 | #define cpu_data (&boot_cpu_data) | ^ drivers/devfreq/governor_passive.c:249:27: note: in expansion of macro 'cpu_data' 249 | struct devfreq_cpu_data *cpu_data; | ^~~~~~~~ >> arch/um/include/asm/processor-generic.h:97:18: error: expected identifier before '(' token 97 | #define cpu_data (&boot_cpu_data) | ^ drivers/devfreq/governor_passive.c:266:15: note: in expansion of macro 'cpu_data' 266 | if (p_data->cpu_data[cpu]) | ^~~~~~~~ >> drivers/devfreq/governor_passive.c:271:13: error: lvalue required as left operand of assignment 271 | cpu_data = kzalloc(sizeof(*cpu_data), GFP_KERNEL); | ^ drivers/devfreq/governor_passive.c:272:8: warning: the address of 'boot_cpu_data' will always evaluate as 'true' [-Waddress] 272 | if (!cpu_data) { | ^ drivers/devfreq/governor_passive.c:290:12: error: 'struct cpuinfo_um' has no member named 'dev' 290 | cpu_data->dev = cpu_dev; | ^~ drivers/devfreq/governor_passive.c:291:12: error: 'struct cpuinfo_um' has no member named 'opp_table' 291 | cpu_data->opp_table = opp_table; | ^~ drivers/devfreq/governor_passive.c:292:12: error: 'struct cpuinfo_um' has no member named 'first_cpu' 292 | cpu_data->first_cpu = cpumask_first(policy->related_cpus); | ^~ drivers/devfreq/governor_passive.c:293:12: error: 'struct cpuinfo_um' has no member named 'cur_freq' 293 | cpu_data->cur_freq = policy->cur; | ^~ drivers/devfreq/governor_passive.c:294:12: error: 'struct cpuinfo_um' has no member named 'min_freq' 294 | cpu_data->min_freq = policy->cpuinfo.min_freq; | ^~ drivers/devfreq/governor_passive.c:295:12: error: 'struct cpuinfo_um' has no member named 'max_freq' 295 | cpu_data->max_freq = policy->cpuinfo.max_freq; | ^~ In file included from arch/x86/um/asm/processor.h:41, from include/linux/spinlock_up.h:8, from include/linux/spinlock.h:92, from include/linux/mmzone.h:8, from include/linux/gfp.h:6, from include/linux/umh.h:4, from include/linux/kmod.h:9, from include/linux/module.h:16, from drivers/devfreq/governor_passive.c:10: >> arch/um/include/asm/processor-generic.h:97:18: error: expected identifier before '(' token 97 | #define cpu_data (&boot_cpu_data) | ^ drivers/devfreq/governor_passive.c:297:12: note: in expansion of macro 'cpu_data' 297 | p_data->cpu_data[cpu] = cpu_data; | ^~~~~~~~ drivers/devfreq/governor_passive.c: In function 'cpufreq_passive_unregister_notifier': >> arch/um/include/asm/processor-generic.h:97:19: error: expected identifier or '(' before '&' token 97 | #define cpu_data (&boot_cpu_data) | ^ drivers/devfreq/governor_passive.c:322:27: note: in expansion of macro 'cpu_data' 322 | struct devfreq_cpu_data *cpu_data; | ^~~~~~~~ arch/um/include/asm/processor-generic.h:97:18: error: expected identifier before '(' token 97 | #define cpu_data (&boot_cpu_data) | ^ drivers/devfreq/governor_passive.c:329:22: note: in expansion of macro 'cpu_data' 329 | cpu_data = p_data->cpu_data[cpu]; | ^~~~~~~~ arch/um/include/asm/processor-generic.h:97:18: warning: the address of 'boot_cpu_data' will always evaluate as 'true' [-Waddress] 97 | #define cpu_data (&boot_cpu_data) | ^ drivers/devfreq/governor_passive.c:330:7: note: in expansion of macro 'cpu_data' 330 | if (cpu_data) { | ^~~~~~~~ drivers/devfreq/governor_passive.c:331:16: error: 'struct cpuinfo_um' has no member named 'opp_table' 331 | if (cpu_data->opp_table) | ^~ drivers/devfreq/governor_passive.c:332:38: error: 'struct cpuinfo_um' has no member named 'opp_table' 332 | dev_pm_opp_put_opp_table(cpu_data->opp_table); | ^~ drivers/devfreq/governor_passive.c:334:13: error: lvalue required as left operand of assignment 334 | cpu_data = NULL; | ^ vim +59 drivers/devfreq/governor_passive.c 46 47 static int get_target_freq_with_cpufreq(struct devfreq *devfreq, 48 unsigned long *target_freq) 49 { > 50 struct devfreq_passive_data *p_data = 51 (struct devfreq_passive_data *)devfreq->data; 52 struct devfreq_cpu_data *cpu_data; 53 unsigned long cpu, cpu_cur, cpu_min, cpu_max, cpu_percent; 54 unsigned long dev_min, dev_max; 55 unsigned long freq = 0; 56 57 for_each_online_cpu(cpu) { 58 cpu_data = p_data->cpu_data[cpu]; > 59 if (!cpu_data || cpu_data->first_cpu != cpu) 60 continue; 61 62 /* Get target freq via required opps */ > 63 cpu_cur = cpu_data->cur_freq * HZ_PER_KHZ; > 64 freq = get_taget_freq_by_required_opp(cpu_data->dev, > 65 cpu_data->opp_table, 66 devfreq->opp_table, cpu_cur); 67 if (freq) { 68 *target_freq = max(freq, *target_freq); 69 continue; 70 } 71 72 /* Use Interpolation if required opps is not available */ 73 devfreq_get_freq_range(devfreq, &dev_min, &dev_max); 74 > 75 cpu_min = cpu_data->min_freq; > 76 cpu_max = cpu_data->max_freq; 77 cpu_cur = cpu_data->cur_freq; 78 79 cpu_percent = ((cpu_cur - cpu_min) * 100) / (cpu_max - cpu_min); 80 freq = dev_min + mult_frac(dev_max - dev_min, cpu_percent, 100); 81 82 *target_freq = max(freq, *target_freq); 83 } 84 85 return 0; 86 } 87 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org