From nobody Sat Feb 7 17:54:01 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4489C4332F for ; Tue, 12 Dec 2023 09:04:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231297AbjLLJD5 (ORCPT ); Tue, 12 Dec 2023 04:03:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbjLLJD4 (ORCPT ); Tue, 12 Dec 2023 04:03:56 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E167C7 for ; Tue, 12 Dec 2023 01:04:02 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 647BEC433C9; Tue, 12 Dec 2023 09:04:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702371842; bh=gpWxqrQqtPBdeOZQDVvCLZQiG6hUIYYXSz5LWak22Mc=; h=From:To:Cc:Subject:Date:From; b=lDHj8OvOCxDjQ3VWmnU9FUBbW2KpaOgm5edsWgEbA/U2BV//dLI9wch27rQ+ZAjaT JJoELrQvE1VZkWAdCgqr07fLM04izHCjldTPmuoWoke1JiZYefkTvkb1OIG8EExrXV uw9FT4JYykeuZcZ6HS+QOCgSruWTbFSRit1/1bN+a5EqlxaH49P4BX1EQT+/tYl7Qs 5rogMk424jJBZyh6b603CztXPjHfU8KBppPAV1OgschXpKg912g7bp+OzUNq5sODqh GuTErg4iG2JeCdJ6bv2VnMUidiu+g90G/iOXxtELqtjLPVoB8aAs1dO7dIXp9YSK7o GtRflju1Eq1JQ== From: Naveen N Rao To: , Cc: Steven Rostedt , Masami Hiramatsu , Shuah Khan , Michael Ellerman Subject: [PATCH] selftests/ftrace: Add test to exercize function tracer across cpu hotplug Date: Tue, 12 Dec 2023 14:26:07 +0530 Message-ID: <20231212085607.1213210-1-naveen@kernel.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add a test to exercize cpu hotplug with the function tracer active to ensure that sensitive functions in idle path are excluded from being traced. This helps catch issues such as the one fixed by commit 4b3338aaa74d ("powerpc/ftrace: Fix stack teardown in ftrace_no_trace"). Signed-off-by: Naveen N Rao --- .../ftrace/test.d/ftrace/func_hotplug.tc | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/ftrace/func_hotpl= ug.tc diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func_hotplug.tc b= /tools/testing/selftests/ftrace/test.d/ftrace/func_hotplug.tc new file mode 100644 index 000000000000..49731a2b5c23 --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_hotplug.tc @@ -0,0 +1,30 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: ftrace - function trace across cpu hotplug +# requires: function:tracer + +if ! which nproc ; then + nproc() { + ls -d /sys/devices/system/cpu/cpu[0-9]* | wc -l + } +fi + +NP=3D`nproc` + +if [ $NP -eq 1 ] ;then + echo "We can not test cpu hotplug in UP environment" + exit_unresolved +fi + +echo 0 > tracing_on +echo > trace +: "Set CPU1 offline/online with function tracer enabled" +echo function > current_tracer +echo 1 > tracing_on +(echo 0 > /sys/devices/system/cpu/cpu1/online) +(echo "forked"; sleep 1) +(echo 1 > /sys/devices/system/cpu/cpu1/online) +echo 0 > tracing_on + +: "Check CPU1 events are recorded" +grep -q -e "\[001\]" trace base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86 --=20 2.43.0