From patchwork Tue Aug 22 02:38:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 136483 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b82d:0:b0:3f2:4152:657d with SMTP id z13csp3505513vqi; Tue, 22 Aug 2023 02:27:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFtbHlkjCo25rZZ4LOoCvrB8LVeNbs10pwkI3iTJa1J7LsB9bpJnL2oCfL8z1bkIBDQ9F0x X-Received: by 2002:a05:6402:120a:b0:525:46b7:40f2 with SMTP id c10-20020a056402120a00b0052546b740f2mr6622032edw.21.1692696428349; Tue, 22 Aug 2023 02:27:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692696428; cv=none; d=google.com; s=arc-20160816; b=zwXtNOTNbrkeEvB1Hv7KR/Js/bnJsHvyhq/V1grtUeBXKjV2LpoFgB/vunO+LCYluQ 3Ms0Tumgfr7OD8bFB+SyWHtkXpAHfaIVc+5Bdc+/xUlDDRBPq4NWfO1v0LncWK8u+6mT 4J6F02HOTc0LrGqRbWTnipp610RujZknz7GTnQmTXV8Moth/W9y8NAnj4hOJs7jrLvfp 5G6LOKkYKqGx5KN2TxVWZj3sJga9Rb7bAAkkxLE4ZeUh64K28xW12etV2RajI+UDwX+r Y7DqgdiQFcd6YswPQ8qFrh8rwhCr14ECuT6oCOsMtt2Dz57TZlcf+Yrd4IEdn3plsNyq sTEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id; bh=C3UAsO1nOgFp0Gr0rUB+jZ7XdtNkbVYHElVAvfcP9ek=; fh=0YPng9sAhhVGht5GuLC6X9b/s19iQXlsFdA02gxc2XQ=; b=uPU8pzvu0ZCkQUjXmTcutFeowD2mjy9BSYrFB1SwOo1F87+OYKQog34QzySVB4+vRb kry+FEKWcgAx4EWsODnCvcEcHzI8eAOCRQOOJj9ZMpMmULgpajGLXPC/Sx4QAKCOWa5a BlI6gvpOLOx5Us51LjZbUGAfgQg0C1kvi6geAt/PtGgcDl5i0Ikm+NdB/rUZn1Z3BiBL CwXcugvOrZ4GeLI7eViY2EKlLsB9cVYgFtPdrXEXA+SjVgrKHbcsrDRvW4179KIAxnkJ rFXFczTOPnGHnDKYye1h3X17INDfSotbgwfYi2GSzSC6QbZgbhW6qFpIT6ttW7+CLs9G UhrQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h18-20020a50ed92000000b00523c5ff72a6si7303177edr.70.2023.08.22.02.26.43; Tue, 22 Aug 2023 02:27:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232310AbjHVCis (ORCPT + 99 others); Mon, 21 Aug 2023 22:38:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232271AbjHVCia (ORCPT ); Mon, 21 Aug 2023 22:38:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 931AB189 for ; Mon, 21 Aug 2023 19:38:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 31A8C645A4 for ; Tue, 22 Aug 2023 02:38:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D2DCC433CA; Tue, 22 Aug 2023 02:38:25 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.96) (envelope-from ) id 1qYHI1-001bZm-28; Mon, 21 Aug 2023 22:38:41 -0400 Message-ID: <20230822023841.473446159@goodmis.org> User-Agent: quilt/0.66 Date: Mon, 21 Aug 2023 22:38:05 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Andrew Morton , , , Zheng Yejian Subject: [for-linus][PATCH 2/8] selftests/ftrace: Add a basic testcase for snapshot References: <20230822023803.605698724@goodmis.org> MIME-Version: 1.0 X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774920850192348735 X-GMAIL-MSGID: 1774920850192348735 From: Zheng Yejian This testcase is constrived to reproduce a problem that the cpu buffers become unavailable which is due to 'record_disabled' of array_buffer and max_buffer being messed up. Local test result after bugfix: # ./ftracetest test.d/00basic/snapshot1.tc === Ftrace unit tests === [1] Snapshot and tracing_cpumask [PASS] [2] (instance) Snapshot and tracing_cpumask [PASS] # of passed: 2 # of failed: 0 # of unresolved: 0 # of untested: 0 # of unsupported: 0 # of xfailed: 0 # of undefined(test bug): 0 Link: https://lkml.kernel.org/r/20230805033816.3284594-3-zhengyejian1@huawei.com Cc: Cc: Cc: Signed-off-by: Zheng Yejian Signed-off-by: Steven Rostedt (Google) --- .../ftrace/test.d/00basic/snapshot1.tc | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/00basic/snapshot1.tc diff --git a/tools/testing/selftests/ftrace/test.d/00basic/snapshot1.tc b/tools/testing/selftests/ftrace/test.d/00basic/snapshot1.tc new file mode 100644 index 000000000000..63b76cf2a360 --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/00basic/snapshot1.tc @@ -0,0 +1,31 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Snapshot and tracing_cpumask +# requires: trace_marker tracing_cpumask snapshot +# flags: instance + +# This testcase is constrived to reproduce a problem that the cpu buffers +# become unavailable which is due to 'record_disabled' of array_buffer and +# max_buffer being messed up. + +# Store origin cpumask +ORIG_CPUMASK=`cat tracing_cpumask` + +# Stop tracing all cpu +echo 0 > tracing_cpumask + +# Take a snapshot of the main buffer +echo 1 > snapshot + +# Restore origin cpumask, note that there should be some cpus being traced +echo ${ORIG_CPUMASK} > tracing_cpumask + +# Set tracing on +echo 1 > tracing_on + +# Write a log into buffer +echo "test input 1" > trace_marker + +# Ensure the log writed so that cpu buffers are still available +grep -q "test input 1" trace +exit 0