]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
parisc: Add support for CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
authorHelge Deller <deller@gmx.de>
Sun, 21 Jul 2024 21:36:36 +0000 (23:36 +0200)
committerHelge Deller <deller@gmx.de>
Wed, 24 Jul 2024 00:04:05 +0000 (02:04 +0200)
Allow users to disable kernel warnings for unaligned memory
accesses from kernel via the /proc/sys/kernel/ignore-unaligned-usertrap
procfs entry.
That way users can disable those warnings in case they happen too
often.

Signed-off-by: Helge Deller <deller@gmx.de>
Documentation/admin-guide/sysctl/kernel.rst
arch/parisc/Kconfig
arch/parisc/kernel/unaligned.c

index 7fd43947832f8f62206f220880f78767ea9020f1..f8bc1630eba0565937e154fe9bcda6af7c895fcf 100644 (file)
@@ -454,7 +454,7 @@ ignore-unaligned-usertrap
 
 On architectures where unaligned accesses cause traps, and where this
 feature is supported (``CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN``;
-currently, ``arc`` and ``loongarch``), controls whether all
+currently, ``arc``, ``parisc`` and ``loongarch``), controls whether all
 unaligned traps are logged.
 
 = =============================================================
index 50735f3a772c69927f6b20d6ee536080f6e75f1f..d815af5f1aeb9beedbfe0f7e1afa8274c89852b0 100644 (file)
@@ -45,6 +45,7 @@ config PARISC
        select GENERIC_CPU_DEVICES if !SMP
        select GENERIC_LIB_DEVMEM_IS_ALLOWED
        select SYSCTL_ARCH_UNALIGN_ALLOW
+       select SYSCTL_ARCH_UNALIGN_NO_WARN
        select SYSCTL_EXCEPTION_TRACE
        select HAVE_MOD_ARCH_SPECIFIC
        select MODULES_USE_ELF_RELA
index 71e596ca5a86b04b78059718187943cbbff735f5..3e79e40e361d5246a8e9c37337c3df44f6c6c4e6 100644 (file)
 #define ERR_NOTHANDLED -1
 
 int unaligned_enabled __read_mostly = 1;
+int no_unaligned_warning __read_mostly;
 
 static int emulate_ldh(struct pt_regs *regs, int toreg)
 {
@@ -399,6 +400,7 @@ void handle_unaligned(struct pt_regs *regs)
        } else {
                static DEFINE_RATELIMIT_STATE(kernel_ratelimit, 5 * HZ, 5);
                if (!(current->thread.flags & PARISC_UAC_NOPRINT) &&
+                       !no_unaligned_warning &&
                        __ratelimit(&kernel_ratelimit))
                        pr_warn("Kernel: unaligned access to " RFMT " in %pS "
                                        "(iir " RFMT ")\n",