From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3810CEB64DD for ; Fri, 21 Jul 2023 20:42:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230035AbjGUUmW (ORCPT ); Fri, 21 Jul 2023 16:42:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbjGUUmT (ORCPT ); Fri, 21 Jul 2023 16:42:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D386330D6 for ; Fri, 21 Jul 2023 13:42:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5228061DA0 for ; Fri, 21 Jul 2023 20:42:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AACFC433C7; Fri, 21 Jul 2023 20:42:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689972135; bh=mF5hO4cnwx7N31AkSxnv7cO0zNt07otNtqJAFumdlE0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=eKjjfhikUtSgz9IY1Im/x92qqghAZ+amTqT6cStSSg0vRWwf399UbiMjxveCUBz54 6kXVIYY19sq2q0BExt6lyaKUG1j35X8LNwXHzcouFW7ET2PgcC8+wl/uR3beuea/nf Qdyp7UiKi0vnnk5+3RCRNl+7WknYZkNJ60JaOClQKYiZDOeE8NsYkBcXmAs3PD4R4O cVqK7lWoaxuMB8T1tPRqedTVbzrjgQ21+387A2qV0j13TN4cJBrbxI7P7XhN1Zmuh5 xB3P1bMj/p+gx4P+/+Z2d60iiDXjtNZRZsiMID4j+E64e3DWTRNucqm7iaRpPaXzwt u2qQm8fZibvvw== From: =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= To: Pu Lehui , linux-riscv@lists.infradead.org, bpf@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Palmer Dabbelt , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Guo Ren , Song Shuai , Pu Lehui , Pu Lehui Subject: Re: [PATCH v2] riscv, bpf: Adapt bpf trampoline to optimized riscv ftrace framework In-Reply-To: <20230721100627.2630326-1-pulehui@huaweicloud.com> References: <20230721100627.2630326-1-pulehui@huaweicloud.com> Date: Fri, 21 Jul 2023 22:42:12 +0200 Message-ID: <87sf9hgfob.fsf@all.your.base.are.belong.to.us> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Pu Lehui writes: > From: Pu Lehui > > Commit 6724a76cff85 ("riscv: ftrace: Reduce the detour code size to > half") optimizes the detour code size of kernel functions to half with > T0 register and the upcoming DYNAMIC_FTRACE_WITH_DIRECT_CALLS of riscv > is based on this optimization, we need to adapt riscv bpf trampoline > based on this. One thing to do is to reduce detour code size of bpf > programs, and the second is to deal with the return address after the > execution of bpf trampoline. Meanwhile, we need to construct the frame > of parent function, otherwise we will miss one layer when unwinding. > The related tests have passed. > > Signed-off-by: Pu Lehui I'll do a proper review later (still on vacation), but I ran the test_progs BPF selftest with the ftrace series [1] with this patch on top. 81 more tests pass with [1] plus this patch, which is great! Pre-patches [2], post-patches [3]. Feel free to add: Tested-by: Bj=C3=B6rn T=C3=B6pel Bj=C3=B6rn [1] https://lore.kernel.org/linux-riscv/20230627111612.761164-1-suagrfillet= @gmail.com/ [2] http://ix.io/4B9e [3] http://ix.io/4B9f