[tip:smp/urgent 1/1] kernel/cpu.c:1915:5: error: redefinition of 'cpuhp_smt_disable'

From: kbuild test robot
Date: Mon Jul 08 2019 - 10:06:42 EST


tree: https://kernel.googlesource.com/pub/scm/linux/kernel/git/tip/tip.git smp/urgent
head: a12486641cddbe825d0441140c7f43e30096bf70
commit: a12486641cddbe825d0441140c7f43e30096bf70 [1/1] cpu/hotplug: Fix CONFIG_SYSFS=n build errors
config: arm-omap2plus_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout a12486641cddbe825d0441140c7f43e30096bf70
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=arm

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

>> kernel/cpu.c:1915:5: error: redefinition of 'cpuhp_smt_disable'
int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval)
^~~~~~~~~~~~~~~~~
In file included from kernel/cpu.c:16:0:
include/linux/cpu.h:211:19: note: previous definition of 'cpuhp_smt_disable' was here
static inline int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval) { return 0; }
^~~~~~~~~~~~~~~~~
kernel/cpu.c: In function 'cpuhp_smt_disable':
>> kernel/cpu.c:1921:7: error: implicit declaration of function 'topology_is_primary_thread' [-Werror=implicit-function-declaration]
if (topology_is_primary_thread(cpu))
^~~~~~~~~~~~~~~~~~~~~~~~~~
>> kernel/cpu.c:1942:19: error: lvalue required as left operand of assignment
cpu_smt_control = ctrlval;
^
kernel/cpu.c: At top level:
>> kernel/cpu.c:1947:5: error: redefinition of 'cpuhp_smt_enable'
int cpuhp_smt_enable(void)
^~~~~~~~~~~~~~~~
In file included from kernel/cpu.c:16:0:
include/linux/cpu.h:210:19: note: previous definition of 'cpuhp_smt_enable' was here
static inline int cpuhp_smt_enable(void) { return 0; }
^~~~~~~~~~~~~~~~
kernel/cpu.c: In function 'cpuhp_smt_enable':
kernel/cpu.c:1952:18: error: lvalue required as left operand of assignment
cpu_smt_control = CPU_SMT_ENABLED;
^
kernel/cpu.c: In function 'store_smt_control':
>> kernel/cpu.c:2184:9: error: implicit declaration of function '__store_smt_control'; did you mean 'store_smt_control'? [-Werror=implicit-function-declaration]
return __store_smt_control(dev, attr, buf, count);
^~~~~~~~~~~~~~~~~~~
store_smt_control
cc1: some warnings being treated as errors

vim +/cpuhp_smt_disable +1915 kernel/cpu.c

1914
> 1915 int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval)
1916 {
1917 int cpu, ret = 0;
1918
1919 cpu_maps_update_begin();
1920 for_each_online_cpu(cpu) {
> 1921 if (topology_is_primary_thread(cpu))
1922 continue;
1923 ret = cpu_down_maps_locked(cpu, CPUHP_OFFLINE);
1924 if (ret)
1925 break;
1926 /*
1927 * As this needs to hold the cpu maps lock it's impossible
1928 * to call device_offline() because that ends up calling
1929 * cpu_down() which takes cpu maps lock. cpu maps lock
1930 * needs to be held as this might race against in kernel
1931 * abusers of the hotplug machinery (thermal management).
1932 *
1933 * So nothing would update device:offline state. That would
1934 * leave the sysfs entry stale and prevent onlining after
1935 * smt control has been changed to 'off' again. This is
1936 * called under the sysfs hotplug lock, so it is properly
1937 * serialized against the regular offline usage.
1938 */
1939 cpuhp_offline_cpu_device(cpu);
1940 }
1941 if (!ret)
> 1942 cpu_smt_control = ctrlval;
1943 cpu_maps_update_done();
1944 return ret;
1945 }
1946
> 1947 int cpuhp_smt_enable(void)
1948 {
1949 int cpu, ret = 0;
1950
1951 cpu_maps_update_begin();
1952 cpu_smt_control = CPU_SMT_ENABLED;
1953 for_each_present_cpu(cpu) {
1954 /* Skip online CPUs and CPUs on offline nodes */
1955 if (cpu_online(cpu) || !node_online(cpu_to_node(cpu)))
1956 continue;
1957 ret = _cpu_up(cpu, 0, CPUHP_ONLINE);
1958 if (ret)
1959 break;
1960 /* See comment in cpuhp_smt_disable() */
1961 cpuhp_online_cpu_device(cpu);
1962 }
1963 cpu_maps_update_done();
1964 return ret;
1965 }
1966

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip