* [PATCH AUTOSEL 5.10 01/10] watch_queue: fix kcalloc() arguments order
@ 2024-01-15 23:27 Sasha Levin
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 02/10] powerpc/mm: Fix null-pointer dereference in pgtable_cache_add Sasha Levin
` (9 more replies)
0 siblings, 10 replies; 13+ messages in thread
From: Sasha Levin @ 2024-01-15 23:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Dmitry Antipov, Christian Brauner, Sasha Levin, zack.rusin,
mcgrof, pstanner, nick.alcock, code, ddiss
From: Dmitry Antipov <dmantipov@yandex.ru>
[ Upstream commit 1bfc466b13cf6652ba227c282c27a30ffede69a5 ]
When compiling with gcc version 14.0.0 20231220 (experimental)
and W=1, I've noticed the following warning:
kernel/watch_queue.c: In function 'watch_queue_set_size':
kernel/watch_queue.c:273:32: warning: 'kcalloc' sizes specified with 'sizeof'
in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
273 | pages = kcalloc(sizeof(struct page *), nr_pages, GFP_KERNEL);
| ^~~~~~
Since 'n' and 'size' arguments of 'kcalloc()' are multiplied to
calculate the final size, their actual order doesn't affect the
result and so this is not a bug. But it's still worth to fix it.
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Link: https://lore.kernel.org/r/20231221090139.12579-1-dmantipov@yandex.ru
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/watch_queue.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c
index 73717917d816..5f15a921a8d0 100644
--- a/kernel/watch_queue.c
+++ b/kernel/watch_queue.c
@@ -275,7 +275,7 @@ long watch_queue_set_size(struct pipe_inode_info *pipe, unsigned int nr_notes)
goto error;
ret = -ENOMEM;
- pages = kcalloc(sizeof(struct page *), nr_pages, GFP_KERNEL);
+ pages = kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL);
if (!pages)
goto error;
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH AUTOSEL 5.10 02/10] powerpc/mm: Fix null-pointer dereference in pgtable_cache_add
2024-01-15 23:27 [PATCH AUTOSEL 5.10 01/10] watch_queue: fix kcalloc() arguments order Sasha Levin
@ 2024-01-15 23:27 ` Sasha Levin
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 03/10] drivers/perf: pmuv3: don't expose SW_INCR event in sysfs Sasha Levin
` (8 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2024-01-15 23:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Kunwu Chan, Christophe Leroy, Michael Ellerman, Sasha Levin,
linuxppc-dev
From: Kunwu Chan <chentao@kylinos.cn>
[ Upstream commit f46c8a75263f97bda13c739ba1c90aced0d3b071 ]
kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure. Ensure the allocation was successful
by checking the pointer validity.
Suggested-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231204023223.2447523-1-chentao@kylinos.cn
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/powerpc/mm/init-common.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/mm/init-common.c b/arch/powerpc/mm/init-common.c
index 8e0d792ac296..52a20c97e46e 100644
--- a/arch/powerpc/mm/init-common.c
+++ b/arch/powerpc/mm/init-common.c
@@ -111,7 +111,7 @@ void pgtable_cache_add(unsigned int shift)
* as to leave enough 0 bits in the address to contain it. */
unsigned long minalign = max(MAX_PGTABLE_INDEX_SIZE + 1,
HUGEPD_SHIFT_MASK + 1);
- struct kmem_cache *new;
+ struct kmem_cache *new = NULL;
/* It would be nice if this was a BUILD_BUG_ON(), but at the
* moment, gcc doesn't seem to recognize is_power_of_2 as a
@@ -124,7 +124,8 @@ void pgtable_cache_add(unsigned int shift)
align = max_t(unsigned long, align, minalign);
name = kasprintf(GFP_KERNEL, "pgtable-2^%d", shift);
- new = kmem_cache_create(name, table_size, align, 0, ctor(shift));
+ if (name)
+ new = kmem_cache_create(name, table_size, align, 0, ctor(shift));
if (!new)
panic("Could not allocate pgtable cache for order %d", shift);
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH AUTOSEL 5.10 03/10] drivers/perf: pmuv3: don't expose SW_INCR event in sysfs
2024-01-15 23:27 [PATCH AUTOSEL 5.10 01/10] watch_queue: fix kcalloc() arguments order Sasha Levin
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 02/10] powerpc/mm: Fix null-pointer dereference in pgtable_cache_add Sasha Levin
@ 2024-01-15 23:27 ` Sasha Levin
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 04/10] powerpc: Fix build error due to is_valid_bugaddr() Sasha Levin
` (7 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2024-01-15 23:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Mark Rutland, Will Deacon, Sasha Levin, peterz, mingo, acme,
catalin.marinas, linux-arm-kernel, linux-perf-users
From: Mark Rutland <mark.rutland@arm.com>
[ Upstream commit ca6f537e459e2da4b331fe8928d1a0b0f9301f42 ]
The SW_INCR event is somewhat unusual, and depends on the specific HW
counter that it is programmed into. When programmed into PMEVCNTR<n>,
SW_INCR will count any writes to PMSWINC_EL0 with bit n set, ignoring
writes to SW_INCR with bit n clear.
Event rotation means that there's no fixed relationship between
perf_events and HW counters, so this isn't all that useful.
Further, we program PMUSERENR.{SW,EN}=={0,0}, which causes EL0 writes to
PMSWINC_EL0 to be trapped and handled as UNDEFINED, resulting in a
SIGILL to userspace.
Given that, it's not a good idea to expose SW_INCR in sysfs. Hide it as
we did for CHAIN back in commit:
4ba2578fa7b55701 ("arm64: perf: don't expose CHAIN event in sysfs")
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20231204115847.2993026-1-mark.rutland@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm64/kernel/perf_event.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
index cdb3d4549b3a..8e428f8dd108 100644
--- a/arch/arm64/kernel/perf_event.c
+++ b/arch/arm64/kernel/perf_event.c
@@ -171,7 +171,11 @@ armv8pmu_events_sysfs_show(struct device *dev,
}).attr.attr)
static struct attribute *armv8_pmuv3_event_attrs[] = {
- ARMV8_EVENT_ATTR(sw_incr, ARMV8_PMUV3_PERFCTR_SW_INCR),
+ /*
+ * Don't expose the sw_incr event in /sys. It's not usable as writes to
+ * PMSWINC_EL0 will trap as PMUSERENR.{SW,EN}=={0,0} and event rotation
+ * means we don't have a fixed event<->counter relationship regardless.
+ */
ARMV8_EVENT_ATTR(l1i_cache_refill, ARMV8_PMUV3_PERFCTR_L1I_CACHE_REFILL),
ARMV8_EVENT_ATTR(l1i_tlb_refill, ARMV8_PMUV3_PERFCTR_L1I_TLB_REFILL),
ARMV8_EVENT_ATTR(l1d_cache_refill, ARMV8_PMUV3_PERFCTR_L1D_CACHE_REFILL),
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH AUTOSEL 5.10 04/10] powerpc: Fix build error due to is_valid_bugaddr()
2024-01-15 23:27 [PATCH AUTOSEL 5.10 01/10] watch_queue: fix kcalloc() arguments order Sasha Levin
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 02/10] powerpc/mm: Fix null-pointer dereference in pgtable_cache_add Sasha Levin
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 03/10] drivers/perf: pmuv3: don't expose SW_INCR event in sysfs Sasha Levin
@ 2024-01-15 23:27 ` Sasha Levin
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 05/10] powerpc/mm: Fix build failures due to arch_reserved_kernel_pages() Sasha Levin
` (6 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2024-01-15 23:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Michael Ellerman, Sasha Levin, christophe.leroy, bgray, arnd,
naveen, linuxppc-dev
From: Michael Ellerman <mpe@ellerman.id.au>
[ Upstream commit f8d3555355653848082c351fa90775214fb8a4fa ]
With CONFIG_GENERIC_BUG=n the build fails with:
arch/powerpc/kernel/traps.c:1442:5: error: no previous prototype for ‘is_valid_bugaddr’ [-Werror=missing-prototypes]
1442 | int is_valid_bugaddr(unsigned long addr)
| ^~~~~~~~~~~~~~~~
The prototype is only defined, and the function is only needed, when
CONFIG_GENERIC_BUG=y, so move the implementation under that.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231130114433.3053544-2-mpe@ellerman.id.au
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/powerpc/kernel/traps.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 5e5a2448ae79..b0e87dce2b9a 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -1432,10 +1432,12 @@ static int emulate_instruction(struct pt_regs *regs)
return -EINVAL;
}
+#ifdef CONFIG_GENERIC_BUG
int is_valid_bugaddr(unsigned long addr)
{
return is_kernel_addr(addr);
}
+#endif
#ifdef CONFIG_MATH_EMULATION
static int emulate_math(struct pt_regs *regs)
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH AUTOSEL 5.10 05/10] powerpc/mm: Fix build failures due to arch_reserved_kernel_pages()
2024-01-15 23:27 [PATCH AUTOSEL 5.10 01/10] watch_queue: fix kcalloc() arguments order Sasha Levin
` (2 preceding siblings ...)
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 04/10] powerpc: Fix build error due to is_valid_bugaddr() Sasha Levin
@ 2024-01-15 23:27 ` Sasha Levin
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 06/10] x86/boot: Ignore NMIs during very early boot Sasha Levin
` (5 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2024-01-15 23:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Michael Ellerman, Sasha Levin, christophe.leroy, linuxppc-dev
From: Michael Ellerman <mpe@ellerman.id.au>
[ Upstream commit d8c3f243d4db24675b653f0568bb65dae34e6455 ]
With NUMA=n and FA_DUMP=y or PRESERVE_FA_DUMP=y the build fails with:
arch/powerpc/kernel/fadump.c:1739:22: error: no previous prototype for ‘arch_reserved_kernel_pages’ [-Werror=missing-prototypes]
1739 | unsigned long __init arch_reserved_kernel_pages(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
The prototype for arch_reserved_kernel_pages() is in include/linux/mm.h,
but it's guarded by __HAVE_ARCH_RESERVED_KERNEL_PAGES. The powerpc
headers define __HAVE_ARCH_RESERVED_KERNEL_PAGES in asm/mmzone.h, which
is not included into the generic headers when NUMA=n.
Move the definition of __HAVE_ARCH_RESERVED_KERNEL_PAGES into asm/mmu.h
which is included regardless of NUMA=n.
Additionally the ifdef around __HAVE_ARCH_RESERVED_KERNEL_PAGES needs to
also check for CONFIG_PRESERVE_FA_DUMP.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231130114433.3053544-1-mpe@ellerman.id.au
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/powerpc/include/asm/mmu.h | 4 ++++
arch/powerpc/include/asm/mmzone.h | 3 ---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h
index 255a1837e9f7..3a5a27318a0e 100644
--- a/arch/powerpc/include/asm/mmu.h
+++ b/arch/powerpc/include/asm/mmu.h
@@ -390,5 +390,9 @@ extern void *abatron_pteptrs[2];
#include <asm/nohash/mmu.h>
#endif
+#if defined(CONFIG_FA_DUMP) || defined(CONFIG_PRESERVE_FA_DUMP)
+#define __HAVE_ARCH_RESERVED_KERNEL_PAGES
+#endif
+
#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_MMU_H_ */
diff --git a/arch/powerpc/include/asm/mmzone.h b/arch/powerpc/include/asm/mmzone.h
index 6cda76b57c5d..bd1a8d7256ff 100644
--- a/arch/powerpc/include/asm/mmzone.h
+++ b/arch/powerpc/include/asm/mmzone.h
@@ -42,9 +42,6 @@ u64 memory_hotplug_max(void);
#else
#define memory_hotplug_max() memblock_end_of_DRAM()
#endif /* CONFIG_NEED_MULTIPLE_NODES */
-#ifdef CONFIG_FA_DUMP
-#define __HAVE_ARCH_RESERVED_KERNEL_PAGES
-#endif
#ifdef CONFIG_MEMORY_HOTPLUG
extern int create_section_mapping(unsigned long start, unsigned long end,
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH AUTOSEL 5.10 06/10] x86/boot: Ignore NMIs during very early boot
2024-01-15 23:27 [PATCH AUTOSEL 5.10 01/10] watch_queue: fix kcalloc() arguments order Sasha Levin
` (3 preceding siblings ...)
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 05/10] powerpc/mm: Fix build failures due to arch_reserved_kernel_pages() Sasha Levin
@ 2024-01-15 23:27 ` Sasha Levin
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 07/10] powerpc: pmd_move_must_withdraw() is only needed for CONFIG_TRANSPARENT_HUGEPAGE Sasha Levin
` (4 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2024-01-15 23:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Jun'ichi Nomura, Derek Barbosa, Ingo Molnar, Kees Cook,
Linus Torvalds, Paul E . McKenney, Andy Lutomirski,
H. Peter Anvin, Peter Zijlstra, Sasha Levin, tglx, mingo, bp,
dave.hansen, x86, kirill.shutemov, thomas.lendacky, nikunj, ardb
From: Jun'ichi Nomura <junichi.nomura@nec.com>
[ Upstream commit 78a509fba9c9b1fcb77f95b7c6be30da3d24823a ]
When there are two racing NMIs on x86, the first NMI invokes NMI handler and
the 2nd NMI is latched until IRET is executed.
If panic on NMI and panic kexec are enabled, the first NMI triggers
panic and starts booting the next kernel via kexec. Note that the 2nd
NMI is still latched. During the early boot of the next kernel, once
an IRET is executed as a result of a page fault, then the 2nd NMI is
unlatched and invokes the NMI handler.
However, NMI handler is not set up at the early stage of boot, which
results in a boot failure.
Avoid such problems by setting up a NOP handler for early NMIs.
[ mingo: Refined the changelog. ]
Signed-off-by: Jun'ichi Nomura <junichi.nomura@nec.com>
Signed-off-by: Derek Barbosa <debarbos@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/x86/boot/compressed/ident_map_64.c | 5 +++++
arch/x86/boot/compressed/idt_64.c | 1 +
arch/x86/boot/compressed/idt_handlers_64.S | 1 +
arch/x86/boot/compressed/misc.h | 1 +
4 files changed, 8 insertions(+)
diff --git a/arch/x86/boot/compressed/ident_map_64.c b/arch/x86/boot/compressed/ident_map_64.c
index f4a2e6d373b2..1e4eb3894ec4 100644
--- a/arch/x86/boot/compressed/ident_map_64.c
+++ b/arch/x86/boot/compressed/ident_map_64.c
@@ -367,3 +367,8 @@ void do_boot_page_fault(struct pt_regs *regs, unsigned long error_code)
*/
add_identity_map(address, end);
}
+
+void do_boot_nmi_trap(struct pt_regs *regs, unsigned long error_code)
+{
+ /* Empty handler to ignore NMI during early boot */
+}
diff --git a/arch/x86/boot/compressed/idt_64.c b/arch/x86/boot/compressed/idt_64.c
index 804a502ee0d2..eb30bb20c33b 100644
--- a/arch/x86/boot/compressed/idt_64.c
+++ b/arch/x86/boot/compressed/idt_64.c
@@ -45,6 +45,7 @@ void load_stage2_idt(void)
boot_idt_desc.address = (unsigned long)boot_idt;
set_idt_entry(X86_TRAP_PF, boot_page_fault);
+ set_idt_entry(X86_TRAP_NMI, boot_nmi_trap);
#ifdef CONFIG_AMD_MEM_ENCRYPT
set_idt_entry(X86_TRAP_VC, boot_stage2_vc);
diff --git a/arch/x86/boot/compressed/idt_handlers_64.S b/arch/x86/boot/compressed/idt_handlers_64.S
index 22890e199f5b..4d03c8562f63 100644
--- a/arch/x86/boot/compressed/idt_handlers_64.S
+++ b/arch/x86/boot/compressed/idt_handlers_64.S
@@ -70,6 +70,7 @@ SYM_FUNC_END(\name)
.code64
EXCEPTION_HANDLER boot_page_fault do_boot_page_fault error_code=1
+EXCEPTION_HANDLER boot_nmi_trap do_boot_nmi_trap error_code=0
#ifdef CONFIG_AMD_MEM_ENCRYPT
EXCEPTION_HANDLER boot_stage1_vc do_vc_no_ghcb error_code=1
diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h
index d9a631c5973c..0ccc32718483 100644
--- a/arch/x86/boot/compressed/misc.h
+++ b/arch/x86/boot/compressed/misc.h
@@ -156,6 +156,7 @@ extern struct desc_ptr boot_idt_desc;
/* IDT Entry Points */
void boot_page_fault(void);
+void boot_nmi_trap(void);
void boot_stage1_vc(void);
void boot_stage2_vc(void);
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH AUTOSEL 5.10 07/10] powerpc: pmd_move_must_withdraw() is only needed for CONFIG_TRANSPARENT_HUGEPAGE
2024-01-15 23:27 [PATCH AUTOSEL 5.10 01/10] watch_queue: fix kcalloc() arguments order Sasha Levin
` (4 preceding siblings ...)
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 06/10] x86/boot: Ignore NMIs during very early boot Sasha Levin
@ 2024-01-15 23:27 ` Sasha Levin
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 08/10] powerpc/lib: Validate size for vector operations Sasha Levin
` (3 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2024-01-15 23:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Stephen Rothwell, Michael Ellerman, Sasha Levin, akpm, arnd,
christophe.leroy, aneesh.kumar, vishal.moola, linuxppc-dev
From: Stephen Rothwell <sfr@canb.auug.org.au>
[ Upstream commit 0d555b57ee660d8a871781c0eebf006e855e918d ]
The linux-next build of powerpc64 allnoconfig fails with:
arch/powerpc/mm/book3s64/pgtable.c:557:5: error: no previous prototype for 'pmd_move_must_withdraw'
557 | int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl,
| ^~~~~~~~~~~~~~~~~~~~~~
Caused by commit:
c6345dfa6e3e ("Makefile.extrawarn: turn on missing-prototypes globally")
Fix it by moving the function definition under
CONFIG_TRANSPARENT_HUGEPAGE like the prototype. The function is only
called when CONFIG_TRANSPARENT_HUGEPAGE=y.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
[mpe: Flesh out change log from linux-next patch]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231127132809.45c2b398@canb.auug.org.au
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/powerpc/mm/book3s64/pgtable.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/pgtable.c
index e18ae50a275c..a86d932a7c30 100644
--- a/arch/powerpc/mm/book3s64/pgtable.c
+++ b/arch/powerpc/mm/book3s64/pgtable.c
@@ -446,6 +446,7 @@ void ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr,
set_pte_at(vma->vm_mm, addr, ptep, pte);
}
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
/*
* For hash translation mode, we use the deposited table to store hash slot
* information and they are stored at PTRS_PER_PMD offset from related pmd
@@ -467,6 +468,7 @@ int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl,
return true;
}
+#endif
/*
* Does the CPU support tlbie?
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH AUTOSEL 5.10 08/10] powerpc/lib: Validate size for vector operations
2024-01-15 23:27 [PATCH AUTOSEL 5.10 01/10] watch_queue: fix kcalloc() arguments order Sasha Levin
` (5 preceding siblings ...)
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 07/10] powerpc: pmd_move_must_withdraw() is only needed for CONFIG_TRANSPARENT_HUGEPAGE Sasha Levin
@ 2024-01-15 23:27 ` Sasha Levin
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 09/10] x86/barrier: Do not serialize MSR accesses on AMD Sasha Levin
` (2 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2024-01-15 23:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Naveen N Rao, Gustavo A . R . Silva, Michael Ellerman,
Sasha Levin, christophe.leroy, linuxppc-dev
From: Naveen N Rao <naveen@kernel.org>
[ Upstream commit 8f9abaa6d7de0a70fc68acaedce290c1f96e2e59 ]
Some of the fp/vmx code in sstep.c assume a certain maximum size for the
instructions being emulated. The size of those operations however is
determined separately in analyse_instr().
Add a check to validate the assumption on the maximum size of the
operations, so as to prevent any unintended kernel stack corruption.
Signed-off-by: Naveen N Rao <naveen@kernel.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Build-tested-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231123071705.397625-1-naveen@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/powerpc/lib/sstep.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index 2d19655328f1..ca4733fbd02d 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -512,6 +512,8 @@ static int do_fp_load(struct instruction_op *op, unsigned long ea,
} u;
nb = GETSIZE(op->type);
+ if (nb > sizeof(u))
+ return -EINVAL;
if (!address_ok(regs, ea, nb))
return -EFAULT;
rn = op->reg;
@@ -562,6 +564,8 @@ static int do_fp_store(struct instruction_op *op, unsigned long ea,
} u;
nb = GETSIZE(op->type);
+ if (nb > sizeof(u))
+ return -EINVAL;
if (!address_ok(regs, ea, nb))
return -EFAULT;
rn = op->reg;
@@ -606,6 +610,9 @@ static nokprobe_inline int do_vec_load(int rn, unsigned long ea,
u8 b[sizeof(__vector128)];
} u = {};
+ if (size > sizeof(u))
+ return -EINVAL;
+
if (!address_ok(regs, ea & ~0xfUL, 16))
return -EFAULT;
/* align to multiple of size */
@@ -633,6 +640,9 @@ static nokprobe_inline int do_vec_store(int rn, unsigned long ea,
u8 b[sizeof(__vector128)];
} u;
+ if (size > sizeof(u))
+ return -EINVAL;
+
if (!address_ok(regs, ea & ~0xfUL, 16))
return -EFAULT;
/* align to multiple of size */
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH AUTOSEL 5.10 09/10] x86/barrier: Do not serialize MSR accesses on AMD
2024-01-15 23:27 [PATCH AUTOSEL 5.10 01/10] watch_queue: fix kcalloc() arguments order Sasha Levin
` (6 preceding siblings ...)
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 08/10] powerpc/lib: Validate size for vector operations Sasha Levin
@ 2024-01-15 23:27 ` Sasha Levin
2024-01-16 20:44 ` Pavel Machek
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 10/10] x86/mce: Mark fatal MCE's page as poison to avoid panic in the kdump kernel Sasha Levin
2024-01-16 20:43 ` [PATCH AUTOSEL 5.10 01/10] watch_queue: fix kcalloc() arguments order Pavel Machek
9 siblings, 1 reply; 13+ messages in thread
From: Sasha Levin @ 2024-01-15 23:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Borislav Petkov (AMD), Sasha Levin, tglx, mingo, dave.hansen, x86,
puwen, seanjc, kim.phillips, reinette.chatre, babu.moger,
jmattson, peterz, ashok.raj, rick.p.edgecombe, brgerst, mjguzik,
jpoimboe, nik.borisov, aik, vegard.nossum, daniel.sneddon,
acdunlap
From: "Borislav Petkov (AMD)" <bp@alien8.de>
[ Upstream commit 04c3024560d3a14acd18d0a51a1d0a89d29b7eb5 ]
AMD does not have the requirement for a synchronization barrier when
acccessing a certain group of MSRs. Do not incur that unnecessary
penalty there.
There will be a CPUID bit which explicitly states that a MFENCE is not
needed. Once that bit is added to the APM, this will be extended with
it.
While at it, move to processor.h to avoid include hell. Untangling that
file properly is a matter for another day.
Some notes on the performance aspect of why this is relevant, courtesy
of Kishon VijayAbraham <Kishon.VijayAbraham@amd.com>:
On a AMD Zen4 system with 96 cores, a modified ipi-bench[1] on a VM
shows x2AVIC IPI rate is 3% to 4% lower than AVIC IPI rate. The
ipi-bench is modified so that the IPIs are sent between two vCPUs in the
same CCX. This also requires to pin the vCPU to a physical core to
prevent any latencies. This simulates the use case of pinning vCPUs to
the thread of a single CCX to avoid interrupt IPI latency.
In order to avoid run-to-run variance (for both x2AVIC and AVIC), the
below configurations are done:
1) Disable Power States in BIOS (to prevent the system from going to
lower power state)
2) Run the system at fixed frequency 2500MHz (to prevent the system
from increasing the frequency when the load is more)
With the above configuration:
*) Performance measured using ipi-bench for AVIC:
Average Latency: 1124.98ns [Time to send IPI from one vCPU to another vCPU]
Cumulative throughput: 42.6759M/s [Total number of IPIs sent in a second from
48 vCPUs simultaneously]
*) Performance measured using ipi-bench for x2AVIC:
Average Latency: 1172.42ns [Time to send IPI from one vCPU to another vCPU]
Cumulative throughput: 40.9432M/s [Total number of IPIs sent in a second from
48 vCPUs simultaneously]
From above, x2AVIC latency is ~4% more than AVIC. However, the expectation is
x2AVIC performance to be better or equivalent to AVIC. Upon analyzing
the perf captures, it is observed significant time is spent in
weak_wrmsr_fence() invoked by x2apic_send_IPI().
With the fix to skip weak_wrmsr_fence()
*) Performance measured using ipi-bench for x2AVIC:
Average Latency: 1117.44ns [Time to send IPI from one vCPU to another vCPU]
Cumulative throughput: 42.9608M/s [Total number of IPIs sent in a second from
48 vCPUs simultaneously]
Comparing the performance of x2AVIC with and without the fix, it can be seen
the performance improves by ~4%.
Performance captured using an unmodified ipi-bench using the 'mesh-ipi' option
with and without weak_wrmsr_fence() on a Zen4 system also showed significant
performance improvement without weak_wrmsr_fence(). The 'mesh-ipi' option ignores
CCX or CCD and just picks random vCPU.
Average throughput (10 iterations) with weak_wrmsr_fence(),
Cumulative throughput: 4933374 IPI/s
Average throughput (10 iterations) without weak_wrmsr_fence(),
Cumulative throughput: 6355156 IPI/s
[1] https://github.com/bytedance/kvm-utils/tree/master/microbenchmark/ipi-bench
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20230622095212.20940-1-bp@alien8.de
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/x86/include/asm/barrier.h | 18 ------------------
arch/x86/include/asm/cpufeatures.h | 2 +-
arch/x86/include/asm/processor.h | 18 ++++++++++++++++++
arch/x86/kernel/cpu/amd.c | 3 +++
arch/x86/kernel/cpu/common.c | 7 +++++++
arch/x86/kernel/cpu/hygon.c | 3 +++
6 files changed, 32 insertions(+), 19 deletions(-)
diff --git a/arch/x86/include/asm/barrier.h b/arch/x86/include/asm/barrier.h
index 4819d5e5a335..7f828fe49797 100644
--- a/arch/x86/include/asm/barrier.h
+++ b/arch/x86/include/asm/barrier.h
@@ -84,22 +84,4 @@ do { \
#include <asm-generic/barrier.h>
-/*
- * Make previous memory operations globally visible before
- * a WRMSR.
- *
- * MFENCE makes writes visible, but only affects load/store
- * instructions. WRMSR is unfortunately not a load/store
- * instruction and is unaffected by MFENCE. The LFENCE ensures
- * that the WRMSR is not reordered.
- *
- * Most WRMSRs are full serializing instructions themselves and
- * do not require this barrier. This is only required for the
- * IA32_TSC_DEADLINE and X2APIC MSRs.
- */
-static inline void weak_wrmsr_fence(void)
-{
- asm volatile("mfence; lfence" : : : "memory");
-}
-
#endif /* _ASM_X86_BARRIER_H */
diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
index 5a54c3685a06..2cc73e63882c 100644
--- a/arch/x86/include/asm/cpufeatures.h
+++ b/arch/x86/include/asm/cpufeatures.h
@@ -300,10 +300,10 @@
#define X86_FEATURE_USE_IBPB_FW (11*32+16) /* "" Use IBPB during runtime firmware calls */
#define X86_FEATURE_RSB_VMEXIT_LITE (11*32+17) /* "" Fill RSB on VM exit when EIBRS is enabled */
#define X86_FEATURE_MSR_TSX_CTRL (11*32+18) /* "" MSR IA32_TSX_CTRL (Intel) implemented */
-
#define X86_FEATURE_SRSO (11*32+24) /* "" AMD BTB untrain RETs */
#define X86_FEATURE_SRSO_ALIAS (11*32+25) /* "" AMD BTB untrain RETs through aliasing */
#define X86_FEATURE_IBPB_ON_VMEXIT (11*32+26) /* "" Issue an IBPB only on VMEXIT */
+#define X86_FEATURE_APIC_MSRS_FENCE (11*32+27) /* "" IA32_TSC_DEADLINE and X2APIC MSRs need fencing */
/* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */
#define X86_FEATURE_AVX512_BF16 (12*32+ 5) /* AVX512 BFLOAT16 instructions */
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index d7e017b0b4c3..75abfbf920f8 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -866,4 +866,22 @@ enum mds_mitigations {
extern bool gds_ucode_mitigated(void);
+/*
+ * Make previous memory operations globally visible before
+ * a WRMSR.
+ *
+ * MFENCE makes writes visible, but only affects load/store
+ * instructions. WRMSR is unfortunately not a load/store
+ * instruction and is unaffected by MFENCE. The LFENCE ensures
+ * that the WRMSR is not reordered.
+ *
+ * Most WRMSRs are full serializing instructions themselves and
+ * do not require this barrier. This is only required for the
+ * IA32_TSC_DEADLINE and X2APIC MSRs.
+ */
+static inline void weak_wrmsr_fence(void)
+{
+ alternative("mfence; lfence", "", ALT_NOT(X86_FEATURE_APIC_MSRS_FENCE));
+}
+
#endif /* _ASM_X86_PROCESSOR_H */
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index f29c6bed9d65..c09fba1248e6 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -1186,6 +1186,9 @@ static void init_amd(struct cpuinfo_x86 *c)
if (!cpu_has(c, X86_FEATURE_HYPERVISOR) &&
cpu_has_amd_erratum(c, amd_erratum_1485))
msr_set_bit(MSR_ZEN4_BP_CFG, MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT);
+
+ /* AMD CPUs don't need fencing after x2APIC/TSC_DEADLINE MSR writes. */
+ clear_cpu_cap(c, X86_FEATURE_APIC_MSRS_FENCE);
}
#ifdef CONFIG_X86_32
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 4ecc6072e9a4..729ee313a1ae 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1680,6 +1680,13 @@ static void identify_cpu(struct cpuinfo_x86 *c)
c->apicid = apic->phys_pkg_id(c->initial_apicid, 0);
#endif
+
+ /*
+ * Set default APIC and TSC_DEADLINE MSR fencing flag. AMD and
+ * Hygon will clear it in ->c_init() below.
+ */
+ set_cpu_cap(c, X86_FEATURE_APIC_MSRS_FENCE);
+
/*
* Vendor-specific initialization. In this section we
* canonicalize the feature flags, meaning if there are
diff --git a/arch/x86/kernel/cpu/hygon.c b/arch/x86/kernel/cpu/hygon.c
index 3f5c00b15e2c..b49f662f6871 100644
--- a/arch/x86/kernel/cpu/hygon.c
+++ b/arch/x86/kernel/cpu/hygon.c
@@ -363,6 +363,9 @@ static void init_hygon(struct cpuinfo_x86 *c)
set_cpu_bug(c, X86_BUG_SYSRET_SS_ATTRS);
check_null_seg_clears_base(c);
+
+ /* Hygon CPUs don't need fencing after x2APIC/TSC_DEADLINE MSR writes. */
+ clear_cpu_cap(c, X86_FEATURE_APIC_MSRS_FENCE);
}
static void cpu_detect_tlb_hygon(struct cpuinfo_x86 *c)
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH AUTOSEL 5.10 10/10] x86/mce: Mark fatal MCE's page as poison to avoid panic in the kdump kernel
2024-01-15 23:27 [PATCH AUTOSEL 5.10 01/10] watch_queue: fix kcalloc() arguments order Sasha Levin
` (7 preceding siblings ...)
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 09/10] x86/barrier: Do not serialize MSR accesses on AMD Sasha Levin
@ 2024-01-15 23:27 ` Sasha Levin
2024-01-16 20:43 ` [PATCH AUTOSEL 5.10 01/10] watch_queue: fix kcalloc() arguments order Pavel Machek
9 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2024-01-15 23:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Zhiquan Li, Youquan Song, Borislav Petkov, Naoya Horiguchi,
Sasha Levin, tglx, mingo, dave.hansen, x86, linux-edac
From: Zhiquan Li <zhiquan1.li@intel.com>
[ Upstream commit 9f3b130048bfa2e44a8cfb1b616f826d9d5d8188 ]
Memory errors don't happen very often, especially fatal ones. However,
in large-scale scenarios such as data centers, that probability
increases with the amount of machines present.
When a fatal machine check happens, mce_panic() is called based on the
severity grading of that error. The page containing the error is not
marked as poison.
However, when kexec is enabled, tools like makedumpfile understand when
pages are marked as poison and do not touch them so as not to cause
a fatal machine check exception again while dumping the previous
kernel's memory.
Therefore, mark the page containing the error as poisoned so that the
kexec'ed kernel can avoid accessing the page.
[ bp: Rewrite commit message and comment. ]
Co-developed-by: Youquan Song <youquan.song@intel.com>
Signed-off-by: Youquan Song <youquan.song@intel.com>
Signed-off-by: Zhiquan Li <zhiquan1.li@intel.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
Link: https://lore.kernel.org/r/20231014051754.3759099-1-zhiquan1.li@intel.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/x86/kernel/cpu/mce/core.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index 0b7c81389c50..18a6ed2afca0 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -44,6 +44,7 @@
#include <linux/sync_core.h>
#include <linux/task_work.h>
#include <linux/hardirq.h>
+#include <linux/kexec.h>
#include <asm/intel-family.h>
#include <asm/processor.h>
@@ -274,6 +275,7 @@ static noinstr void mce_panic(const char *msg, struct mce *final, char *exp)
struct llist_node *pending;
struct mce_evt_llist *l;
int apei_err = 0;
+ struct page *p;
/*
* Allow instrumentation around external facilities usage. Not that it
@@ -329,6 +331,20 @@ static noinstr void mce_panic(const char *msg, struct mce *final, char *exp)
if (!fake_panic) {
if (panic_timeout == 0)
panic_timeout = mca_cfg.panic_timeout;
+
+ /*
+ * Kdump skips the poisoned page in order to avoid
+ * touching the error bits again. Poison the page even
+ * if the error is fatal and the machine is about to
+ * panic.
+ */
+ if (kexec_crash_loaded()) {
+ if (final && (final->status & MCI_STATUS_ADDRV)) {
+ p = pfn_to_online_page(final->addr >> PAGE_SHIFT);
+ if (p)
+ SetPageHWPoison(p);
+ }
+ }
panic(msg);
} else
pr_emerg(HW_ERR "Fake kernel panic: %s\n", msg);
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH AUTOSEL 5.10 01/10] watch_queue: fix kcalloc() arguments order
2024-01-15 23:27 [PATCH AUTOSEL 5.10 01/10] watch_queue: fix kcalloc() arguments order Sasha Levin
` (8 preceding siblings ...)
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 10/10] x86/mce: Mark fatal MCE's page as poison to avoid panic in the kdump kernel Sasha Levin
@ 2024-01-16 20:43 ` Pavel Machek
9 siblings, 0 replies; 13+ messages in thread
From: Pavel Machek @ 2024-01-16 20:43 UTC (permalink / raw)
To: Sasha Levin
Cc: linux-kernel, stable, Dmitry Antipov, Christian Brauner,
zack.rusin, mcgrof, pstanner, nick.alcock, code, ddiss
[-- Attachment #1: Type: text/plain, Size: 1014 bytes --]
Hi!
> From: Dmitry Antipov <dmantipov@yandex.ru>
>
> [ Upstream commit 1bfc466b13cf6652ba227c282c27a30ffede69a5 ]
>
> When compiling with gcc version 14.0.0 20231220 (experimental)
> and W=1, I've noticed the following warning:
>
> kernel/watch_queue.c: In function 'watch_queue_set_size':
> kernel/watch_queue.c:273:32: warning: 'kcalloc' sizes specified with 'sizeof'
> in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
> 273 | pages = kcalloc(sizeof(struct page *), nr_pages, GFP_KERNEL);
> | ^~~~~~
>
> Since 'n' and 'size' arguments of 'kcalloc()' are multiplied to
> calculate the final size, their actual order doesn't affect the
> result and so this is not a bug. But it's still worth to fix it.
Not a bugfix, please drop.
BR,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH AUTOSEL 5.10 09/10] x86/barrier: Do not serialize MSR accesses on AMD
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 09/10] x86/barrier: Do not serialize MSR accesses on AMD Sasha Levin
@ 2024-01-16 20:44 ` Pavel Machek
2024-01-30 20:58 ` Sasha Levin
0 siblings, 1 reply; 13+ messages in thread
From: Pavel Machek @ 2024-01-16 20:44 UTC (permalink / raw)
To: Sasha Levin
Cc: linux-kernel, stable, Borislav Petkov (AMD), tglx, mingo,
dave.hansen, x86, puwen, seanjc, kim.phillips, reinette.chatre,
babu.moger, jmattson, peterz, ashok.raj, rick.p.edgecombe,
brgerst, mjguzik, jpoimboe, nik.borisov, aik, vegard.nossum,
daniel.sneddon, acdunlap
[-- Attachment #1: Type: text/plain, Size: 1132 bytes --]
Hi!
> From: "Borislav Petkov (AMD)" <bp@alien8.de>
>
> [ Upstream commit 04c3024560d3a14acd18d0a51a1d0a89d29b7eb5 ]
>
> AMD does not have the requirement for a synchronization barrier when
> acccessing a certain group of MSRs. Do not incur that unnecessary
> penalty there.
...
> Performance captured using an unmodified ipi-bench using the 'mesh-ipi' option
> with and without weak_wrmsr_fence() on a Zen4 system also showed significant
> performance improvement without weak_wrmsr_fence(). The 'mesh-ipi' option ignores
> CCX or CCD and just picks random vCPU.
>
> Average throughput (10 iterations) with weak_wrmsr_fence(),
> Cumulative throughput: 4933374 IPI/s
>
> Average throughput (10 iterations) without weak_wrmsr_fence(),
> Cumulative throughput: 6355156 IPI/s
>
> [1] https://github.com/bytedance/kvm-utils/tree/master/microbenchmark/ipi-bench
Speed improvement, not a bugfix. Please drop.
BR,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH AUTOSEL 5.10 09/10] x86/barrier: Do not serialize MSR accesses on AMD
2024-01-16 20:44 ` Pavel Machek
@ 2024-01-30 20:58 ` Sasha Levin
0 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2024-01-30 20:58 UTC (permalink / raw)
To: Pavel Machek
Cc: linux-kernel, stable, Borislav Petkov (AMD), tglx, mingo,
dave.hansen, x86, puwen, seanjc, kim.phillips, reinette.chatre,
babu.moger, jmattson, peterz, ashok.raj, rick.p.edgecombe,
brgerst, mjguzik, jpoimboe, nik.borisov, aik, vegard.nossum,
daniel.sneddon, acdunlap
On Tue, Jan 16, 2024 at 09:44:01PM +0100, Pavel Machek wrote:
>Hi!
>
>> From: "Borislav Petkov (AMD)" <bp@alien8.de>
>>
>> [ Upstream commit 04c3024560d3a14acd18d0a51a1d0a89d29b7eb5 ]
>>
>> AMD does not have the requirement for a synchronization barrier when
>> acccessing a certain group of MSRs. Do not incur that unnecessary
>> penalty there.
>...
>> Performance captured using an unmodified ipi-bench using the 'mesh-ipi' option
>> with and without weak_wrmsr_fence() on a Zen4 system also showed significant
>> performance improvement without weak_wrmsr_fence(). The 'mesh-ipi' option ignores
>> CCX or CCD and just picks random vCPU.
>>
>> Average throughput (10 iterations) with weak_wrmsr_fence(),
>> Cumulative throughput: 4933374 IPI/s
>>
>> Average throughput (10 iterations) without weak_wrmsr_fence(),
>> Cumulative throughput: 6355156 IPI/s
>>
>> [1] https://github.com/bytedance/kvm-utils/tree/master/microbenchmark/ipi-bench
>
>Speed improvement, not a bugfix. Please drop.
Dropped, thanks!
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2024-01-30 20:58 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-15 23:27 [PATCH AUTOSEL 5.10 01/10] watch_queue: fix kcalloc() arguments order Sasha Levin
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 02/10] powerpc/mm: Fix null-pointer dereference in pgtable_cache_add Sasha Levin
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 03/10] drivers/perf: pmuv3: don't expose SW_INCR event in sysfs Sasha Levin
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 04/10] powerpc: Fix build error due to is_valid_bugaddr() Sasha Levin
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 05/10] powerpc/mm: Fix build failures due to arch_reserved_kernel_pages() Sasha Levin
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 06/10] x86/boot: Ignore NMIs during very early boot Sasha Levin
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 07/10] powerpc: pmd_move_must_withdraw() is only needed for CONFIG_TRANSPARENT_HUGEPAGE Sasha Levin
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 08/10] powerpc/lib: Validate size for vector operations Sasha Levin
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 09/10] x86/barrier: Do not serialize MSR accesses on AMD Sasha Levin
2024-01-16 20:44 ` Pavel Machek
2024-01-30 20:58 ` Sasha Levin
2024-01-15 23:27 ` [PATCH AUTOSEL 5.10 10/10] x86/mce: Mark fatal MCE's page as poison to avoid panic in the kdump kernel Sasha Levin
2024-01-16 20:43 ` [PATCH AUTOSEL 5.10 01/10] watch_queue: fix kcalloc() arguments order Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).