From: "Théo Lebrun" <theo.lebrun@bootlin.com>
To: "Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"David S. Miller" <davem@davemloft.net>,
"Jakub Kicinski" <kuba@kernel.org>,
"Jesper Dangaard Brouer" <hawk@kernel.org>,
"John Fastabend" <john.fastabend@gmail.com>,
"Stanislav Fomichev" <sdf@fomichev.me>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Gregory CLEMENT" <gregory.clement@bootlin.com>
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
"Vladimir Kondratiev" <vladimir.kondratiev@mobileye.com>,
"Benoît Monin" <benoit.monin@bootlin.com>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
stable@vger.kernel.org, "Théo Lebrun" <theo.lebrun@bootlin.com>
Subject: Re: [PATCH] mips: select CONFIG_WEAK_REORDERING_BEYOND_LLSC from CONFIG_EYEQ
Date: Fri, 28 Aug 2026 17:56:44 +0200 [thread overview]
Message-ID: <DL0P7NCKVU0I.ARBMN6GAMMBS@bootlin.com> (raw)
In-Reply-To: <20260828-eyeq-reordering-llsc-v1-1-0c5a69fc5124@bootlin.com>
First off, sorry to net maintainers for being in Cc of this patch.
get_maintainer.pl added you and the MLs because the commit message
containing "xdp". I deleted the MLs in Cc but forgot the individuals.
On Fri Aug 28, 2026 at 4:07 PM CEST, Théo Lebrun wrote:
> On I6500 CPU cores, lld and scd give no ordering guarantees (same as all
> other instructions). To respect the assumption that arch_cmpxchg() is
> fully ordered, we must inject sync instructions above and below our
> lld/scd loops using the already in place WEAK_REORDERING_BEYOND_LLSC
> infrastructure.
>
> Otherwise, bad things can happen:
>
> [ 34.054496] CPU 3 Unable to handle kernel paging request at virtual address 0000000000000000, epc == a80000080838e01c, ra == a80000080838dfc4
> [ 34.054559] Oops[#1]:
> [ 34.069561] CPU: 3 UID: 0 PID: 170 Comm: pipe_race Not tainted 7.2.0-rc6-01553-gb73c35220968-dirty #103 VOLUNTARY
> [ 34.079932] Hardware name: Mobile EyeQ5 MP5 Evaluation board
> [ 34.085592] $ 0 : 0000000000000000 0000000000000001 0000000000000000 0000000000000000
> [ 34.093616] $ 4 : a800000808ee2618 000000000b7a879d 0000000000001000 0000000000000000
> [ 34.101638] $ 8 : 0000000000e3f2c9 0000000000000000 a800000808a2a9f8 0000000000000000
> [ 34.109660] $12 : a8000008139ffcd8 ffffffff84080018 a80000080837fae0 7878787878787878
> [ 34.117682] $16 : a800000807e82940 0000000000001000 0000000000000000 0000000000000000
> [ 34.125704] $20 : a800000802920e00 a8000008139ffdf8 a800000802649400 0000000000e3f2c9
> [ 34.133726] $24 : 0000000000000006 00000001200406e0
> [ 34.141783] $28 : a8000008139fc000 a8000008139ffd10 0000000000e3f2c8 a80000080838dfc4
> [ 34.149837] epc : a80000080838e01c anon_pipe_read+0xd4/0x428
> [ 34.155697] ra : a80000080838dfc4 anon_pipe_read+0x7c/0x428
> [ 34.161549] Status: 140000e3 KX SX UX KERNEL EXL IE
> [ 34.166551] Cause : 40800408 (ExcCode 02)
> [ 34.170574] BadVA : 0000000000000000
> [ 34.174161] PrId : 0001b028 (MIPS I6500)
> [ 34.178183] Process pipe_race (pid: 170, threadinfo=000000005ca35720, task=00000000e1013890, tls=000000014ebbb780)
> [ 34.188568] Stack : a800000802649400 0000000000000000 0000000000000000 a8000008139ffdd0
> [ 34.196623] 0000000000000fba a800000808ee0000 0000000000000001 a8000008130c3e80
> [ 34.204676] a8000008080d1280 a8000008139ffd58 a8000008139ffd58 1dbd2b22ea1dd500
> [ 34.212729] a800000802649400 a800000808ee0000 ffffffffffffffea 0000000000000001
> [ 34.220783] 0000000000001000 0000000000000000 00000001200ae518 ffffffffffffffff
> [ 34.228836] 000000fffbe0e530 a80000080837edf4 000000fffbe0e530 0000000000000000
> [ 34.236890] 0000000000000000 0000000000000000 000000014ebb55a0 0000000000001000
> [ 34.244943] 0000000000000001 a800000802649400 0000000000000000 0000000000000000
> [ 34.252996] 0000000000000000 0000400400000000 0000000000000000 1dbd2b22ea1dd500
> [ 34.261049] 00000000140000e3 a800000802649400 a800000802649400 a800000808ee0000
> [ 34.269103] ...
> [ 34.271568] Call Trace:
> [ 34.274026] [<a80000080838e01c>] anon_pipe_read+0xd4/0x428
> [ 34.279533] [<a80000080837edf4>] vfs_read+0x25c/0x318
> [ 34.284607] [<a80000080837faac>] ksys_read+0x104/0x138
> [ 34.289763] [<a80000080802b9cc>] syscall_common+0x44/0x68
> [ 34.295187]
> [ 34.296689] Code: f84000cf 02209825 de020010 <dc420000> d8400004 02002825 0040f809 02802025 f84000c3
> [ 34.306504]
> [ 34.308099] ---[ end trace 0000000000000000 ]---
>
> My initial reproducer was the xdp-tools test suite. A standalone
> reproducer would be an lld/scd loop that, when the read is reordered by
> the CPU, triggers a fault. We can achieve this from userspace by
> stressing an anonymous pipe, which uses a mutex. Program used:
Simpler reproducer than the C program given initially. It takes a few
seconds to trigger.
dd if=/dev/zero ibs=20M obs=70 | dd bs=4096 > /dev/null
Goal is to spam write(2) on one side and read(2) on the other.
Thanks,
--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2026-08-28 15:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 14:07 [PATCH] mips: select CONFIG_WEAK_REORDERING_BEYOND_LLSC from CONFIG_EYEQ Théo Lebrun
2026-08-28 15:56 ` Théo Lebrun [this message]
2026-08-30 3:05 ` Jiaxun Yang
2026-08-31 10:07 ` Théo Lebrun
2026-09-08 14:16 ` Thomas Bogendoerfer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DL0P7NCKVU0I.ARBMN6GAMMBS@bootlin.com \
--to=theo.lebrun@bootlin.com \
--cc=ast@kernel.org \
--cc=benoit.monin@bootlin.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=gregory.clement@bootlin.com \
--cc=hawk@kernel.org \
--cc=jiaxun.yang@flygoat.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=sdf@fomichev.me \
--cc=stable@vger.kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=tsbogend@alpha.franken.de \
--cc=vladimir.kondratiev@mobileye.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.