From patchwork Wed Apr 12 10:04:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiezhu Yang X-Patchwork-Id: 8057 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp206613vqo; Wed, 12 Apr 2023 03:09:28 -0700 (PDT) X-Google-Smtp-Source: AKy350YYZf4V+e3cr1AlzTJdyYE+ywfi/Rvcy4RVOCl9ztLiLj7J+D8Pxow8a8+2/p7idTy7T4ep X-Received: by 2002:aa7:c2d2:0:b0:4fa:fcee:1727 with SMTP id m18-20020aa7c2d2000000b004fafcee1727mr13269983edp.13.1681294168147; Wed, 12 Apr 2023 03:09:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681294168; cv=none; d=google.com; s=arc-20160816; b=Sw2cx240Nz2/LvG8g4AeekNqZftsyVb7YlDAHbQb1e3+9+SCm/9HaljzubD5BPD9M+ 5xNfAXX1hqU2V9mmx58QxdmXxdC713XczxAVneCGgePd9TiN12S5c4m0HRbKAcRdyPdi 4gu2nAbaziCJwWRdBM2QNXnkkyAH1YPeEtQDpaB5aroGDywwt/UWVpff4wsuvBYXHPWW 8E3dZaT0jg+HtqBiGiAEKfpLilmqYnSNladjF4qoXI1iBDSCOVT6DwLLml9m0oOjSgtV ZaE2wOiziP+y6z6U8gZE5IUQNTQ2e0LlgnQIAhH1swiMDZ+CyziR7IlTJ6ybFWHVv+Ho HPyw== 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=TdwJorOZyVNogP3yDxaSd0i5MoHf+SNgf0/3pLmx5ng=; b=hdUQ81vII2KyzEZPzWLJWLToUeyBMqIAI6NrmesSEJTKg0dN1GH7zniPVpij4OpEyt 0HJ2BjuzYjCjF7yec8oUVPheH/Nrv7XCsS35OmQHczP5agzSrsjdJKDO63amDcGdburg 5pTUpc/FOInTuh5nSkHsCGas3BM5hJEpNbaPAVMnbI2JzQbhIRR7kex9CuD25PoypTAZ /SZF5GtNWQ8tz/2ySNKQg/2+Gq+slJ8vq/iI+lddtEX2aGMEFOTkd8oz+A2T2dsdhynd eeb+GFthwns+zwfdzuyFJSWu6iYkdVTxMVSpeajqDSeN1DWxSpiZ+mQ+cxd2l/6Qg5yI SngQ== 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 l1-20020aa7c3c1000000b0050484eb14efsi2533049edr.45.2023.04.12.03.09.04; Wed, 12 Apr 2023 03:09:28 -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 S230148AbjDLKFZ (ORCPT + 99 others); Wed, 12 Apr 2023 06:05:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230325AbjDLKFR (ORCPT ); Wed, 12 Apr 2023 06:05:17 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C5D057D84 for ; Wed, 12 Apr 2023 03:05:08 -0700 (PDT) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8CxhdhTgjZkqCwbAA--.42388S3; Wed, 12 Apr 2023 18:05:07 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxSL1SgjZke9wgAA--.34313S2; Wed, 12 Apr 2023 18:05:07 +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 v1 0/4] Add uprobes support for LoongArch Date: Wed, 12 Apr 2023 18:04:57 +0800 Message-Id: <1681293901-24918-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf8DxSL1SgjZke9wgAA--.34313S2 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvJXoW7Jr45XF17XrWxAFWxCw4kWFg_yoW8JryrpF 9rurnxJF45G3s3Jr9xtas3ur1Fyr4xGrW2q3ZIy34rAr42vF15Jr18KrZrJF90k3y5KrW0 qF1rW3yYga4UJ3DanT9S1TB71UUUUUDqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b7xYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jrv_JF1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW8JVW5JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26F4UJVW0owA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Cr1j6rxdM2AI xVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx1l5I8CrVACY4xI64 kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1Y6r17McIj6I8E87Iv67AKxVWUJVW8JwAm 72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64vIr41l4I8I3I 0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWU GVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI 0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0 rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r1j6r 4UYxBIdaVFxhVjvjDU0xZFpf9x07j1WlkUUUUU= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS 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?1762964714025640102?= X-GMAIL-MSGID: =?utf-8?q?1762964714025640102?= 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 (4): LoongArch: Move three functions from kprobes.c to inst.h LoongArch: Add larch_insn_gen_break() to generate break insns LoongArch: Use larch_insn_gen_break() for kprobes LoongArch: Add uprobes support arch/loongarch/Kconfig | 3 + arch/loongarch/include/asm/inst.h | 63 ++++++++++++++++ arch/loongarch/include/asm/kprobes.h | 2 +- arch/loongarch/include/asm/uprobes.h | 36 ++++++++++ arch/loongarch/kernel/Makefile | 1 + arch/loongarch/kernel/inst.c | 9 +++ arch/loongarch/kernel/kprobes.c | 67 ++--------------- arch/loongarch/kernel/traps.c | 9 ++- arch/loongarch/kernel/uprobes.c | 135 +++++++++++++++++++++++++++++++++++ 9 files changed, 259 insertions(+), 66 deletions(-) create mode 100644 arch/loongarch/include/asm/uprobes.h create mode 100644 arch/loongarch/kernel/uprobes.c