All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] powerpc: warn on emulation of dcbz instruction in kernel mode
@ 2021-09-16 14:52 ` Christophe Leroy
  0 siblings, 0 replies; 19+ messages in thread
From: Christophe Leroy @ 2021-09-16 14:52 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: Stan Johnson, Finn Thain, linuxppc-dev, linux-kernel

dcbz instruction shouldn't be used on non-cached memory. Using
it on non-cached memory can result in alignment exception and
implies a heavy handling.

Instead of silentely emulating the instruction and resulting in high
performance degradation, warn whenever an alignment exception is
taken in kernel mode due to dcbz, so that the user is made aware that
dcbz instruction has been used unexpectedly by the kernel.

Reported-by: Stan Johnson <userm57@yahoo.com>
Cc: Finn Thain <fthain@linux-m68k.org>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
v2: Warn only when emulating kernel mode
---
 arch/powerpc/kernel/align.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c
index bbb4181621dd..bf96b954a4eb 100644
--- a/arch/powerpc/kernel/align.c
+++ b/arch/powerpc/kernel/align.c
@@ -349,6 +349,7 @@ int fix_alignment(struct pt_regs *regs)
 		if (op.type != CACHEOP + DCBZ)
 			return -EINVAL;
 		PPC_WARN_ALIGNMENT(dcbz, regs);
+		WARN_ON_ONCE(!user_mode(regs));
 		r = emulate_dcbz(op.ea, regs);
 	} else {
 		if (type == LARX || type == STCX)
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2024-08-27  7:29 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-16 14:52 [PATCH v2] powerpc: warn on emulation of dcbz instruction in kernel mode Christophe Leroy
2021-09-16 14:52 ` Christophe Leroy
2021-11-02 10:11 ` Michael Ellerman
2021-11-02 10:11   ` Michael Ellerman
2024-08-21 22:39 ` Christian Lamparter
2024-08-22  5:25   ` LEROY Christophe
2024-08-22  5:32     ` Christoph Hellwig
2024-08-22  6:39       ` LEROY Christophe
2024-08-22  7:14         ` Christoph Hellwig
2024-08-22  9:53           ` Benjamin Herrenschmidt
2024-08-22 18:19           ` Christian Lamparter
2024-08-23  8:07             ` Christoph Hellwig
2024-08-23 13:06         ` Segher Boessenkool
2024-08-23 13:54           ` Christoph Hellwig
2024-08-23 19:19             ` Segher Boessenkool
2024-08-23 23:43               ` Christian Lamparter
2024-08-24  9:01               ` LEROY Christophe
2024-08-24 17:17                 ` Segher Boessenkool
2024-08-27  7:29                   ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.