From patchwork Thu Nov 30 12:15:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= X-Patchwork-Id: 13474298 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF1FDC10DC1 for ; Thu, 30 Nov 2023 12:16:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=PitIxfDpGL8Ai9Rb1YbEsDLqpq67qxmEzykUdwt9UlQ=; b=Q1EtrKDJ3R/gLg v2T44c4v/Cj1pYEfs1zEpLMkwMgy8HTVHo/OnnN30m0SoJSiQBzpOGiHDkiTIyWZc0QmbDo/neVgg QeCgu3WR3lQRz+Vx2R5WdwTqZvj0kJ7vk5czbbncU9KftPW3Dor6s9DL1ok5O3eF/tyEiR+TxchRs po2w0NRJpwz+KoPnl+/rycaLkcqfqS8Q6t0/7WOFJRGOiD0qTJRZg5uaY6RvA23G+leprSK7yGOm7 Or3J4MxiuMvI2HD8SmkmLTAS1gKVMIneXLEUQZJgtzkAX+QGhfZPg3mjeSOJHiAFO3AySm4na2BUT zfqk0axdoycibHAM0ung==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r8fxN-00Aobl-2P; Thu, 30 Nov 2023 12:15:49 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r8fxJ-00AoaB-2w for linux-riscv@lists.infradead.org; Thu, 30 Nov 2023 12:15:48 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id EB67A618CF; Thu, 30 Nov 2023 12:15:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0995C433C7; Thu, 30 Nov 2023 12:15:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701346544; bh=1NPXRHfCmv3muigvSa8lBUFSABkyhpUQba/UEEWr/rM=; h=From:To:Cc:Subject:Date:From; b=UraiEC+0QfcuybZdyWf77r8dRXNuwqKPlsmovyA/HvHKNSE2PDXUCtfDBU8T68jqW zxEKr4hNGcnDOaPXu4C4xhfi7mP5vO+f09oHk4/lej/LLoB6WRdZw3jZvmrbiyF3u1 And2p+iR8RhiMbB1QbhwONyweWsjl/QRfK+uA51E2i/GyaDi7anOFcRdyHT2Z8sjmi mpGED66jC56FrIQO0aSqBzezxrvITqL5riM9hDjkARae3MWYZ1iS6j4z0sV2PqwXB9 ZvT5apIey29b7b8eA04UgAvV/wEH2ePnTo8UCSwxB0gq54z3vMhY3a58/T9VyzcKaO F9zd6U4HJufEw== From: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= To: Steven Rostedt , Masami Hiramatsu , Mark Rutland , Paul Walmsley , Palmer Dabbelt , Albert Ou , Song Shuai , Guo Ren , linux-riscv@lists.infradead.org Cc: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, songshuaishuai@tinylab.org Subject: [PATCH v12 for-next 0/4] riscv: ftrace: Miscellaneous ftrace improvements Date: Thu, 30 Nov 2023 13:15:27 +0100 Message-Id: <20231130121531.1178502-1-bjorn@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231130_041546_030559_4FE5D9F5 X-CRM114-Status: GOOD ( 13.57 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Björn Töpel NB! Song told me that he would not have the time work on this series, so I picked it up. This series includes a three ftrace improvements for RISC-V: 1. Do not require to run recordmcount at build time (patch 1) 2. Simplification of the function graph functionality (patch 2) 3. Enable DYNAMIC_FTRACE_WITH_DIRECT_CALLS (patch 3 and 4) The series has been tested on Qemu/rv64 virt/Debian sid with the following test configs: CONFIG_FTRACE_SELFTEST=y CONFIG_FTRACE_STARTUP_TEST=y CONFIG_SAMPLE_FTRACE_DIRECT=m CONFIG_SAMPLE_FTRACE_DIRECT_MULTI=m CONFIG_SAMPLE_FTRACE_OPS=m All tests pass. Cheers, Björn Changes in v12: - Massaged the commit messages a bit. - Squashed the samples patches, so that the rv32 support is included from the start. - Minor whitespace changes in the mcount-dyn.S. - Minor style changes. Changes in v11: https://lore.kernel.org/linux-riscv/20230627111612.761164-1-suagrfillet@gmail.com/ - append a patch that makes the DIRECT_CALL samples support RV32I in this series fixing the rv32 build failure reported by Palmer - validated with ftrace boottime selftest and manual sample modules test in qemu-system for RV32I and RV64I Changes in v10: https://lore.kernel.org/all/20230511093234.3123181-1-suagrfillet@gmail.com/ - add Acked-by from Björn Töpel in patch 2 and patch 4 - replace `move` with `mv` in patch3 - prettify patch 2/4 with proper tabs Changes in v9: https://lore.kernel.org/linux-riscv/20230510101857.2953955-1-suagrfillet@gmail.com/ 1. add Acked-by from Björn Töpel in patch 1 2. rebase patch2/patch3 on Linux v6.4-rc1 - patch 2: to make the `SAVE_ABI_REGS` configurable, revert the modification of mcount-dyn.S from commit (45b32b946a97 "riscv: entry: Consolidate general regs saving/restoring") - patch 3: to pass the trace_selftest, add the implement of `ftrace_stub_direct_tramp` from commit (fee86a4ed536 "ftrace: selftest: remove broken trace_direct_tramp") ; and fixup the context conflict in Kconfig Changes in v8: https://lore.kernel.org/linux-riscv/20230324033342.3177979-1-suagrfillet@gmail.com/ - Fix incorrect address values in the 4nd patch - Rebased on v6.3-rc2 Changes in v7: https://lore.kernel.org/linux-riscv/20230112090603.1295340-1-guoren@kernel.org/ - Fixup RESTORE_ABI_REGS by remove PT_T0(sp) overwrite. - Add FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY [1] - Fixup kconfig with HAVE_SAMPLE_FTRACE_DIRECT & HAVE_SAMPLE_FTRACE_DIRECT_MULTI Changes in v6: https://lore.kernel.org/linux-riscv/20230107133549.4192639-1-guoren@kernel.org/ - Replace 8 with MCOUNT_INSN_SIZE - Replace "REG_L a1, PT_RA(sp)" with "mv a1, ra" - Add Evgenii Shatokhin comment Changes in v5: https://lore.kernel.org/linux-riscv/20221208091244.203407-1-guoren@kernel.org/ - Sort Kconfig entries in alphabetical order. Changes in v4: https://lore.kernel.org/linux-riscv/20221129033230.255947-1-guoren@kernel.org/ - Include [3] for maintenance. [Song Shuai] Changes in V3: https://lore.kernel.org/linux-riscv/20221123153950.2911981-1-guoren@kernel.org/ - Include [2] for maintenance. [Song Shuai] [1]: https://lore.kernel.org/linux-riscv/CAAYs2=j3Eak9vU6xbAw0zPuoh00rh8v5C2U3fePkokZFibWs2g@mail.gmail.com/T/#t [2]: https://lore.kernel.org/lkml/20221120084230.910152-1-suagrfillet@gmail.com/ [3]: https://lore.kernel.org/linux-riscv/20221123142025.1504030-1-suagrfillet@gmail.com/ Song Shuai (4): riscv: select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY riscv: ftrace: Make function graph use ftrace directly riscv: ftrace: Add DYNAMIC_FTRACE_WITH_DIRECT_CALLS support samples: ftrace: Add RISC-V support for SAMPLE_FTRACE_DIRECT[_MULTI] arch/riscv/Kconfig | 4 + arch/riscv/include/asm/ftrace.h | 18 +- arch/riscv/kernel/ftrace.c | 30 ++- arch/riscv/kernel/mcount-dyn.S | 198 ++++++++++++++++---- samples/ftrace/ftrace-direct-modify.c | 35 ++++ samples/ftrace/ftrace-direct-multi-modify.c | 41 ++++ samples/ftrace/ftrace-direct-multi.c | 25 +++ samples/ftrace/ftrace-direct-too.c | 28 +++ samples/ftrace/ftrace-direct.c | 24 +++ 9 files changed, 348 insertions(+), 55 deletions(-) base-commit: 3ca112b71f35dd5d99fc4571a56b5fc6f0c15814