From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from azure-sdnproxy.icoremail.net (azure-sdnproxy.icoremail.net [52.237.72.81]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AF43F3B8944 for ; Wed, 19 Aug 2026 10:26:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=52.237.72.81 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787135190; cv=none; b=mJg/sJkfiptjlG4S2o/SSFDbu/W64LT2NGqTvgp+70PGKycu1LqugFSlUC2phCAj2sxx4gawc2+b+OR70c1J0jSnjaGYMmqhf1uY9unTZdrkch1CfxejqNrP4HRrULm8irLHmd0TyL6DYr2Pn3h/j+6d5cQ3Xj8N+PpEDcXHmmw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787135190; c=relaxed/simple; bh=8ipBImVTlJ6vU/6eNA40f7evfLBPURR98t2xMgnWpew=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QVmXezvLCbEqGCtU/G66n3v2Ia49yBv0TmZ2xhYkdGEeC3qXkKCNSKHBoNUgsAvbhGVmyBQZlp7pye6bXaiTP4G2Vd7G89D3GTM84W8YBjTYZacIObD7FjQg7uSQMjBDCWmb9YA07NjFAZl0mp5q5hLTgqREIbZGdJdUu4Apb+g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=eswincomputing.com; spf=pass smtp.mailfrom=eswincomputing.com; arc=none smtp.client-ip=52.237.72.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=eswincomputing.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=eswincomputing.com Received: from E0002472LT.eswin.cn (unknown [10.12.96.78]) by app2 (Coremail) with SMTP id TQJkCgA3S57IhIVqxjJMAA--.30064S4; Wed, 19 Aug 2026 18:26:18 +0800 (CST) From: Xiaofeng Yuan To: linux-kernel@vger.kernel.org Subject: [PATCH 2/2] riscv: kprobes: add nop and c.nop to the KUnit test Date: Wed, 19 Aug 2026 18:26:16 +0800 Message-Id: <20260819102616.1553-3-yuanxiaofeng@eswincomputing.com> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20260819102616.1553-1-yuanxiaofeng@eswincomputing.com> References: <20260819102616.1553-1-yuanxiaofeng@eswincomputing.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:TQJkCgA3S57IhIVqxjJMAA--.30064S4 X-Coremail-Antispam: 1UD129KBjvJXoW7Zr48tr4DXw13tr4DZFy7KFg_yoW8uw1kpF nrJw15KF4kGasIvryUWr18AryFyw4kA3y3Ww1Dur4FkFW8G3W3try2gFWUtrsrKrWFv3yS 934rWry8KF9FyFDanT9S1TB71UUUUUDqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBKb7Iv0xC_Cr1lb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI 8067AKxVWUXwA2048vs2IY020Ec7CjxVAFwI0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kE wVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x 0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF 7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F4 0Ex7xfMcIj6xIIjxv20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC 6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lc7CjxVAaw2AFwI0_JF0_Jw1lc2xSY4AK6s vPMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_ Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUJVWUXwCIc40Y0x 0EwIxGrwCI42IY6xIIjxv20xvE14v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8 JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIx AIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7IU85KsUUUUUU= = X-CM-SenderInfo: h1xd05xldrwv1qj6v25zlqu0xpsx3x1qjou0bp/1tbiAQEEE2qEiSsaSwAAsK Extend the RISC-V kprobes KUnit test with test_kprobes_nop and test_kprobes_c_nop, covering both the 32-bit nop and the compressed c.nop simulation paths. Signed-off-by: Xiaofeng Yuan --- .../kernel/tests/kprobes/test-kprobes-asm.S | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/arch/riscv/kernel/tests/kprobes/test-kprobes-asm.S b/arch/riscv/kernel/tests/kprobes/test-kprobes-asm.S index f16deee9e0..8d8f460cb6 100644 --- a/arch/riscv/kernel/tests/kprobes/test-kprobes-asm.S +++ b/arch/riscv/kernel/tests/kprobes/test-kprobes-asm.S @@ -181,6 +181,29 @@ SYM_FUNC_END(test_kprobes_c_bnez) #endif /* CONFIG_RISCV_ISA_C */ +SYM_FUNC_START(test_kprobes_nop) + .option push + .option norvc +test_kprobes_nop_addr: + nop + .option pop + li a0, KPROBE_TEST_MAGIC_LOWER + li a1, KPROBE_TEST_MAGIC_UPPER + add a0, a0, a1 + ret +SYM_FUNC_END(test_kprobes_nop) + +#ifdef CONFIG_RISCV_ISA_C +SYM_FUNC_START(test_kprobes_c_nop) +test_kprobes_c_nop_addr: + c.nop + li a0, KPROBE_TEST_MAGIC_LOWER + li a1, KPROBE_TEST_MAGIC_UPPER + add a0, a0, a1 + ret +SYM_FUNC_END(test_kprobes_c_nop) +#endif /* CONFIG_RISCV_ISA_C */ + .section .rodata SYM_DATA_START(test_kprobes_addresses) RISCV_PTR test_kprobes_add_addr1 @@ -197,7 +220,9 @@ SYM_DATA_START(test_kprobes_addresses) RISCV_PTR test_kprobes_branch_addr6 RISCV_PTR test_kprobes_branch_addr7 RISCV_PTR test_kprobes_branch_addr8 + RISCV_PTR test_kprobes_nop_addr #ifdef CONFIG_RISCV_ISA_C + RISCV_PTR test_kprobes_c_nop_addr RISCV_PTR test_kprobes_branch_c_j_addr1 RISCV_PTR test_kprobes_branch_c_j_addr2 RISCV_PTR test_kprobes_c_jr_addr1 @@ -220,7 +245,9 @@ SYM_DATA_START(test_kprobes_functions) RISCV_PTR test_kprobes_jalr RISCV_PTR test_kprobes_auipc RISCV_PTR test_kprobes_branch + RISCV_PTR test_kprobes_nop #ifdef CONFIG_RISCV_ISA_C + RISCV_PTR test_kprobes_c_nop RISCV_PTR test_kprobes_c_j RISCV_PTR test_kprobes_c_jr RISCV_PTR test_kprobes_c_jalr -- 2.43.0