From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yx1-f53.google.com (mail-yx1-f53.google.com [74.125.224.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 38EAA28686 for ; Fri, 21 Aug 2026 02:50:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787280620; cv=none; b=nu3yvI30dQqDLy0aqFDcwZ0b4Tn9/gQ+yvJmO8gOT2zFMjQgghdvRPNnd9kL3E7dWMUswbMujJjskBEGotmN1Ne77FdaGpc3u7d/lCLWBJ3Xqfs3rG2MToDgSrrIltQ7LBmKwHRzMOjQc8FszkgB8H66jaIbfJAx4C+EJjE5/Oo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787280620; c=relaxed/simple; bh=NZiy0I0LfKDGdP8gcLo+2A+fnvZn6aM2d+SsTHj3iko=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=YXNGu1Mu5Xn+jkEVxhaPWChNWDpdrnhiHAy92mL49yjBHgOoPmt2ssx35M6pUCHqy4pk50aXKPH+UNiu7xjwun07xaElE7CWddfjMB31xUBk7bEt558hrABaxdZCxXoPJm+joNi5d3OLpgg8HNfLB/DovAN5zIl1e7pNqczX9Z0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BvjshYz8; arc=none smtp.client-ip=74.125.224.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BvjshYz8" Received: by mail-yx1-f53.google.com with SMTP id 956f58d0204a3-66b2c08803cso536091d50.2 for ; Thu, 20 Aug 2026 19:50:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787280617; x=1787885417; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=Ow8qo7sHcSx/W3utHs5N9xZe+w2Vs/hGwVJrOJRCERg=; b=BvjshYz8weIHb9vHeagK4GZ3yQgGRbWkM23zxLFchzn32CrEnyNFiG1zwcCw9J96Za pyOyWOJThaqLPuMpoOYVxmRptx3IYZkCNo/3IblJ0zp5bKwXuxqssjBqV86w0CV9MMKz RH+VP8gUrPGiTIVsQJ04i9289kp3SmVoCxnH2CKs2nyLvUixQObREi2ql1mlNdVMuFD8 Yd8N3paZ9DF/NvgkmOXMvnTpItHDPsUd2AHryGkQp+xmdfMsFGYwYhvzNricg/lwTFmv 3r0OmgjFNI5qwk3+ElCFKplzR+8ynp6ZydEI/LDpE9PWEWoUw6blfK6/XZo04kCM6DTK WrHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787280617; x=1787885417; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Ow8qo7sHcSx/W3utHs5N9xZe+w2Vs/hGwVJrOJRCERg=; b=LJmEKJ6Rd7qV6fXNWn9dT8oQoRRBjSFNFBAL83/qcVzN5qJRR7eh692YTmrFWO8Gp+ zm8EUhGo9GtppdqMYJ9Lpv9y2Ct2vlfO+jBmpWpFYwk9YT5YuoMNm3gfVnaOP/AylVQT SsmG/FMp6jcJ9osRL9dhPqQItBrI1dC/Z9MqNNOE6MWMvTXtMoHUL4ePT7+oIunTiCDf 1i85iaBBlK4+pCvMzZYleGbfpOU2DKYuXYCwijELapXmwN5rkpFfcgyVvY/vwKv3WuLG zoMayjp0OlR9SYcmcFQNcGbDctCsQqfBVbqSGWfxX0i6GMEQytaaOleNa36KfYzQW5kD Mu3g== X-Forwarded-Encrypted: i=1; AHgh+RrK1OQ0CtKa6cKjFzRFk+p3pCFj/gQ2tRo99hsUjpCzHNvXHrKsnvdGEY+YO4ks1dDuOegt8+nV3iAxMrw=@vger.kernel.org X-Gm-Message-State: AFuF++kvThKALoe/VVFbGCfEUWaIPK3W9fwe7wyDVdJSpcpNUxjjP5ng Lh7kPerQY3IQln43/SsGfjNVZU1KjZx+TR6+FzNmd0qkA1ZaKZjuUviE X-Gm-Gg: AR+sD117lASlvSExo52v5TXUJ3OT1/O9XwCb118mRX7Zgn5qTTghWR9DTwgR0LqF1tP J+sLfquPXvSrv0FaLVkq5rpVG2UVDMNv7XUdtkNamvpO+84HQxT0abffFTqexVHn5WX9KtSR/H/ 0L+TVAQG3m9iclDo1rocTp/xMIcJA27Q94KhNwBtiLZZV6PkeNs5rhwwlreCqspLHxKjT3jXSZ8 6/LauM3mu0kpA95k2SbtKsqJQHLPLGnEHjLOCtHBveAqQOdhhDmHjcc3fUPkQdST5PNLy6t58MF zJHhj9//JPf4nZGmR3yy1CVsP+Ryh3p//L/GRYityfdbl3lfiL/g48be4gU1mhvDeX63GfhhthE /k+zM4Q7TN5ee4nG/pJw9QCmpc6UCUiqbg/6c+GuNFJf5B8gXUz8NARyf1QPS7253qZPAiyNMCE ao//BOQiwbkaz6MEN/67zGiKjzCUSfc95L+NvNSNQl7wsSHu4GyfPtYgaZpw== X-Received: by 2002:a05:690e:702:b0:666:3df9:8643 with SMTP id 956f58d0204a3-66ce4a10b1amr1040646d50.19.1787280617165; Thu, 20 Aug 2026 19:50:17 -0700 (PDT) Received: from Turin ([187.15.143.241]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-66ccb144956sm3682195d50.13.2026.08.20.19.50.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2026 19:50:16 -0700 (PDT) From: Nicholas Dudar To: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com, johan.almbladh@anyfinetworks.com, paulburton@kernel.org, tsbogend@alpha.franken.de Cc: martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org, emil@etsalapatis.com, ihor.solodrai@linux.dev, bpf@vger.kernel.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC bpf-next 0/2] bpf, mips: Add BPF_MEMSX support to the JITs Date: Thu, 20 Aug 2026 22:46:38 -0400 Message-ID: <20260821024640.1601299-1-main.kalliope@gmail.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit bpf-next is closed for the merge window, so I am sending this for review. I plan to post this series after it reopens. The MIPS32 and MIPS64 JITs reject BPF_MEMSX byte, half-word, and word instructions, so a program containing one cannot run when JIT execution is required. First factor ordinary narrow-load selection into backend-local helpers. Then extend those helpers to select signed native loads for BPF_MEMSX. MIPS32 observes the load-delay rule and propagates the low-word sign into the high half; MIPS64 obtains the full result from the native load. Ordinary loads remain unsigned, and BPF_MEMSX with BPF_DW remains unsupported. This series must be applied after the in-review MIPS MOVSX and SDIV/SMOD series: MOVSX: https://lore.kernel.org/bpf/20260819010523.1057789-1-main.kalliope@gmail.com/ SDIV/SMOD: https://lore.kernel.org/bpf/20260810194215.3754591-1-main.kalliope@gmail.com/ Applying MEMSX removes a whole-program JIT fallback that otherwise keeps mixed programs containing unsupported MOVSX or signed DIV/MOD out of the JIT. The ordering discussion is here: https://lore.kernel.org/bpf/CAJZwKkis=3NGw9At0WfiZaRYEoMPbQfqJKN0e+vtRDvp4VY5Ng@mail.gmail.com/ On four little-endian profiles, patch 1 leaves the complete test_bpf results with 1031 passed/31 failed on MIPS32 and 1030/31 on MIPS64. Patch 2 changes the three MEMSX cases, yielding 1034/28 and 1033/28, respectively. Ordinary unsigned-load controls passed at each boundary. Selector-focused QEMU testing covered MIPS32 base, R2, and R6 plus pre-R6 MIPS64, each in big- and little-endian configurations. The focused mixed-operation matrix reproduced the unsafe MEMSX-first ordering and the correct fully composed result on MIPS32 and MIPS64, both big- and little-endian. No physical MIPS hardware was tested. Nicholas Dudar (2): bpf, mips: Factor narrow loads out of emit_ldx() bpf, mips: Add BPF_MEMSX support to the JITs arch/mips/net/bpf_jit_comp32.c | 51 ++++++++++++++++++++++++++++------ arch/mips/net/bpf_jit_comp64.c | 47 +++++++++++++++++++++++++++---- 2 files changed, 85 insertions(+), 13 deletions(-) base-commit: 91ec2035134982b98fab0609a9fd8480e8217dc1 prerequisite-patch-id: aa8ca3f50fc4b0160c5fdba43a92e4b7ec3f2e07 prerequisite-patch-id: bda4c3f3d59b48d784ed98bd8558d9591399bc86 prerequisite-patch-id: 35236f563c0536859077709d52b345b696e5c26e prerequisite-patch-id: c0f282b0e57ecd60e9582fb1e89e4b3112ae7893 prerequisite-patch-id: 4e93eed38f6585e21fc13931c314907b4e437ef5