Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4506160rdb; Tue, 12 Dec 2023 01:04:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IGJX/7S2psFJl5utg4I5bo4J0uTjwJpzW8dvzKLQF5KxtAzsqqHf7q/nzG7iOl9Aqi7fUO7 X-Received: by 2002:a05:6e02:1a06:b0:35d:59a2:2a2 with SMTP id s6-20020a056e021a0600b0035d59a202a2mr9582015ild.66.1702371855969; Tue, 12 Dec 2023 01:04:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702371855; cv=none; d=google.com; s=arc-20160816; b=lGC+NvLN2Bzzo7vpPEXFHrz+FU7sZ77Oq95AHSto7RWTByWboXoeHMNIwbvc+DSB+Y xew2OKzeK6fFKjeuWhU0SOHUD/iQFRV5UG8moE7ufKw3tOyqUNi0D5tHXzlnGa7Z8CuK xJtUZ/ZbxrBkIZpArvj3adBDmEooR2O5VGozLzYlbqX7t3XSTzwJEMRIf36w0h/q/8xW dfgpj4dAsx833FR0IuMJmnUIr6MOWPszj8AHGZqCOQq73CYgvFnPFqPEF9JmpeOrXNTR l1UtVphMSZTPZhDwHttc1YhhtO0CVjM6SyKDdElCwSDvBE1NNwecW6U++OeTIgh4iSEZ jvaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=LE4waoH0JtiALvidjAUKTn4l4IraB0hfJEIPrBku60Q=; fh=GT3Qs0ibQQgQy4eWwAxW+XRkMOOzkTRdhGQ3zYtEOCU=; b=l7G7wNthxg+nwj5ZIlm7oETnonBTisQ5I5UGF7HpczgJm/sAQ7GdlOQR/AnlhS4PTW RaNAIGFQq0HSSIOGDcdO/3VOoXjzl/QIAAnoBAK4XlMBxCM/J3UN0z5S6BCty5mv1m9B AM91ZSDDq3aD5fxXg12nIogU8kmN2W4VO5QflSbDc8BDlWqu1UzB7zvLBaHQ+FoLY10q opZBqqJjeGH1OdqXFGJd5rLwqENKRMkDwOyutW552fJlMhaM/ZwcIouhZE8+17Dkchkc KYiqICPG+b2UesoaKPlOlRICF8pjDnIr7+uZST9jB6yp0KNrSxlnlov0m5x3RemDW1YP aUxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lDHj8OvO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id 14-20020a63104e000000b005c7024c429esi5579427pgq.488.2023.12.12.01.04.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 01:04:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lDHj8OvO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id A9FB680B2D5D; Tue, 12 Dec 2023 01:04:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231193AbjLLJD5 (ORCPT + 99 others); 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: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 12 Dec 2023 01:04:12 -0800 (PST) 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_hotplug.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=`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 -- 2.43.0