From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f177.google.com (mail-dy1-f177.google.com [74.125.82.177]) (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 F09C727A133 for ; Mon, 15 Jun 2026 16:18:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781540298; cv=none; b=V+xa9cq4ZBJ+PPEcI7hWfiltsCQjgF+zoRJkvWyEq7y1svkCjC0hFBxHnn3TMyOJkWox0W1vaTq6jswpuUu2tll9+4M2UqwkvV8I8BAiI90JRt3qPmuB4AUcJ6Fb+y0fH4afafqZV8P/2sdlcp5Eot3oeSlyUICMfSdVJRvqkz0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781540298; c=relaxed/simple; bh=IOMZlbpL0GrwFfKcFv9wUsIFMWMA6CS04KAis2OFcPI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CqEUC/5RgM5mwHYWN32/UW7saHuJPzhU4EVJGD7qO3VxXYAO+04e/sbkvJEG7jsHB4QXKBx0FUEYKSRqdIXRuAF0MtIcn2mXDPArDezpEBCBpCYTmGMLzP9KG5fDKYBkcbztf5Esb0SZOObdowLBCrmtqYcOlQi76TiGRKsCmCg= 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=e+7Vqvs4; arc=none smtp.client-ip=74.125.82.177 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="e+7Vqvs4" Received: by mail-dy1-f177.google.com with SMTP id 5a478bee46e88-304d0ac5e3cso8202210eec.0 for ; Mon, 15 Jun 2026 09:18:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781540296; x=1782145096; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=3MPPoX2HOZ1fi6+ZgFgHzOVUR8qos12VTmnYrcXYqIg=; b=e+7Vqvs4KGzz7EZe2VCDPZAhk2upus5u3tMr9GQx8PGY99IJleNo0LjzqYU9x254yd KfDG48IVPelg4b2jF7neX2zK83KQmWCvREOprWoBhic2Jwtk8KeR9cLStMfLJWsnZBOI 24t7DRKRiT7x6cCvb1nVWJqdWBO6WJsDlQL+VByQnFBI3YchC8xZpdDWFu2YPQVU5loO UMqvJWQUYYdnUdr70G5Kgrn22ZP0hJmFBlghvFUA2OYGPsgNuLyVEF8HSQHzPeZUxgDH SjlD/DwVB8AZNzGLNpYWUs8ahl0q6LQxbpA6m5MF72tMjohbVn9hpltAkAghS2HW92mV efmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781540296; x=1782145096; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3MPPoX2HOZ1fi6+ZgFgHzOVUR8qos12VTmnYrcXYqIg=; b=FDOrtZLf6XwbJWrd2tQG8zW2CeHpqYVdOQKz0kuWKY245z3W9+EdoVLWPbAIyuOQKj Nj6obIL7fZunFrD2Bku1DAkQCy2ZaBjXrOT9ex3UsWJ1cuAiTT49ssiYKWBRZQwpD4j0 rpTFyEQcsGyI7RiOKEZhlNjiuXIdn2wCC4XC0tY45M/6/xaSVZ3eEGD3wdJiQWLMuAJY /NO9MKaFghWxFJ3Q3awjZrovsSJ652NEEuYnxMMB8BWBsG2OKXFpvnf5ptH8/5qTZfbE eUBr5D0XtPwc7kE/HYP0f2M+eAyIVobG7Rd4cKzdasOf3Bdhf4BghQcG8tyq7B1A7UcU ixQA== X-Forwarded-Encrypted: i=1; AFNElJ/BdElNPWqUOHNelEhnI9rXBpW1BpVBTandhG1lGeRtQVyxBQuP50jfsmoFJrLem5hAsZoucm1lo5SXJSs=@vger.kernel.org X-Gm-Message-State: AOJu0YxXAk/UJ1VUYj5DcNS/+M+js1JErkDJRxzYpLiPrMcjdfoRRe9g 4AbNXfXz7zyGKAX/j3w306B+8vA5rvdMuaSJhthfEzQXagZgD2/WSTTB X-Gm-Gg: Acq92OHIc4YXFYddLkPFcZ5BGYxIvXi3kVhdcs3RbaE4agDwXvlK9tlAKCqa17uzTG9 3qN2zaiPyXBDiOl5EJhPv5mmW/UMJ9EMQDIkpH8yEZTO2aYd4md54tPRZfT1pLX8i4dTDLUqLD0 z3VVtdYAIs1cO4j0j9875sek62GjfqSl+BdDixakVES9vcbBeeF6vDI5+s+Cwkyv6Y1B2Q6Qs5J FAibMgQV2edLBYPVrxiXmCMmt5TaQ6cZCB7aceICM4GB54Er99NwWJ0MybgfI2XNq4HzcMPSy86 JRCYAVdGjnrnY3ZwtJtSuUqWjQKW0d8CtoSZCgK8v6FVlxNA1BWDXMXT2jLvn0I5GNPZIAlpMBb H6jVZn0/oQQlW1B741g4uwAR9mMm7bD6Ot+c9/Yoznl9XO8vfIcooIe3jhJ2qi23BZj3hLP9w9M ww3sQ9LHsAYTdki5sz7dF1zX4= X-Received: by 2002:a05:693c:42d1:b0:30b:5571:b412 with SMTP id 5a478bee46e88-30b5571ba3emr3834996eec.5.1781540295974; Mon, 15 Jun 2026 09:18:15 -0700 (PDT) Received: from google.com ([118.150.148.19]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3081e5fefecsm15400189eec.13.2026.06.15.09.18.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jun 2026 09:18:15 -0700 (PDT) Date: Tue, 16 Jun 2026 00:18:08 +0800 From: Kuan-Wei Chiu To: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com, luke.r.nels@gmail.com, xi.wang@gmail.com, pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu Cc: martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org, alex@ghiti.fr, jserv@ccns.ncku.edu.tw, eleanor15x@gmail.com, marscheng@google.com, bpf@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH bpf-next v2 0/3] riscv, bpf: Fix signed operations and add 32 bit atomics Message-ID: References: <20260511221648.3251464-1-visitorckw@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260511221648.3251464-1-visitorckw@gmail.com> Hi, On Mon, May 11, 2026 at 10:16:45PM +0000, Kuan-Wei Chiu wrote: > Fix miscompiled signed operations and expands 32 bit atomic support in > the RV32 BPF JIT. > > The current implementation ignores the instruction offset field used by > the bpf instruction set to specify BPF_SDIV/BPF_SMOD and BPF_MOVSX. > This causes these operations to be treated as unsigned or > zero-extended, leading to test_bpf failures. Fix this by checking the > offset and emitting the correct instructions. > > Additionally, we leverage the mandatory A extension to natively support > 32 bit bpf atomics (and, or, xor, xchg) by mapping them directly to > amo*.w instructions. BPF_CMPXCHG continues to fall back to the > interpreter. > > As a result, test_bpf.ko now runs with 0 failures, and the total number > of successfully JIT'ed test cases increases from 843 to 902. Is there anything else I need to do for this patchset to land? Regards, Kuan-wei > --- > - Add missing Fixes tags. > - Fix memory ordering by emitting aq=1, rl=1 > > Kuan-Wei Chiu (3): > riscv, bpf: Fix support for BPF_SDIV and BPF_SMOD in RV32 JIT > riscv, bpf: Fix support for BPF_MOVSX in RV32 JIT > riscv, bpf: Add 32 bit atomic operations to RV32 JIT > > arch/riscv/net/bpf_jit_comp32.c | 101 +++++++++++++++++++++++++++----- > 1 file changed, 85 insertions(+), 16 deletions(-) > > -- > 2.54.0.563.g4f69b47b94-goog >