From patchwork Thu May 11 08:06:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiezhu Yang X-Patchwork-Id: 9190 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp4199640vqo; Thu, 11 May 2023 01:13:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Kf6XKkKhE9vwzF1SPtRm8TvW7NhdivGT/8hq6G/uDBcLwu0bBmqOgvfVNnXvoBKq9v9ly X-Received: by 2002:a05:6a00:1828:b0:63b:8dcc:84de with SMTP id y40-20020a056a00182800b0063b8dcc84demr23596066pfa.4.1683792839232; Thu, 11 May 2023 01:13:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683792839; cv=none; d=google.com; s=arc-20160816; b=lwbgFDR3fJhFNGhtBvW4tZaQG+jU0ZAUBvfNVbkcfMj5mR0rCHhB6rOjgbjX+ZzvBq 2Br4v9Dh8bWodmTjZuR4BL8ohfPeTunsBAII8FtOfWA5yebhD46m80GVUf27oW+XGVaN b8iF9s4PeMlY/lAdeA3oZPDREl0X/Hd+hEZMUb3U4cgBHcOY6GOeyr1uzFJOpJOeyROK /FoMP+2dfmltF79ghqTSj2OJtgPbGPF7z1Z7HxwyR8EvWopL7n0xj7zPVVcU2Spjtixs nYcHClOqYVo2TYAMbWsMg5S7XcNC6ZU4jArj8s6TvQHML7AtCT3X6s1dVygnh9yQ5bki LbLA== 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=5UftY2j6Bz++2oJBijVD1I6gngDfR/TikFxVqoWa2lU=; b=Y2mvpGe1b+rr5MzTmVeYHmq6/a8Aa9ehdviaA8bD1tqEYKLLNunJAkcC4AwSNXV9tV 2i+vCe2ghbpOkxR0UWBSFILU0RtG1lG2GnqsyCgOQRejBnKyxWv1evu6FpTYJkELIBWU Fe9RXT5I0h8IqAaUO8TEi0qc7noqJGTPsgfpht3KiA9KLOrnLt2+sZVbXG5Loxw+OZ+m Q1WTOQa0ipq7o6pt9LAa74B8NQVyXFYrt4CVHJMdOQPt4zz0ZtJN54FetJSGguQRfyUK 3vyKp4wTukbbh9q8WI5/iOzCVzOdpGFACdEMZp4PGYfV6OTYKswN0dZ79mHXC6zaSjD5 WRlw== 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 y8-20020aa793c8000000b0063732344e2fsi6915486pff.190.2023.05.11.01.13.45; Thu, 11 May 2023 01:13:59 -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 S233666AbjEKIGn (ORCPT + 99 others); Thu, 11 May 2023 04:06:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233940AbjEKIG2 (ORCPT ); Thu, 11 May 2023 04:06:28 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6AF337DA9 for ; Thu, 11 May 2023 01:06:20 -0700 (PDT) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8CxE_D7oVxkNK0HAA--.13108S3; Thu, 11 May 2023 16:06:19 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Cxqjr5oVxk7XNVAA--.21787S2; Thu, 11 May 2023 16:06:18 +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 v4 0/6] Add uprobes support for LoongArch Date: Thu, 11 May 2023 16:06:06 +0800 Message-Id: <1683792372-29338-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf8Cxqjr5oVxk7XNVAA--.21787S2 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvJXoW7tr1kZw1xKw4DKrWDXw1UKFg_yoW8AF4fpF srursxGr45G34fXr9xt34fur1Yyr4xGrW2q3Zxt34rJr4jqr15JF18KrZ8AF98t3y5KrW0 qF1rG3yYga1UA37anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b7AYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_JrI_Jryl8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW8JVW5JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4UJVWxJr1l e2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27wAqx4xG64xvF2 IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r1j6r4U McvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCF04k20xvY0x0EwIxGrwCFx2 IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v2 6r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67 AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IY s7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Jr 0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU1EksDUUUUU== 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?1765584760297483748?= X-GMAIL-MSGID: =?utf-8?q?1765584760297483748?= v4: -- Rebased on 6.4rc1 -- Fix problem about "perf probe -x /lib64/libc.so.6 malloc" 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 | 35 +++++++++ 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 | 148 +++++++++++++++++++++++++++++++++++ 10 files changed, 302 insertions(+), 72 deletions(-) create mode 100644 arch/loongarch/include/asm/uprobes.h create mode 100644 arch/loongarch/kernel/uprobes.c Tested-by: Jeff Xie