Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5231072rwd; Sun, 4 Jun 2023 23:53:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6RK32OlqBRzsYa+H441Yf1EtErr3Mt2IokgZQbjFYrxJcqalDlC2fZqQf/yDb7e2DAr2Hw X-Received: by 2002:a05:620a:678c:b0:75d:4fb8:e219 with SMTP id rr12-20020a05620a678c00b0075d4fb8e219mr4261907qkn.36.1685947987434; Sun, 04 Jun 2023 23:53:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685947987; cv=none; d=google.com; s=arc-20160816; b=DYdrC9wEujlGYUwI3CWpcV4DrzncIyoyEBBsO0jntH6emR3/9ORg49lduUUa/G7gKi p2fbDTFYWkRMZfcF4JvinRd3mGROi1YaPleCG6WOqVYGpVy5wX4WJA0rke4itQ7CPQ3l 6zuEFUTWXTzmLgvIb/MDZYXx1SCe9Xp71p2whW2M+ua2vdbfEKTQW2JakaKK95MMNHju xRRU18xGFapCePuCLePL8au7kKFxWHiGU048jcO1FI/JAhku0onWq1vSKM5SPP5gTzzn TGribnnDaVKaUJ5RWs3blKqBd7DsR+rM1qw0qyo2JObJ4gUwInMpD1d0noRgCR4zArOL AG1A== 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=8gFmzNj1BkX2yLb8y4Dezruciktxw96mSxZJUSs046Y=; b=Zo4jWZh5z/sSHNgalrQMbGSX9HOjgPPQw8i2VaE6Q47S69btXVaZvpWgIZ6n/40Lo0 cOxWPrn5JAfxiAs7c8DZJcs05jwlJEb/DYIqMFUgenr//xrYXl8+QzID/2D59zkdA2RI xO+m5kbwV0m7IfQgKWUsVkpAoHnKmaNqIHlCDCXjfQppkAWzcFcArJcfuAi4OYMQk0G4 bgfJnIb/T/JqKCqc1tHnp2+xB3iXBZmX9j6R1MoxKu0LBU9twloH7kYBOHv+D/ofLwJz tGAVdZgrDFe6fOGi8pTBNT/dt1oQOyUecZBxAspirEdwACSH4CwTHmnbG6oGtdo0zhCx Zbww== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt7-20020a17090af2c700b00250a2c9a793si5098324pjb.152.2023.06.04.23.52.50; Sun, 04 Jun 2023 23:53:07 -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 S229906AbjFEGjV (ORCPT + 99 others); Mon, 5 Jun 2023 02:39:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229639AbjFEGjS (ORCPT ); Mon, 5 Jun 2023 02:39:18 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 13945E9 for ; Sun, 4 Jun 2023 23:39:14 -0700 (PDT) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8AxcPAPg31k7wUAAA--.234S3; Mon, 05 Jun 2023 14:39:11 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Axa9YPg31kHQcAAA--.72S2; Mon, 05 Jun 2023 14:39:11 +0800 (CST) From: Tiezhu Yang To: Huacai Chen Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn Subject: [PATCH v5 0/6] Add uprobes support for LoongArch Date: Mon, 5 Jun 2023 14:39:04 +0800 Message-Id: <1685947150-4949-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf8Axa9YPg31kHQcAAA--.72S2 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj93XoW7KrW8XF48Gr1kKr18CF4Dtrc_yoW8ZF18pF srurnxGr45GryfXrZxta43ur1Fyr48GrW2qFnxC34rAw4jqF15Xr18KrZ8CF98t3y5Kry0 qF1rG3yYga15A3cCm3ZEXasCq-sJn29KB7ZKAUJUUUU5529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUkjb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ Gr0_Gr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx1l5I 8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1Y6r17McIj6I8E87Iv67AK xVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64 vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8G jcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2I x0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK 8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I 0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07j1WlkUUUUU= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, 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 v5: -- Rebased on 6.4rc5 -- Like arm64, add user_enable_single_step() in arch_uprobe_pre_xol(), add user_disable_single_step() in arch_uprobe_{post,abort}_xol(), suggested by Jeff and Huacai offline 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 | 152 +++++++++++++++++++++++++++++++++++ 10 files changed, 306 insertions(+), 72 deletions(-) create mode 100644 arch/loongarch/include/asm/uprobes.h create mode 100644 arch/loongarch/kernel/uprobes.c -- 2.1.0