Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2548370lqp; Mon, 25 Mar 2024 02:07:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXBHzCk3AAxiSKnqsg3MEdKnEMwQRqmM3bifz1lRvSLCHzV8NWypDNnCNeYuyCafV7Gc5sin2fXLadeCDeKYvClWyAnXVCcrs9a3oVZwA== X-Google-Smtp-Source: AGHT+IGRGCgIQscwnnNEfPL6jO9rOfaIHOkme1T5mqY4Q6yugYGPIQih5gKX54YB/J9FytnCmf0J X-Received: by 2002:a05:6a20:7501:b0:1a3:5c61:5ec2 with SMTP id r1-20020a056a20750100b001a35c615ec2mr5698737pzd.16.1711357655295; Mon, 25 Mar 2024 02:07:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711357655; cv=pass; d=google.com; s=arc-20160816; b=EsguLMUVTRb3oh79sNY7a9vORZks5X98kf33/NcHHYubOVvSC4qprkYNGBIQ3v4Jl4 mYTr6OrwC4plmUz6O43JG372W3lNW56DX24SvVoeXH4mpmQi2nPtLFeOOvPve7MWIHvo SzJEGmwqt7E/3LJB8NHA+UjNSrRMt/Cw1JCUyQODrQkPXuUr53BRQQ/BPw8LzTEQkhRF NkM28vz5yXCNxi7clsSou+UyLqmzwV/6fYtj0jrryyvqNoxWnbWxBpwmi5iO/PQHlapB /CKt7tL3BSBbb6dHQssJwJO8XsCYNZow2oTggrGJje0CnLVTfpvp5WJCVo+clHjWSm1i cQJg== 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=ie7/enqVSXzfT5lhbImKWnMX++pVkImceg7teeISaYg=; fh=j3VVVxKI7R58MooQaNg1l9nm3oQYgj2FRPC0FAu9kqc=; b=R4l3qSH5KtaWZ6cIkbmllfIIyjlpYDSJ4/ySJ4ncCuGxjHE8om4T40uednQWhahIZp i7DLmurtTCzQmnCLqp/p+H3GPiUNjLR0w/rl+GI6yHfgzAynVRrtP3AF8V9Ig999XKUA f07VJw86ea8Y+O8l37yurjpyBn3iUZCZuK24fe4aAm6r/t2M671/6hAaCMAYabFyDIP9 MZGG9C8SRw5ZnBOV9czwNc3AHG8qtxxmwPqAqJHbcDRAUj1kPIqVKXBRiuAMdwDgaraH JL5I1DT5pOJ+MQiNun55bbQiDIscl1n213QcZsXp+l9XT13ZL2ZCumNRmh7tX50CK1A3 66sQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=t4Ea0iFu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115690-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115690-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 7-20020a630a07000000b005dc7e779b7dsi6995408pgk.73.2024.03.25.02.07.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 02:07:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115690-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=t4Ea0iFu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115690-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115690-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 F195E29BD02 for ; Mon, 25 Mar 2024 09:07:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0901C35ADD6; Mon, 25 Mar 2024 02:53:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="t4Ea0iFu" 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 031341EC4A5; Sun, 24 Mar 2024 23:07:17 +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=1711321637; cv=none; b=jqlpHjGMzaLFSoeHZAhNUrgJU9nDbOhyvhh0oQX3Dbvydh7Pwkqb4S3DFhmiyZC7YOR7vCX21bhlfWUNp4THTgpXLs4U/xctdriDp+wvYPxGkm/jLN8ax/4Uy1F6r6NKNbZgV4BJ5wjczrOJ5KuR0Zq9z5GL/OEi9sz/7z3Tjqc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711321637; c=relaxed/simple; bh=on5rA5lUDHzMSR8tAIoz2HkHMwVZeJD5y2m+BoZ5Ieo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GkqXyTwujJZXq6nYioxp9F0MdsGu2oGBRXvTwCU3A/cIUpwJRrHrxvjKc2KZBV/5wF+9PNtYSz9+aBTbJgsLggSraJE87xhQJy8uhuIH57mJN0qpRP6lahnFvsXTgxR87IiALJ/DhpL0GbfZtDVwoljQFiUY4MKpDoD3x7Z/I24= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=t4Ea0iFu; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4256EC433A6; Sun, 24 Mar 2024 23:07:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711321636; bh=on5rA5lUDHzMSR8tAIoz2HkHMwVZeJD5y2m+BoZ5Ieo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t4Ea0iFu1DcnSvHW3QWLYk49VqZ10bWwhIFgxIyfIi2G0oxHXYG9PYrWm4/IJvRpC 00U6NaQGEh8Sni9b95XUjiaIliaLZinEyUCBhV0Co7GU/5C/EsJajc6nWdtn7c8fYc 0JmRrnyVivGdBcI5aF+BLbtMzyEfywSCF3RBRwk0znELtkdUMzeVNXbvuYqjiZF/q1 Vw2fV7OZQMa4nPZ27KXkr1xjmm93iVoGyYlbmcH2sYthgIKbWoE4B525y5ix4gRK97 1xp2ljbJhk6uVuQ2yuhchm8s4ccz9LE65ivqQnfIg+aTl2lncWgSNrA91LSLPL2txR DZaO5Ejsf6hYg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yang Jihong , Namhyung Kim , Sasha Levin Subject: [PATCH 6.6 367/638] perf record: Check conflict between '--timestamp-filename' option and pipe mode before recording Date: Sun, 24 Mar 2024 18:56:44 -0400 Message-ID: <20240324230116.1348576-368-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324230116.1348576-1-sashal@kernel.org> References: <20240324230116.1348576-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 69d2d71e16ee8..c40460e936ccd 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -2417,6 +2417,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 fc16299c915f9..851a9cd32c4a2 100644 --- a/tools/perf/util/data.c +++ b/tools/perf/util/data.c @@ -418,8 +418,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