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 tag 'x86-urgent-2025-12-21' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Ingo Molnar:

- Fix FPU core dumps on certain CPU models

- Fix htmldocs build warning

- Export TLB tracing event name via header

- Remove unused constant from <linux/mm_types.h>

- Fix comments

- Fix whitespace noise in documentation

- Fix variadic structure's definition to un-confuse UBSAN

- Fix posted MSI interrupts irq_retrigger() bug

- Fix asm build failure with older GCC builds

* tag 'x86-urgent-2025-12-21' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/bug: Fix old GCC compile fails
x86/msi: Make irq_retrigger() functional for posted MSI
x86/platform/uv: Fix UBSAN array-index-out-of-bounds
mm: Remove tlb_flush_reason::NR_TLB_FLUSH_REASONS from <linux/mm_types.h>
x86/mm/tlb/trace: Export the TLB_REMOTE_WRONG_CPU enum in <trace/events/tlb.h>
x86/sgx: Remove unmatched quote in __sgx_encl_extend function comment
x86/boot/Documentation: Fix whitespace noise in boot.rst
x86/fpu: Fix FPU state core dump truncation on CPUs with no extended xfeatures
x86/boot/Documentation: Fix htmldocs build warning due to malformed table in boot.rst

+138 -108
+96 -96
Documentation/arch/x86/boot.rst
··· 95 95 The traditional memory map for the kernel loader, used for Image or 96 96 zImage kernels, typically looks like:: 97 97 98 - | | 98 + | | 99 99 0A0000 +------------------------+ 100 - | Reserved for BIOS | Do not use. Reserved for BIOS EBDA. 100 + | Reserved for BIOS | Do not use. Reserved for BIOS EBDA. 101 101 09A000 +------------------------+ 102 - | Command line | 103 - | Stack/heap | For use by the kernel real-mode code. 102 + | Command line | 103 + | Stack/heap | For use by the kernel real-mode code. 104 104 098000 +------------------------+ 105 - | Kernel setup | The kernel real-mode code. 105 + | Kernel setup | The kernel real-mode code. 106 106 090200 +------------------------+ 107 - | Kernel boot sector | The kernel legacy boot sector. 107 + | Kernel boot sector | The kernel legacy boot sector. 108 108 090000 +------------------------+ 109 - | Protected-mode kernel | The bulk of the kernel image. 109 + | Protected-mode kernel | The bulk of the kernel image. 110 110 010000 +------------------------+ 111 - | Boot loader | <- Boot sector entry point 0000:7C00 111 + | Boot loader | <- Boot sector entry point 0000:7C00 112 112 001000 +------------------------+ 113 - | Reserved for MBR/BIOS | 113 + | Reserved for MBR/BIOS | 114 114 000800 +------------------------+ 115 - | Typically used by MBR | 115 + | Typically used by MBR | 116 116 000600 +------------------------+ 117 - | BIOS use only | 117 + | BIOS use only | 118 118 000000 +------------------------+ 119 119 120 120 When using bzImage, the protected-mode kernel was relocated to ··· 142 142 For a modern bzImage kernel with boot protocol version >= 2.02, a 143 143 memory layout like the following is suggested:: 144 144 145 - ~ ~ 146 - | Protected-mode kernel | 145 + ~ ~ 146 + | Protected-mode kernel | 147 147 100000 +------------------------+ 148 - | I/O memory hole | 148 + | I/O memory hole | 149 149 0A0000 +------------------------+ 150 - | Reserved for BIOS | Leave as much as possible unused 151 - ~ ~ 152 - | Command line | (Can also be below the X+10000 mark) 150 + | Reserved for BIOS | Leave as much as possible unused 151 + ~ ~ 152 + | Command line | (Can also be below the X+10000 mark) 153 153 X+10000 +------------------------+ 154 - | Stack/heap | For use by the kernel real-mode code. 154 + | Stack/heap | For use by the kernel real-mode code. 155 155 X+08000 +------------------------+ 156 - | Kernel setup | The kernel real-mode code. 157 - | Kernel boot sector | The kernel legacy boot sector. 156 + | Kernel setup | The kernel real-mode code. 157 + | Kernel boot sector | The kernel legacy boot sector. 158 158 X +------------------------+ 159 - | Boot loader | <- Boot sector entry point 0000:7C00 159 + | Boot loader | <- Boot sector entry point 0000:7C00 160 160 001000 +------------------------+ 161 - | Reserved for MBR/BIOS | 161 + | Reserved for MBR/BIOS | 162 162 000800 +------------------------+ 163 - | Typically used by MBR | 163 + | Typically used by MBR | 164 164 000600 +------------------------+ 165 - | BIOS use only | 165 + | BIOS use only | 166 166 000000 +------------------------+ 167 167 168 168 ... where the address X is as low as the design of the boot loader permits. ··· 433 433 434 434 Assigned boot loader IDs: 435 435 436 - == ======================================= 436 + ==== ======================================= 437 437 0x0 LILO 438 438 (0x00 reserved for pre-2.00 bootloader) 439 439 0x1 Loadlin ··· 456 456 <http://sebastian-plotz.blogspot.de> 457 457 0x12 OVMF UEFI virtualization stack 458 458 0x13 barebox 459 - == ======================================= 459 + ==== ======================================= 460 460 461 461 Please contact <hpa@zytor.com> if you need a bootloader ID value assigned. 462 462 ··· 809 809 as follow:: 810 810 811 811 struct setup_data { 812 - __u64 next; 813 - __u32 type; 814 - __u32 len; 815 - __u8 data[]; 812 + __u64 next; 813 + __u32 type; 814 + __u32 len; 815 + __u8 data[]; 816 816 } 817 - 817 + 818 818 Where, the next is a 64-bit physical pointer to the next node of 819 819 linked list, the next field of the last node is 0; the type is used 820 820 to identify the contents of data; the len is the length of data ··· 835 835 protocol 2.15:: 836 836 837 837 struct setup_indirect { 838 - __u32 type; 839 - __u32 reserved; /* Reserved, must be set to zero. */ 840 - __u64 len; 841 - __u64 addr; 838 + __u32 type; 839 + __u32 reserved; /* Reserved, must be set to zero. */ 840 + __u64 len; 841 + __u64 addr; 842 842 }; 843 843 844 844 The type member is a SETUP_INDIRECT | SETUP_* type. However, it cannot be ··· 850 850 In this case setup_data and setup_indirect will look like this:: 851 851 852 852 struct setup_data { 853 - .next = 0, /* or <addr_of_next_setup_data_struct> */ 854 - .type = SETUP_INDIRECT, 855 - .len = sizeof(setup_indirect), 856 - .data[sizeof(setup_indirect)] = (struct setup_indirect) { 857 - .type = SETUP_INDIRECT | SETUP_E820_EXT, 858 - .reserved = 0, 859 - .len = <len_of_SETUP_E820_EXT_data>, 860 - .addr = <addr_of_SETUP_E820_EXT_data>, 861 - }, 853 + .next = 0, /* or <addr_of_next_setup_data_struct> */ 854 + .type = SETUP_INDIRECT, 855 + .len = sizeof(setup_indirect), 856 + .data[sizeof(setup_indirect)] = (struct setup_indirect) { 857 + .type = SETUP_INDIRECT | SETUP_E820_EXT, 858 + .reserved = 0, 859 + .len = <len_of_SETUP_E820_EXT_data>, 860 + .addr = <addr_of_SETUP_E820_EXT_data>, 861 + }, 862 862 } 863 863 864 864 .. note:: ··· 897 897 The kernel runtime start address is determined by the following algorithm:: 898 898 899 899 if (relocatable_kernel) { 900 - if (load_address < pref_address) 901 - load_address = pref_address; 902 - runtime_start = align_up(load_address, kernel_alignment); 900 + if (load_address < pref_address) 901 + load_address = pref_address; 902 + runtime_start = align_up(load_address, kernel_alignment); 903 903 } else { 904 - runtime_start = pref_address; 904 + runtime_start = pref_address; 905 905 } 906 906 907 907 Hence the necessary memory window location and size can be estimated by ··· 975 975 be prefixed with header/magic and its size, e.g.:: 976 976 977 977 kernel_info: 978 - .ascii "LToP" /* Header, Linux top (structure). */ 979 - .long kernel_info_var_len_data - kernel_info 980 - .long kernel_info_end - kernel_info 981 - .long 0x01234567 /* Some fixed size data for the bootloaders. */ 978 + .ascii "LToP" /* Header, Linux top (structure). */ 979 + .long kernel_info_var_len_data - kernel_info 980 + .long kernel_info_end - kernel_info 981 + .long 0x01234567 /* Some fixed size data for the bootloaders. */ 982 982 kernel_info_var_len_data: 983 983 example_struct: /* Some variable size data for the bootloaders. */ 984 - .ascii "0123" /* Header/Magic. */ 985 - .long example_struct_end - example_struct 986 - .ascii "Struct" 987 - .long 0x89012345 984 + .ascii "0123" /* Header/Magic. */ 985 + .long example_struct_end - example_struct 986 + .ascii "Struct" 987 + .long 0x89012345 988 988 example_struct_end: 989 989 example_strings: /* Some variable size data for the bootloaders. */ 990 - .ascii "ABCD" /* Header/Magic. */ 991 - .long example_strings_end - example_strings 992 - .asciz "String_0" 993 - .asciz "String_1" 990 + .ascii "ABCD" /* Header/Magic. */ 991 + .long example_strings_end - example_strings 992 + .asciz "String_0" 993 + .asciz "String_1" 994 994 example_strings_end: 995 995 kernel_info_end: 996 996 ··· 1132 1132 unsigned long base_ptr; /* base address for real-mode segment */ 1133 1133 1134 1134 if (setup_sects == 0) 1135 - setup_sects = 4; 1135 + setup_sects = 4; 1136 1136 1137 1137 if (protocol >= 0x0200) { 1138 - type_of_loader = <type code>; 1139 - if (loading_initrd) { 1140 - ramdisk_image = <initrd_address>; 1141 - ramdisk_size = <initrd_size>; 1142 - } 1138 + type_of_loader = <type code>; 1139 + if (loading_initrd) { 1140 + ramdisk_image = <initrd_address>; 1141 + ramdisk_size = <initrd_size>; 1142 + } 1143 1143 1144 - if (protocol >= 0x0202 && loadflags & 0x01) 1145 - heap_end = 0xe000; 1146 - else 1147 - heap_end = 0x9800; 1144 + if (protocol >= 0x0202 && loadflags & 0x01) 1145 + heap_end = 0xe000; 1146 + else 1147 + heap_end = 0x9800; 1148 1148 1149 - if (protocol >= 0x0201) { 1150 - heap_end_ptr = heap_end - 0x200; 1151 - loadflags |= 0x80; /* CAN_USE_HEAP */ 1152 - } 1149 + if (protocol >= 0x0201) { 1150 + heap_end_ptr = heap_end - 0x200; 1151 + loadflags |= 0x80; /* CAN_USE_HEAP */ 1152 + } 1153 1153 1154 - if (protocol >= 0x0202) { 1155 - cmd_line_ptr = base_ptr + heap_end; 1156 - strcpy(cmd_line_ptr, cmdline); 1157 - } else { 1158 - cmd_line_magic = 0xA33F; 1159 - cmd_line_offset = heap_end; 1160 - setup_move_size = heap_end + strlen(cmdline) + 1; 1161 - strcpy(base_ptr + cmd_line_offset, cmdline); 1162 - } 1154 + if (protocol >= 0x0202) { 1155 + cmd_line_ptr = base_ptr + heap_end; 1156 + strcpy(cmd_line_ptr, cmdline); 1157 + } else { 1158 + cmd_line_magic = 0xA33F; 1159 + cmd_line_offset = heap_end; 1160 + setup_move_size = heap_end + strlen(cmdline) + 1; 1161 + strcpy(base_ptr + cmd_line_offset, cmdline); 1162 + } 1163 1163 } else { 1164 - /* Very old kernel */ 1164 + /* Very old kernel */ 1165 1165 1166 - heap_end = 0x9800; 1166 + heap_end = 0x9800; 1167 1167 1168 - cmd_line_magic = 0xA33F; 1169 - cmd_line_offset = heap_end; 1168 + cmd_line_magic = 0xA33F; 1169 + cmd_line_offset = heap_end; 1170 1170 1171 - /* A very old kernel MUST have its real-mode code loaded at 0x90000 */ 1172 - if (base_ptr != 0x90000) { 1173 - /* Copy the real-mode kernel */ 1174 - memcpy(0x90000, base_ptr, (setup_sects + 1) * 512); 1175 - base_ptr = 0x90000; /* Relocated */ 1176 - } 1171 + /* A very old kernel MUST have its real-mode code loaded at 0x90000 */ 1172 + if (base_ptr != 0x90000) { 1173 + /* Copy the real-mode kernel */ 1174 + memcpy(0x90000, base_ptr, (setup_sects + 1) * 512); 1175 + base_ptr = 0x90000; /* Relocated */ 1176 + } 1177 1177 1178 - strcpy(0x90000 + cmd_line_offset, cmdline); 1178 + strcpy(0x90000 + cmd_line_offset, cmdline); 1179 1179 1180 - /* It is recommended to clear memory up to the 32K mark */ 1181 - memset(0x90000 + (setup_sects + 1) * 512, 0, (64 - (setup_sects + 1)) * 512); 1180 + /* It is recommended to clear memory up to the 32K mark */ 1181 + memset(0x90000 + (setup_sects + 1) * 512, 0, (64 - (setup_sects + 1)) * 512); 1182 1182 } 1183 1183 1184 1184
+1 -1
arch/x86/include/asm/bug.h
··· 15 15 /* 16 16 * Despite that some emulators terminate on UD2, we use it for WARN(). 17 17 */ 18 - #define ASM_UD2 _ASM_BYTES(0x0f, 0x0b) 18 + #define ASM_UD2 __ASM_FORM(ud2) 19 19 #define INSN_UD2 0x0b0f 20 20 #define LEN_UD2 2 21 21
+7
arch/x86/include/asm/irq_remapping.h
··· 87 87 } 88 88 89 89 #endif /* CONFIG_IRQ_REMAP */ 90 + 91 + #ifdef CONFIG_X86_POSTED_MSI 92 + void intel_ack_posted_msi_irq(struct irq_data *irqd); 93 + #else 94 + #define intel_ack_posted_msi_irq NULL 95 + #endif 96 + 90 97 #endif /* __X86_IRQ_REMAPPING_H */
+1 -1
arch/x86/include/asm/uv/bios.h
··· 122 122 struct { 123 123 u32 type:8; /* type of entry */ 124 124 u32 offset:24; /* byte offset from struct start to entry */ 125 - } entry[1]; /* additional entries follow */ 125 + } entry[]; /* additional entries follow */ 126 126 }; 127 127 extern struct uv_systab *uv_systab; 128 128
+1 -1
arch/x86/kernel/cpu/sgx/ioctl.c
··· 242 242 /* 243 243 * If the caller requires measurement of the page as a proof for the content, 244 244 * use EEXTEND to add a measurement for 256 bytes of the page. Repeat this 245 - * operation until the entire page is measured." 245 + * operation until the entire page is measured. 246 246 */ 247 247 static int __sgx_encl_extend(struct sgx_encl *encl, 248 248 struct sgx_epc_page *epc_page)
+2 -2
arch/x86/kernel/fpu/xstate.c
··· 1946 1946 }; 1947 1947 1948 1948 if (!dump_emit(cprm, &xc, sizeof(xc))) 1949 - return 0; 1949 + return -1; 1950 1950 1951 1951 num_records++; 1952 1952 } ··· 1984 1984 return 1; 1985 1985 1986 1986 num_records = dump_xsave_layout_desc(cprm); 1987 - if (!num_records) 1987 + if (num_records < 0) 1988 1988 return 1; 1989 1989 1990 1990 /* Total size should be equal to the number of records */
+23
arch/x86/kernel/irq.c
··· 397 397 398 398 /* Posted Interrupt Descriptors for coalesced MSIs to be posted */ 399 399 DEFINE_PER_CPU_ALIGNED(struct pi_desc, posted_msi_pi_desc); 400 + static DEFINE_PER_CPU_CACHE_HOT(bool, posted_msi_handler_active); 400 401 401 402 void intel_posted_msi_init(void) 402 403 { ··· 413 412 apic_id = this_cpu_read(x86_cpu_to_apicid); 414 413 destination = x2apic_enabled() ? apic_id : apic_id << 8; 415 414 this_cpu_write(posted_msi_pi_desc.ndst, destination); 415 + } 416 + 417 + void intel_ack_posted_msi_irq(struct irq_data *irqd) 418 + { 419 + irq_move_irq(irqd); 420 + 421 + /* 422 + * Handle the rare case that irq_retrigger() raised the actual 423 + * assigned vector on the target CPU, which means that it was not 424 + * invoked via the posted MSI handler below. In that case APIC EOI 425 + * is required as otherwise the ISR entry becomes stale and lower 426 + * priority interrupts are never going to be delivered after that. 427 + * 428 + * If the posted handler invoked the device interrupt handler then 429 + * the EOI would be premature because it would acknowledge the 430 + * posted vector. 431 + */ 432 + if (unlikely(!__this_cpu_read(posted_msi_handler_active))) 433 + apic_eoi(); 416 434 } 417 435 418 436 static __always_inline bool handle_pending_pir(unsigned long *pir, struct pt_regs *regs) ··· 466 446 467 447 pid = this_cpu_ptr(&posted_msi_pi_desc); 468 448 449 + /* Mark the handler active for intel_ack_posted_msi_irq() */ 450 + __this_cpu_write(posted_msi_handler_active, true); 469 451 inc_irq_stat(posted_msi_notification_count); 470 452 irq_enter(); 471 453 ··· 496 474 497 475 apic_eoi(); 498 476 irq_exit(); 477 + __this_cpu_write(posted_msi_handler_active, false); 499 478 set_irq_regs(old_regs); 500 479 } 501 480 #endif /* X86_POSTED_MSI */
+4 -4
drivers/iommu/intel/irq_remapping.c
··· 1303 1303 * irq_enter(); 1304 1304 * handle_edge_irq() 1305 1305 * irq_chip_ack_parent() 1306 - * irq_move_irq(); // No EOI 1306 + * intel_ack_posted_msi_irq(); // No EOI 1307 1307 * handle_irq_event() 1308 1308 * driver_handler() 1309 1309 * handle_edge_irq() 1310 1310 * irq_chip_ack_parent() 1311 - * irq_move_irq(); // No EOI 1311 + * intel_ack_posted_msi_irq(); // No EOI 1312 1312 * handle_irq_event() 1313 1313 * driver_handler() 1314 1314 * handle_edge_irq() 1315 1315 * irq_chip_ack_parent() 1316 - * irq_move_irq(); // No EOI 1316 + * intel_ack_posted_msi_irq(); // No EOI 1317 1317 * handle_irq_event() 1318 1318 * driver_handler() 1319 1319 * apic_eoi() ··· 1322 1322 */ 1323 1323 static struct irq_chip intel_ir_chip_post_msi = { 1324 1324 .name = "INTEL-IR-POST", 1325 - .irq_ack = irq_move_irq, 1325 + .irq_ack = intel_ack_posted_msi_irq, 1326 1326 .irq_set_affinity = intel_ir_set_affinity, 1327 1327 .irq_compose_msi_msg = intel_ir_compose_msi_msg, 1328 1328 .irq_set_vcpu_affinity = intel_ir_set_vcpu_affinity,
-1
include/linux/mm_types.h
··· 1631 1631 TLB_LOCAL_MM_SHOOTDOWN, 1632 1632 TLB_REMOTE_SEND_IPI, 1633 1633 TLB_REMOTE_WRONG_CPU, 1634 - NR_TLB_FLUSH_REASONS, 1635 1634 }; 1636 1635 1637 1636 /**
+3 -2
include/trace/events/tlb.h
··· 12 12 EM( TLB_FLUSH_ON_TASK_SWITCH, "flush on task switch" ) \ 13 13 EM( TLB_REMOTE_SHOOTDOWN, "remote shootdown" ) \ 14 14 EM( TLB_LOCAL_SHOOTDOWN, "local shootdown" ) \ 15 - EM( TLB_LOCAL_MM_SHOOTDOWN, "local mm shootdown" ) \ 16 - EMe( TLB_REMOTE_SEND_IPI, "remote ipi send" ) 15 + EM( TLB_LOCAL_MM_SHOOTDOWN, "local MM shootdown" ) \ 16 + EM( TLB_REMOTE_SEND_IPI, "remote IPI send" ) \ 17 + EMe( TLB_REMOTE_WRONG_CPU, "remote wrong CPU" ) 17 18 18 19 /* 19 20 * First define the enums in TLB_FLUSH_REASON to be exported to userspace