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

Merge tag 'x86-urgent-2025-04-04' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Ingo Molnar:

- Fix a performance regression on AMD iGPU and dGPU drivers, related to
the unintended activation of DMA bounce buffers that regressed game
performance if KASLR disturbed things just enough

- Fix a copy_user_generic() performance regression on certain older
non-FSRM/ERMS CPUs

- Fix a Clang build warning due to a semantic merge conflict the Kunit
tree generated with the x86 tree

- Fix FRED related system hang during S4 resume

- Remove an unused API

* tag 'x86-urgent-2025-04-04' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/fred: Fix system hang during S4 resume with FRED enabled
x86/platform/iosf_mbi: Remove unused iosf_mbi_unregister_pmic_bus_access_notifier()
x86/mm/init: Handle the special case of device private pages in add_pages(), to not increase max_pfn and trigger dma_addressing_limited() bounce buffers
x86/tools: Drop duplicate unlikely() definition in insn_decoder_test.c
x86/uaccess: Improve performance by aligning writes to 8 bytes in copy_user_generic(), on non-FSRM/ERMS CPUs

+44 -31
-7
arch/x86/include/asm/iosf_mbi.h
··· 168 168 int iosf_mbi_register_pmic_bus_access_notifier(struct notifier_block *nb); 169 169 170 170 /** 171 - * iosf_mbi_register_pmic_bus_access_notifier - Unregister PMIC bus notifier 172 - * 173 - * @nb: notifier_block to unregister 174 - */ 175 - int iosf_mbi_unregister_pmic_bus_access_notifier(struct notifier_block *nb); 176 - 177 - /** 178 171 * iosf_mbi_unregister_pmic_bus_access_notifier_unlocked - Unregister PMIC bus 179 172 * notifier, unlocked 180 173 *
+18
arch/x86/lib/copy_user_64.S
··· 77 77 _ASM_EXTABLE_UA( 0b, 1b) 78 78 79 79 .Llarge_movsq: 80 + /* Do the first possibly unaligned word */ 81 + 0: movq (%rsi),%rax 82 + 1: movq %rax,(%rdi) 83 + 84 + _ASM_EXTABLE_UA( 0b, .Lcopy_user_tail) 85 + _ASM_EXTABLE_UA( 1b, .Lcopy_user_tail) 86 + 87 + /* What would be the offset to the aligned destination? */ 88 + leaq 8(%rdi),%rax 89 + andq $-8,%rax 90 + subq %rdi,%rax 91 + 92 + /* .. and update pointers and count to match */ 93 + addq %rax,%rdi 94 + addq %rax,%rsi 95 + subq %rax,%rcx 96 + 97 + /* make %rcx contain the number of words, %rax the remainder */ 80 98 movq %rcx,%rax 81 99 shrq $3,%rcx 82 100 andl $7,%eax
+12 -3
arch/x86/mm/init_64.c
··· 959 959 ret = __add_pages(nid, start_pfn, nr_pages, params); 960 960 WARN_ON_ONCE(ret); 961 961 962 - /* update max_pfn, max_low_pfn and high_memory */ 963 - update_end_of_memory_vars(start_pfn << PAGE_SHIFT, 964 - nr_pages << PAGE_SHIFT); 962 + /* 963 + * Special case: add_pages() is called by memremap_pages() for adding device 964 + * private pages. Do not bump up max_pfn in the device private path, 965 + * because max_pfn changes affect dma_addressing_limited(). 966 + * 967 + * dma_addressing_limited() returning true when max_pfn is the device's 968 + * addressable memory can force device drivers to use bounce buffers 969 + * and impact their performance negatively: 970 + */ 971 + if (!params->pgmap) 972 + /* update max_pfn, max_low_pfn and high_memory */ 973 + update_end_of_memory_vars(start_pfn << PAGE_SHIFT, nr_pages << PAGE_SHIFT); 965 974 966 975 return ret; 967 976 }
-13
arch/x86/platform/intel/iosf_mbi.c
··· 422 422 } 423 423 EXPORT_SYMBOL(iosf_mbi_unregister_pmic_bus_access_notifier_unlocked); 424 424 425 - int iosf_mbi_unregister_pmic_bus_access_notifier(struct notifier_block *nb) 426 - { 427 - int ret; 428 - 429 - /* Wait for the bus to go inactive before unregistering */ 430 - iosf_mbi_punit_acquire(); 431 - ret = iosf_mbi_unregister_pmic_bus_access_notifier_unlocked(nb); 432 - iosf_mbi_punit_release(); 433 - 434 - return ret; 435 - } 436 - EXPORT_SYMBOL(iosf_mbi_unregister_pmic_bus_access_notifier); 437 - 438 425 void iosf_mbi_assert_punit_acquired(void) 439 426 { 440 427 WARN_ON(iosf_mbi_pmic_punit_access_count == 0);
+14
arch/x86/power/cpu.c
··· 27 27 #include <asm/mmu_context.h> 28 28 #include <asm/cpu_device_id.h> 29 29 #include <asm/microcode.h> 30 + #include <asm/fred.h> 30 31 31 32 #ifdef CONFIG_X86_32 32 33 __visible unsigned long saved_context_ebx; ··· 232 231 */ 233 232 #ifdef CONFIG_X86_64 234 233 wrmsrl(MSR_GS_BASE, ctxt->kernelmode_gs_base); 234 + 235 + /* 236 + * Reinitialize FRED to ensure the FRED MSRs contain the same values 237 + * as before hibernation. 238 + * 239 + * Note, the setup of FRED RSPs requires access to percpu data 240 + * structures. Therefore, FRED reinitialization can only occur after 241 + * the percpu access pointer (i.e., MSR_GS_BASE) is restored. 242 + */ 243 + if (ctxt->cr4 & X86_CR4_FRED) { 244 + cpu_init_fred_exceptions(); 245 + cpu_init_fred_rsps(); 246 + } 235 247 #else 236 248 loadsegment(fs, __KERNEL_PERCPU); 237 249 #endif
-2
arch/x86/tools/insn_decoder_test.c
··· 12 12 #include <stdarg.h> 13 13 #include <linux/kallsyms.h> 14 14 15 - #define unlikely(cond) (cond) 16 - 17 15 #include <asm/insn.h> 18 16 #include <inat.c> 19 17 #include <insn.c>
-6
drivers/gpu/drm/i915/i915_iosf_mbi.h
··· 31 31 { 32 32 return 0; 33 33 } 34 - 35 - static inline 36 - int iosf_mbi_unregister_pmic_bus_access_notifier(struct notifier_block *nb) 37 - { 38 - return 0; 39 - } 40 34 #endif 41 35 42 36 #endif /* __I915_IOSF_MBI_H__ */