Skip to content

Commit cbade82

Browse files
committed
parisc: Add support for CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
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 <[email protected]>
1 parent 2fd4e52 commit cbade82

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

Documentation/admin-guide/sysctl/kernel.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ ignore-unaligned-usertrap
454454

455455
On architectures where unaligned accesses cause traps, and where this
456456
feature is supported (``CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN``;
457-
currently, ``arc`` and ``loongarch``), controls whether all
457+
currently, ``arc``, ``parisc`` and ``loongarch``), controls whether all
458458
unaligned traps are logged.
459459

460460
= =============================================================

arch/parisc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ config PARISC
4545
select GENERIC_CPU_DEVICES if !SMP
4646
select GENERIC_LIB_DEVMEM_IS_ALLOWED
4747
select SYSCTL_ARCH_UNALIGN_ALLOW
48+
select SYSCTL_ARCH_UNALIGN_NO_WARN
4849
select SYSCTL_EXCEPTION_TRACE
4950
select HAVE_MOD_ARCH_SPECIFIC
5051
select MODULES_USE_ELF_RELA

arch/parisc/kernel/unaligned.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
#define ERR_NOTHANDLED -1
105105

106106
int unaligned_enabled __read_mostly = 1;
107+
int no_unaligned_warning __read_mostly;
107108

108109
static int emulate_ldh(struct pt_regs *regs, int toreg)
109110
{
@@ -399,6 +400,7 @@ void handle_unaligned(struct pt_regs *regs)
399400
} else {
400401
static DEFINE_RATELIMIT_STATE(kernel_ratelimit, 5 * HZ, 5);
401402
if (!(current->thread.flags & PARISC_UAC_NOPRINT) &&
403+
!no_unaligned_warning &&
402404
__ratelimit(&kernel_ratelimit))
403405
pr_warn("Kernel: unaligned access to " RFMT " in %pS "
404406
"(iir " RFMT ")\n",

0 commit comments

Comments
 (0)