From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-119.freemail.mail.aliyun.com (out30-119.freemail.mail.aliyun.com [115.124.30.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD04F3C345A for ; Thu, 9 Apr 2026 11:48:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.119 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775735332; cv=none; b=b2HYTZcLeuxFo+s1yFLWAJePvJeRxp+XXXfK3csbJ3JJS7SQN2x3Jwe9pToNM6DpkMysHzLmMXhTSMOGCAD/aJhhTbGKuR9tI9b9hHGjA+qxqkUho/QL+6Dtb50EpuOZRZF5iEOkBbbm+fbHIBY/bUsxOQ4RwXxxvPNB7yZa6Aw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775735332; c=relaxed/simple; bh=ISe7Gq2aanpqboGkCJn1ZGiXODZHSfZszx+GOpHemWc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=uSaIlHAeXcMu8tO9V98j8Zl108peSiURt6KXoPne67lhanrm4BDQRzCzi6Kgk6JneYrEj1JjO9s4Spg0DBJGftYXycPSl/u1jkxTpWSpHFbapZbUgAhiuq5uAjNAeI8lQlriUXJPZeXK4UV4Um/pssPNe+7UYfh92LTDyzIYTXs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=LEcCM9Lt; arc=none smtp.client-ip=115.124.30.119 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="LEcCM9Lt" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1775735316; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=aceztPpkMsU/CLciUL34G4AZrFbaV1ONeA90OERMBkA=; b=LEcCM9LtQFcob/JAZI0V7w69/1UrosSfJxUYsKQAOBF/17uq0WOq/dX/BXMvGis4lV5E82ThpvV7gGeNxvwntdrSod67bJRTcsfm76z8HEQ9a2yA4wRRjaGyTuWOtBaHmwEXOEvT5eyjTTjMqaHTwdCDHsV23jmS7OANZnZYVcM= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037033178;MF=cp0613@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0X0iIf1A_1775735311; Received: from DESKTOP-S9E58SO.localdomain(mailfrom:cp0613@linux.alibaba.com fp:SMTPD_---0X0iIf1A_1775735311 cluster:ay36) by smtp.aliyun-inc.com; Thu, 09 Apr 2026 19:48:35 +0800 From: cp0613@linux.alibaba.com To: pjw@kernel.org, alex@ghiti.fr, andybnac@gmail.com, guoren@kernel.org Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Chen Pei Subject: [PATCH] riscv: ftrace: select HAVE_BUILDTIME_MCOUNT_SORT Date: Thu, 9 Apr 2026 19:47:36 +0800 Message-ID: <20260409114736.907-1-cp0613@linux.alibaba.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Chen Pei RISC-V already satisfies all prerequisites for build-time mcount sorting: the sorttable host tool handles EM_RISCV in its machine-type dispatch, and the __mcount_loc section entries are stored as direct virtual addresses in the final vmlinux binary, so no relocation processing is required during the sort step. Select HAVE_BUILDTIME_MCOUNT_SORT so that BUILDTIME_MCOUNT_SORT is automatically enabled when DYNAMIC_FTRACE is configured. This allows sorttable to sort the __mcount_loc section at link time, making the run-time ftrace initialisation path skip the software sort and reducing kernel startup overhead. Verified with CONFIG_FTRACE_SORT_STARTUP_TEST=y, which confirms that the section produced by the build is already in ascending order: [ 0.000000] ftrace section at ffffffff81015a60 sorted properly Signed-off-by: Chen Pei --- arch/riscv/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 90c531e6abf5..6fe90591a274 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -151,6 +151,7 @@ config RISCV select HAVE_ARCH_USERFAULTFD_WP if 64BIT && MMU && USERFAULTFD && RISCV_ISA_SVRSW60T59B select HAVE_ARCH_VMAP_STACK if MMU && 64BIT select HAVE_ASM_MODVERSIONS + select HAVE_BUILDTIME_MCOUNT_SORT select HAVE_CONTEXT_TRACKING_USER select HAVE_DEBUG_KMEMLEAK select HAVE_DMA_CONTIGUOUS if MMU -- 2.50.1