From patchwork Wed Apr 19 09:56:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiezhu Yang X-Patchwork-Id: 8417 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp262944vqo; Wed, 19 Apr 2023 03:03:12 -0700 (PDT) X-Google-Smtp-Source: AKy350aDcXR+i7RPMlIJ5aYeOltPK4O7uGF+FJIAlZt+X2o/NNgEJUxMxGyi3yGu/qd8KGf/9LBD X-Received: by 2002:a17:902:7891:b0:1a6:dc1f:6230 with SMTP id q17-20020a170902789100b001a6dc1f6230mr4607589pll.55.1681898591996; Wed, 19 Apr 2023 03:03:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681898591; cv=none; d=google.com; s=arc-20160816; b=eq2EQ/GrhrPGZmQ/nszoF00cG1McCUP4THDVyiH5Jiz0SO6bNt6lPvBWnqzPToU/L8 GRck2op8F9Q0LHAFJtzqS+z9jP+MMYllLh5l6MbAxkaQyDxXVGCR53Fu7DWtod7QPPb2 waAIRL/X3gCwUnvtixq7cu8S2Gxy/cPjm0FTH9C1QRcvEUi7Lyrfim15PN6tbcjjS4Sn mjMIlc0BkL9H99+m7IGNTJDfXEFcaeOy9pRNWBQYJRfkS1jEcqbquf7edra2BGt+zMHW mZPwUfZRG08ERc2cxsuWTM1h8Vv/sAA86CcUNy5SbKkZmTrHl4TkD19l+CUMExmlADO8 tpuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=2HAGeNbww81K91JbSuPrdeCH8gyPb9aF8tIOQUKtE7o=; b=0z/eKwB3SDAcAj6Y9nb4HgrQd41Rq1Gk8GjWPj5O7zxyZEZ4B+qSioBZBd2S/0py0a rFbOUdzTvssZ++C8LzrSuwRKZ8vmNB2GpAQFLPWtPNK5kCUOKSvLr2f2jynNg49lApvi 2V3vvmwvTman6m50Q9e8IYarwz1nKxU//5HBKQCc31WD1JqALVojcOjrm1fpbr2WzZxx qfW4aJGJ5TpEl4lnuDtGnusNqhBgjs0jMLUNO1Zenda353m45NMrNbeBG7KszRUt2wSX euFTFYo+9lJgMlJn2fkrSiruUH3DRe9SkXbUrQKR8+d0+QXVOicq8GDOLg7gM71kSmYf tiYQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l18-20020a170903121200b001a10c64c68csi17194402plh.113.2023.04.19.03.02.56; Wed, 19 Apr 2023 03:03:11 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232807AbjDSJ52 (ORCPT + 99 others); Wed, 19 Apr 2023 05:57:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229688AbjDSJ5W (ORCPT ); Wed, 19 Apr 2023 05:57:22 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2EE82AF37 for ; Wed, 19 Apr 2023 02:57:19 -0700 (PDT) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8AxJDT9uj9k3OEeAA--.49055S3; Wed, 19 Apr 2023 17:57:17 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Bxbb78uj9kXuguAA--.15680S2; Wed, 19 Apr 2023 17:57:17 +0800 (CST) From: Tiezhu Yang To: Huacai Chen , WANG Xuerui Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn Subject: [PATCH v3 0/6] Add uprobes support for LoongArch Date: Wed, 19 Apr 2023 17:56:55 +0800 Message-Id: <1681898221-27828-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf8Bxbb78uj9kXuguAA--.15680S2 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvJXoW7tF4kWFyxXr15ZFy3Zw1DJrb_yoW8Ww1xpF srursxGr45G34fJr9xta43ur1Yyr4xGrW2q3ZIy34rJr4jqr15JF18KrZ8AF98t3y5KrW0 q3WrG3yYga1UA37anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b7kYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_JrI_Jryl8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW8JVW5JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26F4UJVW0owAS 0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYIkI8VC2zVCFFI0UMc02F40EFcxC0V AKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1l Ox8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JMxAIw28IcxkI7VAKI48JMxC20s 026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_ JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14 v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw20EY4v20xva j40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJV W8JbIYCTnIWIevJa73UjIFyTuYvjxUzZ2-UUUUU X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763598497830747476?= X-GMAIL-MSGID: =?utf-8?q?1763598497830747476?= v3: -- Check atomic instructions in insns_not_supported() -- Remove five DIE_* definitions in kdebug.h v2: -- Move the functions to inst.c in patch #1 -- Pass around union for insns_not_supported(), insns_need_simulation() and arch_simulate_insn() v1: -- Split the RFC patch #2 into two patches -- Use larch_insn_gen_break() to generate break insns for kprobes and uprobes -- Pass around instruction word instead of union for insns_not_supported(), insns_need_simulation() and arch_simulate_insn() to avoid type conversion for callers -- Add a simple test case for uprobes in the commit message Tiezhu Yang (6): LoongArch: Move three functions from kprobes.c to inst.c LoongArch: Add larch_insn_gen_break() to generate break insns LoongArch: Use larch_insn_gen_break() for kprobes LoongArch: Add uprobes support LoongArch: Check atomic instructions in insns_not_supported() LoongArch: Remove five DIE_* definitions in kdebug.h arch/loongarch/Kconfig | 3 + arch/loongarch/include/asm/inst.h | 42 ++++++++++ arch/loongarch/include/asm/kdebug.h | 5 -- arch/loongarch/include/asm/kprobes.h | 2 +- arch/loongarch/include/asm/uprobes.h | 36 +++++++++ arch/loongarch/kernel/Makefile | 1 + arch/loongarch/kernel/inst.c | 54 +++++++++++++ arch/loongarch/kernel/kprobes.c | 75 ++++-------------- arch/loongarch/kernel/traps.c | 9 +-- arch/loongarch/kernel/uprobes.c | 143 +++++++++++++++++++++++++++++++++++ 10 files changed, 298 insertions(+), 72 deletions(-) create mode 100644 arch/loongarch/include/asm/uprobes.h create mode 100644 arch/loongarch/kernel/uprobes.c Tested-by: Hengqi Chen