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 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Thomas Gleixner:
"A set of fixes for x86:

- Fix the inconsistent error handling in the umwait init code

- Rework the boot param zeroing so gcc9 stops complaining about out
of bound memset. The resulting source code is actually more sane to
read than the smart solution we had

- Maintainers update so Tony gets involved when Intel models are
added

- Some more fallthrough fixes"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/boot: Save fields explicitly, zero out everything else
MAINTAINERS, x86/CPU: Tony Luck will maintain asm/intel-family.h
x86/fpu/math-emu: Address fallthrough warnings
x86/apic/32: Fix yet another implicit fallthrough warning
x86/umwait: Fix error handling in umwait_init()

+99 -20
+7
MAINTAINERS
··· 8072 8072 S: Supported 8073 8073 F: drivers/scsi/isci/ 8074 8074 8075 + INTEL CPU family model numbers 8076 + M: Tony Luck <tony.luck@intel.com> 8077 + M: x86@kernel.org 8078 + L: linux-kernel@vger.kernel.org 8079 + S: Supported 8080 + F: arch/x86/include/asm/intel-family.h 8081 + 8075 8082 INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets) 8076 8083 M: Jani Nikula <jani.nikula@linux.intel.com> 8077 8084 M: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
+48 -15
arch/x86/include/asm/bootparam_utils.h
··· 18 18 * Note: efi_info is commonly left uninitialized, but that field has a 19 19 * private magic, so it is better to leave it unchanged. 20 20 */ 21 + 22 + #define sizeof_mbr(type, member) ({ sizeof(((type *)0)->member); }) 23 + 24 + #define BOOT_PARAM_PRESERVE(struct_member) \ 25 + { \ 26 + .start = offsetof(struct boot_params, struct_member), \ 27 + .len = sizeof_mbr(struct boot_params, struct_member), \ 28 + } 29 + 30 + struct boot_params_to_save { 31 + unsigned int start; 32 + unsigned int len; 33 + }; 34 + 21 35 static void sanitize_boot_params(struct boot_params *boot_params) 22 36 { 23 37 /* ··· 49 35 * problems again. 50 36 */ 51 37 if (boot_params->sentinel) { 52 - /* fields in boot_params are left uninitialized, clear them */ 53 - boot_params->acpi_rsdp_addr = 0; 54 - memset(&boot_params->ext_ramdisk_image, 0, 55 - (char *)&boot_params->efi_info - 56 - (char *)&boot_params->ext_ramdisk_image); 57 - memset(&boot_params->kbd_status, 0, 58 - (char *)&boot_params->hdr - 59 - (char *)&boot_params->kbd_status); 60 - memset(&boot_params->_pad7[0], 0, 61 - (char *)&boot_params->edd_mbr_sig_buffer[0] - 62 - (char *)&boot_params->_pad7[0]); 63 - memset(&boot_params->_pad8[0], 0, 64 - (char *)&boot_params->eddbuf[0] - 65 - (char *)&boot_params->_pad8[0]); 66 - memset(&boot_params->_pad9[0], 0, sizeof(boot_params->_pad9)); 38 + static struct boot_params scratch; 39 + char *bp_base = (char *)boot_params; 40 + char *save_base = (char *)&scratch; 41 + int i; 42 + 43 + const struct boot_params_to_save to_save[] = { 44 + BOOT_PARAM_PRESERVE(screen_info), 45 + BOOT_PARAM_PRESERVE(apm_bios_info), 46 + BOOT_PARAM_PRESERVE(tboot_addr), 47 + BOOT_PARAM_PRESERVE(ist_info), 48 + BOOT_PARAM_PRESERVE(acpi_rsdp_addr), 49 + BOOT_PARAM_PRESERVE(hd0_info), 50 + BOOT_PARAM_PRESERVE(hd1_info), 51 + BOOT_PARAM_PRESERVE(sys_desc_table), 52 + BOOT_PARAM_PRESERVE(olpc_ofw_header), 53 + BOOT_PARAM_PRESERVE(efi_info), 54 + BOOT_PARAM_PRESERVE(alt_mem_k), 55 + BOOT_PARAM_PRESERVE(scratch), 56 + BOOT_PARAM_PRESERVE(e820_entries), 57 + BOOT_PARAM_PRESERVE(eddbuf_entries), 58 + BOOT_PARAM_PRESERVE(edd_mbr_sig_buf_entries), 59 + BOOT_PARAM_PRESERVE(edd_mbr_sig_buffer), 60 + BOOT_PARAM_PRESERVE(e820_table), 61 + BOOT_PARAM_PRESERVE(eddbuf), 62 + }; 63 + 64 + memset(&scratch, 0, sizeof(scratch)); 65 + 66 + for (i = 0; i < ARRAY_SIZE(to_save); i++) { 67 + memcpy(save_base + to_save[i].start, 68 + bp_base + to_save[i].start, to_save[i].len); 69 + } 70 + 71 + memcpy(boot_params, save_base, sizeof(*boot_params)); 67 72 } 68 73 } 69 74
+2 -1
arch/x86/kernel/apic/probe_32.c
··· 184 184 def_to_bigsmp = 0; 185 185 break; 186 186 } 187 - /* If P4 and above fall through */ 187 + /* P4 and above */ 188 + /* fall through */ 188 189 case X86_VENDOR_HYGON: 189 190 case X86_VENDOR_AMD: 190 191 def_to_bigsmp = 1;
+38 -1
arch/x86/kernel/cpu/umwait.c
··· 18 18 static u32 umwait_control_cached = UMWAIT_CTRL_VAL(100000, UMWAIT_C02_ENABLE); 19 19 20 20 /* 21 + * Cache the original IA32_UMWAIT_CONTROL MSR value which is configured by 22 + * hardware or BIOS before kernel boot. 23 + */ 24 + static u32 orig_umwait_control_cached __ro_after_init; 25 + 26 + /* 21 27 * Serialize access to umwait_control_cached and IA32_UMWAIT_CONTROL MSR in 22 28 * the sysfs write functions. 23 29 */ ··· 55 49 local_irq_disable(); 56 50 umwait_update_control_msr(NULL); 57 51 local_irq_enable(); 52 + return 0; 53 + } 54 + 55 + /* 56 + * The CPU hotplug callback sets the control MSR to the original control 57 + * value. 58 + */ 59 + static int umwait_cpu_offline(unsigned int cpu) 60 + { 61 + /* 62 + * This code is protected by the CPU hotplug already and 63 + * orig_umwait_control_cached is never changed after it caches 64 + * the original control MSR value in umwait_init(). So there 65 + * is no race condition here. 66 + */ 67 + wrmsr(MSR_IA32_UMWAIT_CONTROL, orig_umwait_control_cached, 0); 68 + 58 69 return 0; 59 70 } 60 71 ··· 208 185 if (!boot_cpu_has(X86_FEATURE_WAITPKG)) 209 186 return -ENODEV; 210 187 188 + /* 189 + * Cache the original control MSR value before the control MSR is 190 + * changed. This is the only place where orig_umwait_control_cached 191 + * is modified. 192 + */ 193 + rdmsrl(MSR_IA32_UMWAIT_CONTROL, orig_umwait_control_cached); 194 + 211 195 ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "umwait:online", 212 - umwait_cpu_online, NULL); 196 + umwait_cpu_online, umwait_cpu_offline); 197 + if (ret < 0) { 198 + /* 199 + * On failure, the control MSR on all CPUs has the 200 + * original control value. 201 + */ 202 + return ret; 203 + } 213 204 214 205 register_syscore_ops(&umwait_syscore_ops); 215 206
+3 -2
arch/x86/math-emu/errors.c
··· 178 178 for (i = 0; i < 8; i++) { 179 179 FPU_REG *r = &st(i); 180 180 u_char tagi = FPU_gettagi(i); 181 + 181 182 switch (tagi) { 182 183 case TAG_Empty: 183 184 continue; 184 - break; 185 185 case TAG_Zero: 186 186 case TAG_Special: 187 + /* Update tagi for the printk below */ 187 188 tagi = FPU_Special(r); 189 + /* fall through */ 188 190 case TAG_Valid: 189 191 printk("st(%d) %c .%04lx %04lx %04lx %04lx e%+-6d ", i, 190 192 getsign(r) ? '-' : '+', ··· 200 198 printk("Whoops! Error in errors.c: tag%d is %d ", i, 201 199 tagi); 202 200 continue; 203 - break; 204 201 } 205 202 printk("%s\n", tag_desc[(int)(unsigned)tagi]); 206 203 }
+1 -1
arch/x86/math-emu/fpu_trig.c
··· 1352 1352 case TW_Denormal: 1353 1353 if (denormal_operand() < 0) 1354 1354 return; 1355 - 1355 + /* fall through */ 1356 1356 case TAG_Zero: 1357 1357 case TAG_Valid: 1358 1358 setsign(st0_ptr, getsign(st0_ptr) ^ getsign(st1_ptr));