[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202301110124.XrittopF-lkp@intel.com>
Date: Wed, 11 Jan 2023 02:15:57 +0800
From: kernel test robot <lkp@...el.com>
To: Perry Yuan <perry.yuan@....com>, rafael.j.wysocki@...el.com,
Mario.Limonciello@....com, ray.huang@....com,
viresh.kumar@...aro.org
Cc: llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
Deepak.Sharma@....com, Nathan.Fontenot@....com,
Alexander.Deucher@....com, Shimmer.Huang@....com,
Xiaojian.Du@....com, Li.Meng@....com, wyes.karny@....com,
linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v10 05/12] cpufreq: amd-pstate: implement Pstate EPP
support for the AMD processors
Hi Perry,
I love your patch! Perhaps something to improve:
[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on linus/master v6.2-rc3 next-20230110]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Perry-Yuan/ACPI-CPPC-Add-AMD-pstate-energy-performance-preference-cppc-control/20230106-141924
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link: https://lore.kernel.org/r/20230106061420.95715-6-perry.yuan%40amd.com
patch subject: [PATCH v10 05/12] cpufreq: amd-pstate: implement Pstate EPP support for the AMD processors
config: x86_64-buildonly-randconfig-r002-20230109
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/70cada4b76e142d3786f958a894dab9f46ce8b7f
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Perry-Yuan/ACPI-CPPC-Add-AMD-pstate-energy-performance-preference-cppc-control/20230106-141924
git checkout 70cada4b76e142d3786f958a894dab9f46ce8b7f
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/cpufreq/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
>> drivers/cpufreq/amd-pstate.c:817:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (rc)
^~
drivers/cpufreq/amd-pstate.c:873:9: note: uninitialized use occurs here
return ret;
^~~
drivers/cpufreq/amd-pstate.c:817:2: note: remove the 'if' if its condition is always false
if (rc)
^~~~~~~
drivers/cpufreq/amd-pstate.c:806:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!dev)
^~~~
drivers/cpufreq/amd-pstate.c:873:9: note: uninitialized use occurs here
return ret;
^~~
drivers/cpufreq/amd-pstate.c:806:2: note: remove the 'if' if its condition is always false
if (!dev)
^~~~~~~~~
drivers/cpufreq/amd-pstate.c:799:66: note: initialize the variable 'ret' to silence this warning
int min_freq, max_freq, nominal_freq, lowest_nonlinear_freq, ret;
^
= 0
>> drivers/cpufreq/amd-pstate.c:844:52: warning: variable 'value' is uninitialized when used here [-Wuninitialized]
cpudata->epp_cached = amd_pstate_get_epp(cpudata, value);
^~~~~
drivers/cpufreq/amd-pstate.c:803:11: note: initialize the variable 'value' to silence this warning
u64 value;
^
= 0
>> drivers/cpufreq/amd-pstate.c:910:6: warning: variable 'epp' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (cpudata->epp_policy == cpudata->policy)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/cpufreq/amd-pstate.c:935:30: note: uninitialized use occurs here
amd_pstate_set_epp(cpudata, epp);
^~~
drivers/cpufreq/amd-pstate.c:910:2: note: remove the 'if' if its condition is always false
if (cpudata->epp_policy == cpudata->policy)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/cpufreq/amd-pstate.c:889:9: note: initialize the variable 'epp' to silence this warning
s16 epp;
^
= 0
4 warnings generated.
vim +817 drivers/cpufreq/amd-pstate.c
796
797 static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy)
798 {
799 int min_freq, max_freq, nominal_freq, lowest_nonlinear_freq, ret;
800 struct amd_cpudata *cpudata;
801 struct device *dev;
802 int rc;
803 u64 value;
804
805 dev = get_cpu_device(policy->cpu);
> 806 if (!dev)
807 goto free_cpudata1;
808
809 cpudata = kzalloc(sizeof(*cpudata), GFP_KERNEL);
810 if (!cpudata)
811 return -ENOMEM;
812
813 cpudata->cpu = policy->cpu;
814 cpudata->epp_policy = 0;
815
816 rc = amd_pstate_init_perf(cpudata);
> 817 if (rc)
818 goto free_cpudata1;
819
820 min_freq = amd_get_min_freq(cpudata);
821 max_freq = amd_get_max_freq(cpudata);
822 nominal_freq = amd_get_nominal_freq(cpudata);
823 lowest_nonlinear_freq = amd_get_lowest_nonlinear_freq(cpudata);
824 if (min_freq < 0 || max_freq < 0 || min_freq > max_freq) {
825 dev_err(dev, "min_freq(%d) or max_freq(%d) value is incorrect\n",
826 min_freq, max_freq);
827 ret = -EINVAL;
828 goto free_cpudata1;
829 }
830
831 policy->cpuinfo.min_freq = min_freq;
832 policy->cpuinfo.max_freq = max_freq;
833 /* It will be updated by governor */
834 policy->cur = policy->cpuinfo.min_freq;
835
836 /* Initial processor data capability frequencies */
837 cpudata->max_freq = max_freq;
838 cpudata->min_freq = min_freq;
839 cpudata->nominal_freq = nominal_freq;
840 cpudata->lowest_nonlinear_freq = lowest_nonlinear_freq;
841
842 policy->driver_data = cpudata;
843
> 844 cpudata->epp_cached = amd_pstate_get_epp(cpudata, value);
845
846 policy->min = policy->cpuinfo.min_freq;
847 policy->max = policy->cpuinfo.max_freq;
848
849 /*
850 * Set the policy to powersave to provide a valid fallback value in case
851 * the default cpufreq governor is neither powersave nor performance.
852 */
853 policy->policy = CPUFREQ_POLICY_POWERSAVE;
854
855 if (boot_cpu_has(X86_FEATURE_CPPC)) {
856 policy->fast_switch_possible = true;
857 ret = rdmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, &value);
858 if (ret)
859 return ret;
860 WRITE_ONCE(cpudata->cppc_req_cached, value);
861
862 ret = rdmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_CAP1, &value);
863 if (ret)
864 return ret;
865 WRITE_ONCE(cpudata->cppc_cap1_cached, value);
866 }
867 amd_pstate_boost_init(cpudata);
868
869 return 0;
870
871 free_cpudata1:
872 kfree(cpudata);
873 return ret;
874 }
875
876 static int amd_pstate_epp_cpu_exit(struct cpufreq_policy *policy)
877 {
878 pr_debug("CPU %d exiting\n", policy->cpu);
879 policy->fast_switch_possible = false;
880 return 0;
881 }
882
883 static void amd_pstate_epp_init(unsigned int cpu)
884 {
885 struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
886 struct amd_cpudata *cpudata = policy->driver_data;
887 u32 max_perf, min_perf;
888 u64 value;
889 s16 epp;
890
891 max_perf = READ_ONCE(cpudata->highest_perf);
892 min_perf = READ_ONCE(cpudata->lowest_perf);
893
894 value = READ_ONCE(cpudata->cppc_req_cached);
895
896 if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE)
897 min_perf = max_perf;
898
899 /* Initial min/max values for CPPC Performance Controls Register */
900 value &= ~AMD_CPPC_MIN_PERF(~0L);
901 value |= AMD_CPPC_MIN_PERF(min_perf);
902
903 value &= ~AMD_CPPC_MAX_PERF(~0L);
904 value |= AMD_CPPC_MAX_PERF(max_perf);
905
906 /* CPPC EPP feature require to set zero to the desire perf bit */
907 value &= ~AMD_CPPC_DES_PERF(~0L);
908 value |= AMD_CPPC_DES_PERF(0);
909
> 910 if (cpudata->epp_policy == cpudata->policy)
911 goto skip_epp;
912
913 cpudata->epp_policy = cpudata->policy;
914
915 if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE) {
916 epp = amd_pstate_get_epp(cpudata, value);
917 if (epp < 0)
918 goto skip_epp;
919 /* force the epp value to be zero for performance policy */
920 epp = 0;
921 } else {
922 /* Get BIOS pre-defined epp value */
923 epp = amd_pstate_get_epp(cpudata, value);
924 if (epp)
925 goto skip_epp;
926 }
927 /* Set initial EPP value */
928 if (boot_cpu_has(X86_FEATURE_CPPC)) {
929 value &= ~GENMASK_ULL(31, 24);
930 value |= (u64)epp << 24;
931 }
932
933 skip_epp:
934 WRITE_ONCE(cpudata->cppc_req_cached, value);
935 amd_pstate_set_epp(cpudata, epp);
936 cpufreq_cpu_put(policy);
937 }
938
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
View attachment "config" of type "text/plain" (187309 bytes)
Powered by blists - more mailing lists