From patchwork Mon Oct 10 09:32:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Youling Tang X-Patchwork-Id: 13002389 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 74986C4332F for ; Mon, 10 Oct 2022 09:32:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231674AbiJJJck (ORCPT ); Mon, 10 Oct 2022 05:32:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231319AbiJJJcj (ORCPT ); Mon, 10 Oct 2022 05:32:39 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6BA4631EDA; Mon, 10 Oct 2022 02:32:36 -0700 (PDT) Received: from bogon.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxkOCl5kNjKPwpAA--.21250S2; Mon, 10 Oct 2022 17:32:22 +0800 (CST) From: Youling Tang To: Huacai Chen , Masahiro Yamada , Michal Marek Cc: WANG Xuerui , Nick Desaulniers , Daniel Borkmann , Alexei Starovoitov , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH 0/7] LoongArch: Switch to relative extable and other improvements Date: Mon, 10 Oct 2022 17:32:13 +0800 Message-Id: <1665394340-13906-1-git-send-email-tangyouling@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf8CxkOCl5kNjKPwpAA--.21250S2 X-Coremail-Antispam: 1UD129KBjvJXoW7KFWxKFykWr13XFyDGF17ZFb_yoW8CrW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: X-Mailing-List: bpf@vger.kernel.org Similar as other architectures such as arm64, x86 and so on, use offsets relative to the exception table entry values rather than absolute addresses for both the exception locationand the fixup. And recently, arm64 and x86 remove anonymous out-of-line fixups, we want to acchieve the same result. Implementing the relative extable will facilitate subsequent kernel relocation support, which can reduce relocation operations to the extable (thanks to Jinyang for the suggestion). At the same time, add BPF exception tables handling. Youling Tang (7): LoongArch: Consolidate __ex_table construction LoongArch: Switch to relative exception tables LoongArch: extable: Add `type` and `data` fields LoongArch: Add gpr-num.h LoongArch: extable: Add a dedicated uaccess handler LoongArch: vmlinux.lds.S: Remove `.fixup` section LoongArch: bpf: Add BPF exception tables arch/loongarch/include/asm/asm-extable.h | 65 ++++++++++++++++++ arch/loongarch/include/asm/extable.h | 49 ++++++++++++++ arch/loongarch/include/asm/futex.h | 27 ++------ arch/loongarch/include/asm/gpr-num.h | 22 +++++++ arch/loongarch/include/asm/uaccess.h | 24 ++----- arch/loongarch/kernel/fpu.S | 5 +- arch/loongarch/kernel/vmlinux.lds.S | 4 +- arch/loongarch/lib/clear_user.S | 17 ++--- arch/loongarch/lib/copy_user.S | 19 ++---- arch/loongarch/mm/extable.c | 60 ++++++++++++++--- arch/loongarch/net/bpf_jit.c | 84 ++++++++++++++++++++++-- arch/loongarch/net/bpf_jit.h | 2 + scripts/mod/modpost.c | 13 ++++ scripts/sorttable.c | 2 +- 14 files changed, 312 insertions(+), 81 deletions(-) create mode 100644 arch/loongarch/include/asm/asm-extable.h create mode 100644 arch/loongarch/include/asm/extable.h create mode 100644 arch/loongarch/include/asm/gpr-num.h