Re: selftests: user_events: ftrace_test: Internal error: Oops: 0000000096000021

From: Beau Belgrave
Date: Wed Sep 20 2023 - 13:27:37 EST


On Wed, Sep 20, 2023 at 03:20:58PM +0100, Mark Rutland wrote:
> Hi Naresh,
>
> As a general thing, for arm64 issues could you please Cc the linux-arm-kernel
> mailing list?
>
> On Wed, Sep 20, 2023 at 02:40:24PM +0200, Naresh Kamboju wrote:
> > Following selftests: user_events: ftrace_test running on arm64 Juno-r2
> > Linux next-20230919.
> > Reported-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>
> >
> > kselftest: Running tests in user_events
> > TAP version 13
> > 1..4
> > # timeout set to 90
> > # selftests: user_events: ftrace_test
> > [ 1138.755735] Unable to handle kernel paging request at virtual address ffff00082fc89ed4
> > [ 1138.763768] Mem abort info:
> > [ 1138.766692] ESR = 0x0000000096000021
> > [ 1138.770495] EC = 0x25: DABT (current EL), IL = 32 bits
> > [ 1138.775879] SET = 0, FnV = 0
> > [ 1138.779018] EA = 0, S1PTW = 0
> > [ 1138.782264] FSC = 0x21: alignment fault
>
> So this is an alignment fault, to a 4-byte aligned address...
>
> > [ 1138.786399] Data abort info:
> > [ 1138.789356] ISV = 0, ISS = 0x00000021, ISS2 = 0x00000000
> > [ 1138.794969] CM = 0, WnR = 0, TnD = 0, TagAccess = 0
> > [ 1138.800095] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
> > [ 1138.805436] swapper pgtable: 4k pages, 48-bit VAs, pgdp=000000008265b000
> > [ 1138.812175] [ffff00082fc89ed4] pgd=18000009ffdf8003,
> > p4d=18000009ffdf8003, pud=18000009ffa0e003, pmd=18000009ff88f003,
> > pte=00680008afc89707
> > [ 1138.824824] Internal error: Oops: 0000000096000021 [#1] PREEMPT SMP
> > # TAP[ 1138.831117] Modules linked in: tda998x hdlcd onboard_usb_hub
> > crct10dif_ce cec drm_dma_helper drm_kms_helper drm fuse backlight
> > dm_mod ip_tables x_tables
> > [ 1138.845227] CPU: 1 PID: 4752 Comm: ftrace_test Not tainted
> > 6.6.0-rc2-next-20230919 #1
> > v[e r1s1i3o8n. 81533080] Hardware name: ARM Juno development board (r2) (DT)
> >
> > # 1..6
> > # # Starting 6 tests from 1 test cases.
> > # # RUN user.register_events ...
> > [ 1138.868317] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> > [ 1138.875291] pc : user_event_enabler_write
> > (arch/arm64/include/asm/atomic_ll_sc.h:210 (discriminator 2)
> > arch/arm64/include/asm/atomic.h:64 (discriminator 2)
> > include/linux/atomic/atomic-arch-fallback.h:3656 (discriminator 2)
> > include/linux/atomic/atomic-long.h:964 (discriminator 2)
>
> ... as part of some atomic_long_*() operation, where atomic_long_t should be
> 8-byte aligned, so we've got a dodgy address.
>

This appears to be the same issue [1] that was sent to linux-trace-kernel.
There's a proposal [2] there to get a generic set_bit_aligned() function to
ensure alignment for both little and big endian devices.

Thanks,
-Beau

1. https://lore.kernel.org/linux-trace-kernel/20230914131102.179100-1-cleger@xxxxxxxxxxxx/
2. https://lore.kernel.org/linux-trace-kernel/20230915115449.3d7103b841cd593d1a09a129@xxxxxxxxxx/