Skip to content

Commit fffb5cd

Browse files
committed
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
2 parents 3551e67 + e5f1e8a commit fffb5cd

File tree

7 files changed

+44
-31
lines changed

7 files changed

+44
-31
lines changed

arch/x86/include/asm/iosf_mbi.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,6 @@ void iosf_mbi_unblock_punit_i2c_access(void);
167167
*/
168168
int iosf_mbi_register_pmic_bus_access_notifier(struct notifier_block *nb);
169169

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-
177170
/**
178171
* iosf_mbi_unregister_pmic_bus_access_notifier_unlocked - Unregister PMIC bus
179172
* notifier, unlocked

arch/x86/lib/copy_user_64.S

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,24 @@ SYM_FUNC_START(rep_movs_alternative)
7777
_ASM_EXTABLE_UA( 0b, 1b)
7878

7979
.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 */
8098
movq %rcx,%rax
8199
shrq $3,%rcx
82100
andl $7,%eax

arch/x86/mm/init_64.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -959,9 +959,18 @@ int add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages,
959959
ret = __add_pages(nid, start_pfn, nr_pages, params);
960960
WARN_ON_ONCE(ret);
961961

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);
965974

966975
return ret;
967976
}

arch/x86/platform/intel/iosf_mbi.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -422,19 +422,6 @@ int iosf_mbi_unregister_pmic_bus_access_notifier_unlocked(
422422
}
423423
EXPORT_SYMBOL(iosf_mbi_unregister_pmic_bus_access_notifier_unlocked);
424424

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-
438425
void iosf_mbi_assert_punit_acquired(void)
439426
{
440427
WARN_ON(iosf_mbi_pmic_punit_access_count == 0);

arch/x86/power/cpu.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <asm/mmu_context.h>
2828
#include <asm/cpu_device_id.h>
2929
#include <asm/microcode.h>
30+
#include <asm/fred.h>
3031

3132
#ifdef CONFIG_X86_32
3233
__visible unsigned long saved_context_ebx;
@@ -231,6 +232,19 @@ static void notrace __restore_processor_state(struct saved_context *ctxt)
231232
*/
232233
#ifdef CONFIG_X86_64
233234
wrmsrl(MSR_GS_BASE, ctxt->kernelmode_gs_base);
235+
236+
/*
237+
* Reinitialize FRED to ensure the FRED MSRs contain the same values
238+
* as before hibernation.
239+
*
240+
* Note, the setup of FRED RSPs requires access to percpu data
241+
* structures. Therefore, FRED reinitialization can only occur after
242+
* the percpu access pointer (i.e., MSR_GS_BASE) is restored.
243+
*/
244+
if (ctxt->cr4 & X86_CR4_FRED) {
245+
cpu_init_fred_exceptions();
246+
cpu_init_fred_rsps();
247+
}
234248
#else
235249
loadsegment(fs, __KERNEL_PERCPU);
236250
#endif

arch/x86/tools/insn_decoder_test.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#include <stdarg.h>
1313
#include <linux/kallsyms.h>
1414

15-
#define unlikely(cond) (cond)
16-
1715
#include <asm/insn.h>
1816
#include <inat.c>
1917
#include <insn.c>

drivers/gpu/drm/i915/i915_iosf_mbi.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ iosf_mbi_unregister_pmic_bus_access_notifier_unlocked(struct notifier_block *nb)
3131
{
3232
return 0;
3333
}
34-
35-
static inline
36-
int iosf_mbi_unregister_pmic_bus_access_notifier(struct notifier_block *nb)
37-
{
38-
return 0;
39-
}
4034
#endif
4135

4236
#endif /* __I915_IOSF_MBI_H__ */

0 commit comments

Comments
 (0)