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 C6EB9C6FA82 for ; Mon, 19 Sep 2022 09:04:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230192AbiISJEk (ORCPT ); Mon, 19 Sep 2022 05:04:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229667AbiISJEg (ORCPT ); Mon, 19 Sep 2022 05:04:36 -0400 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D22AB67; Mon, 19 Sep 2022 02:04:31 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4MWJbt0ckPzl6GL; Mon, 19 Sep 2022 17:02:50 +0800 (CST) Received: from k01.huawei.com (unknown [10.67.174.197]) by APP2 (Coremail) with SMTP id Syh0CgDHY22cMChjI49JBA--.48437S2; Mon, 19 Sep 2022 17:04:29 +0800 (CST) From: Xu Kuohai To: bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Daniel Borkmann , Jean-Philippe Brucker , Alexei Starovoitov , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Zi Shen Lim , Catalin Marinas , Will Deacon Subject: [RESEND PATCH bpf-next 0/2] Jit BPF_CALL to direct call when possible Date: Mon, 19 Sep 2022 05:21:36 -0400 Message-Id: <20220919092138.1027353-1-xukuohai@huaweicloud.com> X-Mailer: git-send-email 2.30.2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UJbIYCTnIWIevJa73UjIFyTuYvjxUo0eHDUUUU X-CM-SenderInfo: 50xn30hkdlqx5xdzvxpfor3voofrz/ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently BPF_CALL is always jited to indirect call, but when target is in the range of direct call, a BPF_CALL can be jited to direct call. For example, the following BPF_CALL call __htab_map_lookup_elem is always jited to an indirect call: mov x10, #0xffffffffffff18f4 movk x10, #0x821, lsl #16 movk x10, #0x8000, lsl #32 blr x10 When the target is in the range of a direct call, it can be jited to: bl 0xfffffffffd33bc98 This patchset does such jit. Xu Kuohai (2): bpf, arm64: Jit BPF_CALL to direct call when possible bpf, arm64: Eliminate false -EFBIG error in bpf trampoline arch/arm64/net/bpf_jit_comp.c | 136 ++++++++++++++++++++++------------ 1 file changed, 87 insertions(+), 49 deletions(-) -- 2.30.2 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BCD28C54EE9 for ; Mon, 19 Sep 2022 09:06:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=S00FaqPivZDpsFFdRHM28dNj/4UTw4u8VyKRFUtqY54=; b=nDgrY99AVbz41D lt3KqYyuI285lRTRARfORP1vXfijVdIVqvjSpTdQ+yoAIjH4cml1gAo7qHXA/DBcHNCmx0l4fxKWM JOskqXjP3v00EUQbpHnlPOBaA5XoSWAIxfkYfvgQT2IaVHY3506h/nTKSmc6t1LjTwMvwmvPpMmN3 N8iNDHeWZttLu+ZBJDRaflvUhpIAzwGyMZXbr0VYBuaE8leRAjAzox74jWB+ExPhjARZ0/c7WgA++ RaF8DTijk1g0kx2xEm8HT/rkx06PvzBGV//Xh38HppEpi6mMKb74tAwUR5LwbfjeX2jTzIh2OnMsg ptmldnljg4F/B7xDKX0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oaChu-00AYDX-9b; Mon, 19 Sep 2022 09:04:50 +0000 Received: from dggsgout11.his.huawei.com ([45.249.212.51]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oaChn-00AXrN-FP for linux-arm-kernel@lists.infradead.org; Mon, 19 Sep 2022 09:04:46 +0000 Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4MWJbX4tkczKJW0 for ; Mon, 19 Sep 2022 17:02:32 +0800 (CST) Received: from k01.huawei.com (unknown [10.67.174.197]) by APP2 (Coremail) with SMTP id Syh0CgDHY22cMChjI49JBA--.48437S2; Mon, 19 Sep 2022 17:04:29 +0800 (CST) From: Xu Kuohai To: bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Daniel Borkmann , Jean-Philippe Brucker , Alexei Starovoitov , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Zi Shen Lim , Catalin Marinas , Will Deacon Subject: [RESEND PATCH bpf-next 0/2] Jit BPF_CALL to direct call when possible Date: Mon, 19 Sep 2022 05:21:36 -0400 Message-Id: <20220919092138.1027353-1-xukuohai@huaweicloud.com>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4UJbIYCTnIWIevJa73UjIFyTuYvjxUo0eHDUUUU X-CM-SenderInfo: 50xn30hkdlqx5xdzvxpfor3voofrz/ X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220919_020443_702207_04BBD95C X-CRM114-Status: UNSURE ( 6.92 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Currently BPF_CALL is always jited to indirect call, but when target is in the range of direct call, a BPF_CALL can be jited to direct call. For example, the following BPF_CALL call __htab_map_lookup_elem is always jited to an indirect call: mov x10, #0xffffffffffff18f4 movk x10, #0x821, lsl #16 movk x10, #0x8000, lsl #32 blr x10 When the target is in the range of a direct call, it can be jited to: bl 0xfffffffffd33bc98 This patchset does such jit. Xu Kuohai (2): bpf, arm64: Jit BPF_CALL to direct call when possible bpf, arm64: Eliminate false -EFBIG error in bpf trampoline arch/arm64/net/bpf_jit_comp.c | 136 ++++++++++++++++++++++------------ 1 file changed, 87 insertions(+), 49 deletions(-) -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel