Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4992158rwr; Sun, 23 Apr 2023 18:38:41 -0700 (PDT) X-Google-Smtp-Source: AKy350b+VKzO73WVLrXVNb7rL/jO/95IdmVXzaVp8ljNptg7YTva6SVKqZCYRIghttavsd6MwXvr X-Received: by 2002:a05:6a20:7346:b0:f4:fd7:db9f with SMTP id v6-20020a056a20734600b000f40fd7db9fmr3596263pzc.17.1682300320851; Sun, 23 Apr 2023 18:38:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682300320; cv=none; d=google.com; s=arc-20160816; b=0aJPX4egJdVHfc2AiYa6UJTEI9oZJ/lA/vRWulcOfJ0Ml1g0d9dKw1zgk8DnqJsHOk WjlwFH0DhrDeRBFd0HK8Ok7VcuBgvf0kIWJDrSlpnE3XSBsX1mOnxZV9MZizDX7yON7Z 0HNjHHd3mo/pjJUlgLg+dJUFkIZeA5umW+clDthCRRR1MU0mblrrEZcqZ58Q02bP/JTL 6TCccVAAiFLIjshjFBgkU0bI+X1fNElaGWzWQcmGRNYd7g3TbT3nJM3xHMfZsIR61nHX xFx5pFW9oNKeqFeUC3ojg5/7aoUEYXoBsk4LuryxHGbNaQ+t/fPyJVi5AbNanNBrUHN8 p62A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=x7u/Dxlwqx74mnlatfsi4v+FuFMfjkeGA61yl+3xDLc=; b=FQPbx/tkK5bZOnDAI+p5JHXV6+B1IwJzf6xXGLd1rcwL0At4DWKAxTnVWKTDADgI6q JMXKXFXjY+l1AYrc/vo7j9AYMUBPsR9P/iQtHhgtyyVLxBG2OxWEn7fSyUo3T6sp5nQI X1DpjKbi3v6l2qY9d/KWdL2ZgqQ+va08sy0BTONU2wQxMgJK8NooEitA3Mfoira2b0Oe Pa5h1r7J01Dmy0sfjQXR1GVCCx5Kq8ezZnKFbZ6HSOnuO+BT3B7F6BfLKKZHjZVSZQ8R FKLUGyLHn0JnCWk0SxA6NPZR2JcL1cV9pkxD0+1jFVYp2LakZ8BdBC0ocozqwDJnZkCi 2JBw== 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 bs129-20020a632887000000b005200cd1a9bdsi9712590pgb.827.2023.04.23.18.38.24; Sun, 23 Apr 2023 18:38:40 -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 S230311AbjDXBTK (ORCPT + 99 others); Sun, 23 Apr 2023 21:19:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjDXBTJ (ORCPT ); Sun, 23 Apr 2023 21:19:09 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E7E3710DF for ; Sun, 23 Apr 2023 18:19:07 -0700 (PDT) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8CxztoK2UVkHGMhAA--.40538S3; Mon, 24 Apr 2023 09:19:06 +0800 (CST) Received: from [10.130.0.149] (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxoOQJ2UVkbeg3AA--.10000S3; Mon, 24 Apr 2023 09:19:06 +0800 (CST) Subject: Re: [PATCH v3 4/6] LoongArch: Add uprobes support To: Huacai Chen References: <1681898221-27828-1-git-send-email-yangtiezhu@loongson.cn> <1681898221-27828-5-git-send-email-yangtiezhu@loongson.cn> Cc: WANG Xuerui , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn From: Tiezhu Yang Message-ID: <993a2d7e-d7a2-3017-5a81-517ef6f85049@loongson.cn> Date: Mon, 24 Apr 2023 09:19:05 +0800 User-Agent: Mozilla/5.0 (X11; Linux mips64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8BxoOQJ2UVkbeg3AA--.10000S3 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvJXoW7ZF4rJFykAr1kWw4UZrW5KFg_yoW8Jw13pa 15Aay2qrsxJ3y8Cr18X390vryaq3yktr4DWr4DXrWrG3y7Xwn8GF92gryayFyjvrnYgay0 93Wj9FZ3ZFZxAFDanT9S1TB71UUUUUJqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU bfxYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jrv_JF1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26F4j6r4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UM2kK e7AKxVWUXVWUAwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYIkI8VC2zVCFFI 0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUAVWUtwAv7VC2z280 aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcVAKI48JMxk0xIA0c2IEe2 xFo4CEbIxvr21l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1l4IxYO2xF xVAFwI0_Jrv_JF1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWw C2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_ JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJV WUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r1j6r4UYxBI daVFxhVjvjDU0xZFpf9x07j5xhLUUUUU= X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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 On 04/23/2023 09:12 PM, Huacai Chen wrote: > Hi, Tiezhu, > > On Wed, Apr 19, 2023 at 5:57 PM Tiezhu Yang wrote: >> >> Uprobes is the user-space counterpart to kprobes, this commit >> adds uprobes support for LoongArch. ... >> +#define MAX_UINSN_BYTES 8 >> +#define UPROBE_XOL_SLOT_BYTES MAX_UINSN_BYTES > In old versions we define UPROBE_XOL_SLOT_BYTES to 128, why we use 8 now? I assume "the old version" maybe comes from mips, I am not quite sure the backgrounds. For LoongArch, there are 2 xol slots to save 2 instructions, each of them is 32 bit, 2*32bit=8bytes, so UPROBE_XOL_SLOT_BYTES can be 8. >> + >> +#define UPROBE_XOLBP_INSN larch_insn_gen_break(BRK_UPROBE_XOLBP) >> +#define UPROBE_SWBP_INSN larch_insn_gen_break(BRK_UPROBE_BP) >> +#define UPROBE_SWBP_INSN_SIZE LOONGARCH_INSN_SIZE ... >> case BRK_UPROBE_XOLBP: >> - if (notify_die(DIE_UPROBE_XOL, "Uprobe_XOL", regs, bcode, >> - current->thread.trap_nr, SIGTRAP) == NOTIFY_STOP) >> + if (uprobe_singlestep_handler(regs)) > As I know, XOL means "execute out of line", is it an alias of "single step"? I think so, the instruction filled in xol slots is to single step, arm64, riscv, csky also uses "single step" for the related code, powerpc, s390 uses "DIE_SSTEP". Thanks, Tiezhu