Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5298670rdb; Wed, 13 Dec 2023 05:05:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IESOFm1Z3Dl7+3hMycHYjmfpjBCtVIrr8+H/2o/BZn9M3oSFsJhxEknN3FE+p436Ox/0/z7 X-Received: by 2002:a17:90a:7d0c:b0:286:e5c7:c210 with SMTP id g12-20020a17090a7d0c00b00286e5c7c210mr3721136pjl.10.1702472719331; Wed, 13 Dec 2023 05:05:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702472719; cv=none; d=google.com; s=arc-20160816; b=JLV4+j9Dar53HCm51xefwxWqwjyqpdfodP1aufjtED92n4y8PcfdOdh80NvAcb8OjZ W12LIVQV9Gp97ituaqpzmQl/llq0nKa9T8bh9AwnjjNm6+Cibl9aJi8k87QByM3UrA4Q XimZsppV3owg0CwGH9ty2picCbhyILMUUW4jpCDbar3tJz98oFKugTusrKtzA+02wRxr 4EYP3Ugcc3KDWzVpt140Ved0ML2wDZaHNwV1/ubSwnq3E/ZZwg6kGJiIIoFcLz/JGXWT 3RymiIYoXHBSrd0rersZe+wduLGvAyCW5ku7ohvRChq/hybodP7fm8Hq3g5KlCfCUfCQ mYYg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=+6LWqOXMDtEYPL5T9bm5QpD5pYhgSW9QWdLlLIRC6yo=; fh=egPY+NW2iGsDWzZwMaWh2aZv2fzK/f3Nf0KWzXb9fSU=; b=huysP4lxZh5d1H5KmT8QxNTOT3zwVVLKF65ZH618ACt+gj/6qS2xXQY1HxnIBQp061 e8YpRxXnS2WlxOoeUFPQHJZO5uzA62SD0mpECfBZaAIamQ9EOZJ0nn2go0+kKOcGjlF7 HGtUwfyBLlUPaeg/K9QvlD0d3VE8ibh9BkozxMtfAN8TD3H31VEGibW533hYEnkWNWVI aO+nLxVFO1E4Msk8KrOFq2D8vF4o1LAr2Ok9LrL5vbxr2MGV2W6oVcpJDRYjTZlpg7yU e4KTdVAnC5pkwkswgPLPp/Bpt5NnkLn5YEvqrLnO+PzojmU8M02EKRAhnEbl2VVrNrcm kBcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TPj3sNYb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id co7-20020a17090afe8700b0028ab57a7191si3277859pjb.65.2023.12.13.05.05.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 05:05:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TPj3sNYb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 6D97B80B31C7; Wed, 13 Dec 2023 05:05:03 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379123AbjLMNEu (ORCPT + 99 others); Wed, 13 Dec 2023 08:04:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379206AbjLMNEn (ORCPT ); Wed, 13 Dec 2023 08:04:43 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCAC9121 for ; Wed, 13 Dec 2023 04:54:54 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1C24C433C7; Wed, 13 Dec 2023 12:54:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702472094; bh=gBG7q7d6yeZOd/c1kwWuK1qPKa2vW1p2OK1rECWWvTI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=TPj3sNYbXok2E+B31zh2s3H/L6aacMNCDhzhZ71Mv0L0tL9xoHx0BF8RiDWrUDX03 hlY8FULjAeL+T2oGzyMKlDT4jev8KnS9u6o7reCF2OrDJ43yCpPhC7AafRLQPKDCyD 6MV6gOMSt+rrcsaLqALumG+QCDlD5QzvmVpCPS4yXxSfg9PAdCwq/HPtjgrUHO24ya NQ48QfEcUntf7KUcpAlpQauJ8OSmkD0AjD8iv8RR6jw9DQV6sXgIfIXVOhSEQuHkTr exSG4xLITkcmc3yddRyStj0rvF/Z2uD+l957iveD/Y1P9leZv0ZKvmfUHGtiP/8SV9 flZoF06HLS96A== Date: Wed, 13 Dec 2023 21:54:50 +0900 From: Masami Hiramatsu (Google) To: Naveen N Rao Cc: , , Steven Rostedt , Masami Hiramatsu , Shuah Khan , Michael Ellerman Subject: Re: [PATCH v2] selftests/ftrace: Add test to exercize function tracer across cpu hotplug Message-Id: <20231213215450.792f5e6f21eb3e709f4ea05c@kernel.org> In-Reply-To: <20231213113802.1278600-1-naveen@kernel.org> References: <20231213113802.1278600-1-naveen@kernel.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, 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 agentk.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 (agentk.vger.email [0.0.0.0]); Wed, 13 Dec 2023 05:05:03 -0800 (PST) On Wed, 13 Dec 2023 17:08:02 +0530 Naveen N Rao wrote: > 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"). > Looks good to me. Acked-by: Masami Hiramatsu (Google) Thank you, > Signed-off-by: Naveen N Rao > --- > v2: Add a check for next available online cpu, as suggested by Masami. > > .../ftrace/test.d/ftrace/func_hotplug.tc | 42 +++++++++++++++++++ > 1 file changed, 42 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..ccfbfde3d942 > --- /dev/null > +++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_hotplug.tc > @@ -0,0 +1,42 @@ > +#!/bin/sh > +# SPDX-License-Identifier: GPL-2.0-or-later > +# 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 cannot test cpu hotplug in UP environment" > + exit_unresolved > +fi > + > +# Find online cpu > +for i in /sys/devices/system/cpu/cpu[1-9]*; do > + if [ -f $i/online ] && [ "$(cat $i/online)" = "1" ]; then > + cpu=$i > + break > + fi > +done > + > +if [ -z "$cpu" ]; then > + echo "We cannot test cpu hotplug with a single cpu online" > + exit_unresolved > +fi > + > +echo 0 > tracing_on > +echo > trace > + > +: "Set $(basename $cpu) offline/online with function tracer enabled" > +echo function > current_tracer > +echo 1 > tracing_on > +(echo 0 > $cpu/online) > +(echo "forked"; sleep 1) > +(echo 1 > $cpu/online) > +echo 0 > tracing_on > +echo nop > current_tracer > > base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86 > -- > 2.43.0 > -- Masami Hiramatsu (Google)