Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull cpu/SMT fix from Ingo Molnar:
"Fix a build bug on CONFIG_HOTPLUG_SMT=y && !CONFIG_SYSFS kernels"

* 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
cpu/SMT: Fix x86 link error without CONFIG_SYSFS

+72 -71
+72 -71
kernel/cpu.c
··· 1909 1909 } 1910 1910 EXPORT_SYMBOL(__cpuhp_remove_state); 1911 1911 1912 + #ifdef CONFIG_HOTPLUG_SMT 1913 + static void cpuhp_offline_cpu_device(unsigned int cpu) 1914 + { 1915 + struct device *dev = get_cpu_device(cpu); 1916 + 1917 + dev->offline = true; 1918 + /* Tell user space about the state change */ 1919 + kobject_uevent(&dev->kobj, KOBJ_OFFLINE); 1920 + } 1921 + 1922 + static void cpuhp_online_cpu_device(unsigned int cpu) 1923 + { 1924 + struct device *dev = get_cpu_device(cpu); 1925 + 1926 + dev->offline = false; 1927 + /* Tell user space about the state change */ 1928 + kobject_uevent(&dev->kobj, KOBJ_ONLINE); 1929 + } 1930 + 1931 + int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval) 1932 + { 1933 + int cpu, ret = 0; 1934 + 1935 + cpu_maps_update_begin(); 1936 + for_each_online_cpu(cpu) { 1937 + if (topology_is_primary_thread(cpu)) 1938 + continue; 1939 + ret = cpu_down_maps_locked(cpu, CPUHP_OFFLINE); 1940 + if (ret) 1941 + break; 1942 + /* 1943 + * As this needs to hold the cpu maps lock it's impossible 1944 + * to call device_offline() because that ends up calling 1945 + * cpu_down() which takes cpu maps lock. cpu maps lock 1946 + * needs to be held as this might race against in kernel 1947 + * abusers of the hotplug machinery (thermal management). 1948 + * 1949 + * So nothing would update device:offline state. That would 1950 + * leave the sysfs entry stale and prevent onlining after 1951 + * smt control has been changed to 'off' again. This is 1952 + * called under the sysfs hotplug lock, so it is properly 1953 + * serialized against the regular offline usage. 1954 + */ 1955 + cpuhp_offline_cpu_device(cpu); 1956 + } 1957 + if (!ret) 1958 + cpu_smt_control = ctrlval; 1959 + cpu_maps_update_done(); 1960 + return ret; 1961 + } 1962 + 1963 + int cpuhp_smt_enable(void) 1964 + { 1965 + int cpu, ret = 0; 1966 + 1967 + cpu_maps_update_begin(); 1968 + cpu_smt_control = CPU_SMT_ENABLED; 1969 + for_each_present_cpu(cpu) { 1970 + /* Skip online CPUs and CPUs on offline nodes */ 1971 + if (cpu_online(cpu) || !node_online(cpu_to_node(cpu))) 1972 + continue; 1973 + ret = _cpu_up(cpu, 0, CPUHP_ONLINE); 1974 + if (ret) 1975 + break; 1976 + /* See comment in cpuhp_smt_disable() */ 1977 + cpuhp_online_cpu_device(cpu); 1978 + } 1979 + cpu_maps_update_done(); 1980 + return ret; 1981 + } 1982 + #endif 1983 + 1912 1984 #if defined(CONFIG_SYSFS) && defined(CONFIG_HOTPLUG_CPU) 1913 1985 static ssize_t show_cpuhp_state(struct device *dev, 1914 1986 struct device_attribute *attr, char *buf) ··· 2134 2062 }; 2135 2063 2136 2064 #ifdef CONFIG_HOTPLUG_SMT 2137 - 2138 - static void cpuhp_offline_cpu_device(unsigned int cpu) 2139 - { 2140 - struct device *dev = get_cpu_device(cpu); 2141 - 2142 - dev->offline = true; 2143 - /* Tell user space about the state change */ 2144 - kobject_uevent(&dev->kobj, KOBJ_OFFLINE); 2145 - } 2146 - 2147 - static void cpuhp_online_cpu_device(unsigned int cpu) 2148 - { 2149 - struct device *dev = get_cpu_device(cpu); 2150 - 2151 - dev->offline = false; 2152 - /* Tell user space about the state change */ 2153 - kobject_uevent(&dev->kobj, KOBJ_ONLINE); 2154 - } 2155 - 2156 - int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval) 2157 - { 2158 - int cpu, ret = 0; 2159 - 2160 - cpu_maps_update_begin(); 2161 - for_each_online_cpu(cpu) { 2162 - if (topology_is_primary_thread(cpu)) 2163 - continue; 2164 - ret = cpu_down_maps_locked(cpu, CPUHP_OFFLINE); 2165 - if (ret) 2166 - break; 2167 - /* 2168 - * As this needs to hold the cpu maps lock it's impossible 2169 - * to call device_offline() because that ends up calling 2170 - * cpu_down() which takes cpu maps lock. cpu maps lock 2171 - * needs to be held as this might race against in kernel 2172 - * abusers of the hotplug machinery (thermal management). 2173 - * 2174 - * So nothing would update device:offline state. That would 2175 - * leave the sysfs entry stale and prevent onlining after 2176 - * smt control has been changed to 'off' again. This is 2177 - * called under the sysfs hotplug lock, so it is properly 2178 - * serialized against the regular offline usage. 2179 - */ 2180 - cpuhp_offline_cpu_device(cpu); 2181 - } 2182 - if (!ret) 2183 - cpu_smt_control = ctrlval; 2184 - cpu_maps_update_done(); 2185 - return ret; 2186 - } 2187 - 2188 - int cpuhp_smt_enable(void) 2189 - { 2190 - int cpu, ret = 0; 2191 - 2192 - cpu_maps_update_begin(); 2193 - cpu_smt_control = CPU_SMT_ENABLED; 2194 - for_each_present_cpu(cpu) { 2195 - /* Skip online CPUs and CPUs on offline nodes */ 2196 - if (cpu_online(cpu) || !node_online(cpu_to_node(cpu))) 2197 - continue; 2198 - ret = _cpu_up(cpu, 0, CPUHP_ONLINE); 2199 - if (ret) 2200 - break; 2201 - /* See comment in cpuhp_smt_disable() */ 2202 - cpuhp_online_cpu_device(cpu); 2203 - } 2204 - cpu_maps_update_done(); 2205 - return ret; 2206 - } 2207 - 2208 2065 2209 2066 static ssize_t 2210 2067 __store_smt_control(struct device *dev, struct device_attribute *attr,