Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2383391lqp; Sun, 24 Mar 2024 17:01:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWDmUTOJMWprYupBLmzSnwxdgx9HdlrW6M3uC5k29h8YJnSp1gY10zaGN7dbpBFktjMg2PEm7Rd5rO+u+JT+NFraQ+//t+jNVuO4Y3wXg== X-Google-Smtp-Source: AGHT+IG+77M0hIbaoD93JsjLfPYaDA+XouyTeQvDwboQVlpwPn2vq0KoZTDxk2gja49J2HDvrHB/ X-Received: by 2002:a17:903:2cb:b0:1dd:1c6f:af51 with SMTP id s11-20020a17090302cb00b001dd1c6faf51mr7122771plk.16.1711324891601; Sun, 24 Mar 2024 17:01:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711324891; cv=pass; d=google.com; s=arc-20160816; b=HCPaTUY9RbL5pzq/IZz006mWLR2VahnCZdQJUO+lRsDCRIxZj+wUSSVPu9kO2036Ec dMBuEksQhbrFBDU3rtlKp1B51R9sCIBeU3CQe6txSGBHU/IGf5UF2bnD69WMQLsbwYRB nDl3MzyY4ZhnFwoyl+5ExtfrVSB4dAhBmRqiQ4Dqon1FHTBIoSqIO6pIfH0zuA6jAEpg 0YiCF5/yffUK/4NcZ7Mlna2qtT1aHhA64oZt0wpugbbHElTnuOEh5sCADbmpx4TndsEP SoSS+oAbCYjqRVG+MNYKx/NyyqcHzbEGFqywEa0zMx8iYuxKzacZLozqWvZImxUlA+fI f7og== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=W3PkYi6nYogpKKCkwcVE0+gEHEzFcjJX5GX45aN1uXw=; fh=j3VVVxKI7R58MooQaNg1l9nm3oQYgj2FRPC0FAu9kqc=; b=QL2MWiB6PzMMlV29cncH3OhOb3ss8QV9e9R6VDnoJ9OVefRQnsPZalZ7/Va2REK1lh 7ZB7JPLKioENwNEYHcUxF4JBEjxoNJz/3Fs2F1NgZz2JCllpWr4PMb5P80sOAtIkSX7z 8q5d8oxQDLV/Z6VnxQb8bD0/3IpgJOWZcJW60Q61w6TT7Ti2Mvxq8KQg6acTAm1N+pz6 wabhsiYC77f5n7g0/Aptpciy2jIXKPKT2rCILh2xf4C6HaymH9KXtdXlu45/0vezDSUL 5ujwnz4W9RdutxDIaZjwzV18rNA4E4+lZ1AGps6fV2wykhrECltOPVncnJXiLdzpxMB/ EwMA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CjDTLIK5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113267-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113267-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id f17-20020a170902ce9100b001d93f31a19bsi2063671plg.345.2024.03.24.17.01.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 17:01:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113267-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CjDTLIK5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113267-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113267-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id EB687285661 for ; Sun, 24 Mar 2024 23:57:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B8EF6136E2C; Sun, 24 Mar 2024 22:41:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CjDTLIK5" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D6868136E0D; Sun, 24 Mar 2024 22:41:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320066; cv=none; b=ZyMrxIb1aGvPL4cJJFM+eqwCSYD8CaFFkp486AxeXH5BBtMZqnwD+DtGztKhxwXZNZcjDkmWHnMfYaJX/bJuC8HBhXJm0zt8QhqDfuWe4fOdoXngrwSyTzCJ0yVVM7nBmVlz+2nGKoWhF9sr/Y1uDA1AY/3lrAEP0dww4VL4QMg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320066; c=relaxed/simple; bh=SfnGMASuO5Dvr2j3Q1CmvC8pIQdpk9kbiq/gwKfVvQs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ra+bZlXuINeOXNC4KcHr86xSwOGlxDP52s2RQJ2x2FmVIlHwYm3LKTqYZBIMjr9MPCkVJGzSayNt/Kndx1jK+Co4zT0BPS37HNv2qMKgIRMv7tjuMTWXXm9EaaDMYv21lIY4wYHQG9Gv6J6yPD3zzrk1HJHhJ2DLseqbkNCuXuk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CjDTLIK5; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3EC0C43390; Sun, 24 Mar 2024 22:41:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320066; bh=SfnGMASuO5Dvr2j3Q1CmvC8pIQdpk9kbiq/gwKfVvQs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CjDTLIK5feKATZ0DQkkYf+9TFwG5VONRq4pGMsyNGntwaxA3Y3cb7CjYA+wU5yafC tY/hNtPFMEqN7ZAXKrD7J/EnYKDhO2EuF9QDrAq2+sl2y8vujBKgSBV41QOq639Tez rOdiZ23XLUgRFGYJu06HrCqKYt9jhh0WUf7OaFmkMXxbGzLbxvn9MucR0AW/aKv0IU 7vxyif3nhmOzAkXqBAv+25fej0X2qqZtrjxfw+MgEZBxf5TdSzn5fRVJkUIMF3oaUP UEfBIT+YtbImutFBMyiHXS8GwEnjpYnyk8gQOMyRKbBM1MSikZQ7RS3FAzL2Gc9N9k YinPx/Txzfz9w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yang Jihong , Namhyung Kim , Sasha Levin Subject: [PATCH 6.8 376/715] perf record: Check conflict between '--timestamp-filename' option and pipe mode before recording Date: Sun, 24 Mar 2024 18:29:15 -0400 Message-ID: <20240324223455.1342824-377-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Yang Jihong [ Upstream commit 02f9b50e04812782fd006ed21c6da1c5e3e373da ] In pipe mode, no need to switch perf data output, therefore, '--timestamp-filename' option should not take effect. Check the conflict before recording and output WARNING. In this case, the check pipe mode in perf_data__switch() can be removed. Before: # perf record --timestamp-filename -o- perf test -w noploop | perf report -i- --percent-limit=1 # To display the perf.data header info, please use --header/--header-only options. # [ perf record: Woken up 1 times to write data ] [ perf record: Dump -.2024011812110182 ] # # Total Lost Samples: 0 # # Samples: 4K of event 'cycles:P' # Event count (approx.): 2176784359 # # Overhead Command Shared Object Symbol # ........ ....... .................... ...................................... # 97.83% perf perf [.] noploop # # (Tip: Print event counts in CSV format with: perf stat -x,) # After: # perf record --timestamp-filename -o- perf test -w noploop | perf report -i- --percent-limit=1 WARNING: --timestamp-filename option is not available in pipe mode. # To display the perf.data header info, please use --header/--header-only options. # [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.000 MB - ] # # Total Lost Samples: 0 # # Samples: 4K of event 'cycles:P' # Event count (approx.): 2185575421 # # Overhead Command Shared Object Symbol # ........ ....... ..................... ............................................. # 97.75% perf perf [.] noploop # # (Tip: Profiling branch (mis)predictions with: perf record -b / perf report) # Fixes: ecfd7a9c044e ("perf record: Add '--timestamp-filename' option to append timestamp to output file name") Signed-off-by: Yang Jihong Acked-by: Namhyung Kim Link: https://lore.kernel.org/r/20240119040304.3708522-3-yangjihong1@huawei.com Signed-off-by: Namhyung Kim Signed-off-by: Sasha Levin --- tools/perf/builtin-record.c | 5 +++++ tools/perf/util/data.c | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index a8dfa533c1663..3ddd4381aebd2 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -2472,6 +2472,11 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) if (data->is_pipe && rec->evlist->core.nr_entries == 1) rec->opts.sample_id = true; + if (rec->timestamp_filename && perf_data__is_pipe(data)) { + rec->timestamp_filename = false; + pr_warning("WARNING: --timestamp-filename option is not available in pipe mode.\n"); + } + evlist__uniquify_name(rec->evlist); /* Debug message used by test scripts */ diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c index c29d8a382b196..550675ce0b787 100644 --- a/tools/perf/util/data.c +++ b/tools/perf/util/data.c @@ -430,8 +430,6 @@ int perf_data__switch(struct perf_data *data, { int ret; - if (check_pipe(data)) - return -EINVAL; if (perf_data__is_read(data)) return -EINVAL; -- 2.43.0