Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp424115rwo; Fri, 21 Jul 2023 14:17:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlELOvURzer0m9S0m+Yx2wTGmnP23Norzb9cRpUYV8FBjfAilmBv0coaIR8SOlqD8ijo9k+0 X-Received: by 2002:a2e:9204:0:b0:2b6:e623:7b57 with SMTP id k4-20020a2e9204000000b002b6e6237b57mr2532553ljg.25.1689974248847; Fri, 21 Jul 2023 14:17:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689974248; cv=none; d=google.com; s=arc-20160816; b=MxaPoZFR/ujjcDs6qHSpCd6PDIFnvjipW9sfZzgLlaLjN49KxXs/wdCwljKOjOvwv+ D2Vqqmz4+q2oHYBGl0tevqxn5bm8BTaF+izm7XAMr4MBOMxlOxC3xxXW4/oKSmqFlziW IFZhs5e2se//pmP12IPCRLpauCmKqshWNwYvXgh/7zO5AjuROmoRGfdad6PaKba32gR/ hUYKZ23Sjyufs0AoTQRQfDxnRrkOf88gJcsJtIS141+BWP+0CJ0evcSo64w08VCh1oqv zAkZbtY+KuR3RTrNUUU3wnwgznoDP2WHvQ2bH5MzITi9nqwGLxugeLJu8MQm9x0jU8Qy 3ysg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=mF5hO4cnwx7N31AkSxnv7cO0zNt07otNtqJAFumdlE0=; fh=Gav+BSajVNbO/RsiVvWj6MfCqz/4yG4bK8R5Q3Vt9fs=; b=ES2LDWBADHL0hX8+JUUqezGmzej9jlae1G5Rr2FAD7FWG8Qc+xOdgjh/RqUtDSO3A8 Nk9PN7rSdVUgGF4OcKBF9DSqvjUEdTdwYOQzVlJ6ziCVqV10IdChtAlKLYo+MOpXIkJf adCpLjr+bjs9C5X2ObBpAhpkAcwwWVkGVT3JbncvpyLb61jhRruBatkTYyx/COXk+yHL ANRzo5e1AaInJEoN2dsrqw9ZEYDvn+f87F+R9y+YEnvEU9UJ7rYFiPM0ISTXqn3Z3q8E 0tXI2XEknG0yGD7Ltxj3D4djj5kcNW3AqjoH6XudfMuQ0p5lojrl+3dZJ2c0y0mfRiVk k/SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eKjjfhik; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a8-20020a1709064a4800b00992c7f7356dsi2665171ejv.8.2023.07.21.14.17.04; Fri, 21 Jul 2023 14:17:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eKjjfhik; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230230AbjGUUmV (ORCPT + 99 others); Fri, 21 Jul 2023 16:42:21 -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 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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