Re: [PATCH] powerpc: warn on emulation of dcbz instruction
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2021-09-16 07:22:04
Also in:
lkml
On Thu, 2021-09-16 at 17:15 +1000, Benjamin Herrenschmidt wrote:
On Wed, 2021-09-15 at 16:31 +0200, Christophe Leroy wrote:quoted
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 due to dcbz, so that the user is made aware that dcbz instruction has been used unexpectedly. Reported-by: Stan Johnson <redacted> Cc: Finn Thain <fthain@linux-m68k.org> Signed-off-by: Christophe Leroy <redacted> --- arch/powerpc/kernel/align.c | 1 + 1 file changed, 1 insertion(+)diff --git a/arch/powerpc/kernel/align.cb/arch/powerpc/kernel/align.c index bbb4181621dd..adc3a4a9c6e4 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(1);This is heavy handed ... It will be treated as an oops by various things uselessly spit out a kernel backtrace. Isn't PPC_WARN_ALIGNMENT enough ?
Ah I saw your other one about fbdev... Ok what about you do that in a if (!user_mode(regs)) ? Indeed the kernel should not do that. Cheers, Ben.