From patchwork Fri Jan 19 04:03:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Jihong X-Patchwork-Id: 189397 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp783600dyb; Thu, 18 Jan 2024 20:08:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IEW2jqv38cy8eTuB29MzroP3AvioLPJcdzCGWV0hjgiwv+Y3IWkgSwfV5AQHb6aCmQs0miZ X-Received: by 2002:a17:902:dac5:b0:1d5:7316:c9fb with SMTP id q5-20020a170902dac500b001d57316c9fbmr2256147plx.37.1705637327752; Thu, 18 Jan 2024 20:08:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705637327; cv=pass; d=google.com; s=arc-20160816; b=ZuI4y/5HKm1MNZUWAydG0mCsrsNi/mbSBSXm3X4zBhqfkcDfxuTK/wOBAfU0Dug8jT muRyc+cwGJqUF0bCd7qzS0lqTipydGX1GQFDWi5IM80xroqjrKX5U9YZYKkmu3F3zdBX uDkxtij2p3kMpJuEgB/FtOg7d9xTJmO0/FAOfRlLYKShIs/WA4WFpckljfWzc5aeXrXx PIjpo5Xn8WbA76PPVWWvWn1cLL5g7R3iHjw8Ly9KI7Q2yZahU1jEHGA0SnXHLPDWhBZw JzWdf7vBK7OdXm9UzYaihmlbiOlogIa3QCsWVqFYyRLCkyrLtoWTnAtM0wOyjMqTa4bB Gq/g== 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; bh=N8QEgEIBtUfbimI2gpQgOtBKdGDXWEJ43Zz60FPON18=; fh=Bniw+6GSTGRfFyC55GB3Thz1GNqaKHZWIdADbDjMDXE=; b=Vqm+lkpIsopIxqxyKQMI9bzH29IzAMyveSj3cNiXfLJaTAtNwPB5JE/i5EBIWNTQRq ZqkR1Yb1Suf9EcShV033fEJvo1jnuCMIwR4i26VqQ74L2z6tVD8HMW7dEwCgBJDwmhTq LMPWbVFjxGzOlTtZGo+p9eacy/pdTXCgpmCTCONfa9vvRLwwWgSCQZiWk9gFYm8wvkJD aRxpzXThME9v0GowNWK9pUbB4kiaDNFFvvbo+qo0nmnPHxV1L9YDOR6H3cNwj6E/D3OO T7nm2wC3vR2lLdfEkt1CdOOPFLgu965vN6OsxpsaWF9FYHy4IPDhiADO1c0/C6hCfv3i XpaQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-30756-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30756-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id b10-20020a170902ed0a00b001d721419f4dsi189003pld.212.2024.01.18.20.08.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 20:08:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30756-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-30756-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30756-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 575CFB22096 for ; Fri, 19 Jan 2024 04:08:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C087ABA37; Fri, 19 Jan 2024 04:07:38 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (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 516C9186F; Fri, 19 Jan 2024 04:07:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705637257; cv=none; b=reJQrAaKXpQ+vpKNIgvGUxweQz0kn8tT5x2EOGOU+BHnEwK7L/yzq8dz0voYBQo4sG7ZCozS6nQ/xlZ5gcy6/+GksHipkBxhosCYY0F5ljVjbY+L3jKzGODzkxBRs0rK9lf3vk9YtiKrwjUURHVw8xWGx+E+JhgVjtOx4rAVn9o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705637257; c=relaxed/simple; bh=M4gbtCrIsHu5bBKP/offlfUWfKenppOsqw7RpHvE8zI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RCnXyNt3xXBvsoW4jfC3qriaOPt+EgJ+CwHqgJH7D0ggkhJF7Jiz1oI7uncwxIuoGOn6yFTUcVIPfozxZp1Dd4gvI90IjZeCAJzKOBYiAZQKO1sTYZRxwNtZ4YoTGFZpJjbMtS+0qyjNCuyGjWZ6R980wM/pDom8U0rAdiLsWJc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4TGQyk1393zvPsW; Fri, 19 Jan 2024 12:06:06 +0800 (CST) Received: from kwepemm600003.china.huawei.com (unknown [7.193.23.202]) by mail.maildlp.com (Postfix) with ESMTPS id A85181402DE; Fri, 19 Jan 2024 12:07:32 +0800 (CST) Received: from ubuntu2204.huawei.com (10.67.174.22) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 19 Jan 2024 12:07:31 +0800 From: Yang Jihong To: , , , , , , , , , , CC: Subject: [PATCH 1/3] perf record: Fix possible incorrect free in record__switch_output() Date: Fri, 19 Jan 2024 04:03:02 +0000 Message-ID: <20240119040304.3708522-2-yangjihong1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240119040304.3708522-1-yangjihong1@huawei.com> References: <20240119040304.3708522-1-yangjihong1@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600003.china.huawei.com (7.193.23.202) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788490366525095957 X-GMAIL-MSGID: 1788490366525095957 perf_data__switch() may not assign a legal value to 'new_filename'. In this case, 'new_filename' uses the on-stack value, which may cause a incorrect free and unexpected result. Fixes: 03724b2e9c45 ("perf record: Allow to limit number of reported perf.data files") Signed-off-by: Yang Jihong --- tools/perf/builtin-record.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 91e6828c38cc..fb8d4067b76c 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1830,8 +1830,8 @@ static int record__switch_output(struct record *rec, bool at_exit) { struct perf_data *data = &rec->data; + char *new_filename = NULL; int fd, err; - char *new_filename; /* Same Size: "2015122520103046"*/ char timestamp[] = "InvalidTimestamp"; From patchwork Fri Jan 19 04:03:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Jihong X-Patchwork-Id: 189396 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp783576dyb; Thu, 18 Jan 2024 20:08:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IEJkK8amuyuEAULiOT8Q82YgRg0bynZoSVi82m/hK//kxYrDMvCPD86V93CJP9+lj6xXli6 X-Received: by 2002:a6b:6e0a:0:b0:7bf:203:ad9e with SMTP id d10-20020a6b6e0a000000b007bf0203ad9emr2550758ioh.2.1705637323053; Thu, 18 Jan 2024 20:08:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705637323; cv=pass; d=google.com; s=arc-20160816; b=0JxUP6DTDX8f7PPkwaeUcOsNKJUwazKZ5TRh8F+mXHxxTQAlu0r8hSzzeeXXvR75oP qZiTQUggBSVVK5B5QSkjh6/gSAAOmT43aPRBIBC4LGExvp4Ipzyz34A3VfbhoaSsOxCQ p9ON0jZj7VddwjmAQCqwOxbyK9KeL9Cjpk/eE70jsFmLGszgQ7SxqcgtDP4sgiLs3o88 Xcy5VTL4CN4lGAsFZbZRqRtUIXgrRwWAWinTS0VTkonnYd1o0sPuAw9g4/Y1xV9wrv0o h4l2/P9eYcQCF8CfMuJwOEuKJ69lGrX82a66r/G9SgaoDVnDhUPDZrk+n1ZUSSYG2ph1 joaQ== 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; bh=VavjmQ82KveuSr5YcTgNHe9T+a+zHYv1mVOwOXRtRKs=; fh=Bniw+6GSTGRfFyC55GB3Thz1GNqaKHZWIdADbDjMDXE=; b=Ap6kaDKrZEGkdePoRBqhz0UT4QJK60c4jGEuR+N1FcBha+4uWm72NcBAIHuqCaxKUh yqOdh+60i2Ne13+HfwJ0V1cV2Y5icjZBhOkDXOr3+v/AvduWNM2/CCNSNfOXU4qioIYC noon0tJRXK7zSyRrV33OPjAjnpdOsdLBzR3VQdhKQCdJiICOXhz9SyXhGTbBmPLPH/Gi YmZT+u4hUvCLh4HwKSOsL7ZcSmyrbXUyqz1R7Vs5C/jNFaAOOlo0RLoFuQ98XrLCY9D0 jGYMPYmyB7gTcTRkagRKovULaKXXeb2rzLCuS8NUGIICMoqNdoStjAwjqXBik2xdHqZD Dmsw== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-30759-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30759-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id z32-20020a631920000000b005cdec4c81e8si2519267pgl.514.2024.01.18.20.08.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 20:08:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30759-ouuuleilei=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; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-30759-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30759-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com 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 C8099286649 for ; Fri, 19 Jan 2024 04:08:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 22E8EDDD9; Fri, 19 Jan 2024 04:07:40 +0000 (UTC) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (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 664381871; Fri, 19 Jan 2024 04:07:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705637258; cv=none; b=rsxbQzlZ03drC0st5hFOACPWVwCYe3M4jECLV7FPKYFOpbP5uxSDSSkbayn8qsvcq+ZiSo6xTgaXXKW3ACt6R0U7KIk7QsXma9jwsE+hriV6wbnjQu4/Dcw5DCtw0Vgx5NHB62YaC3RdH8aygYkEIhgGh1FPEAw9xzjP0m1lSQ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705637258; c=relaxed/simple; bh=qFcJAeGQC/MUYwBQAJZbuMyx6H16t+7Cin7A5eBF4Bw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FXkvqHRrnWHzJcWbMpHZE0dgRr+daxR64+6R3jIKgidn6y1z2BJYRYB7UWQXV1kqpWFkJfflOUlevCrThCT8A6Rhh+5OQTk5flA1AIM10NxCdFyLdGg6DQDXrTYh38uliVf1zYtWH/AHFO5/sz0nMkRLMKdulcZfU9F1lTAmPno= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4TGR004HJkzGpqC; Fri, 19 Jan 2024 12:07:12 +0800 (CST) Received: from kwepemm600003.china.huawei.com (unknown [7.193.23.202]) by mail.maildlp.com (Postfix) with ESMTPS id 34C6818005B; Fri, 19 Jan 2024 12:07:33 +0800 (CST) Received: from ubuntu2204.huawei.com (10.67.174.22) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 19 Jan 2024 12:07:32 +0800 From: Yang Jihong To: , , , , , , , , , , CC: Subject: [PATCH 2/3] perf record: Check conflict between '--timestamp-filename' option and pipe mode before recording Date: Fri, 19 Jan 2024 04:03:03 +0000 Message-ID: <20240119040304.3708522-3-yangjihong1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240119040304.3708522-1-yangjihong1@huawei.com> References: <20240119040304.3708522-1-yangjihong1@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600003.china.huawei.com (7.193.23.202) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788490361386626889 X-GMAIL-MSGID: 1788490361386626889 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 --- 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 fb8d4067b76c..5e3ea5cf1429 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 c29d8a382b19..550675ce0b78 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; From patchwork Fri Jan 19 04:03:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Jihong X-Patchwork-Id: 189395 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp783547dyb; Thu, 18 Jan 2024 20:08:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IEHxVyy59XXFg793UwDXDszILxLlin1VjHt76h27wcnkyYGaIofKz5XAs6Bp+8TsspZiKGr X-Received: by 2002:a05:622a:1a86:b0:42a:1b6d:7384 with SMTP id s6-20020a05622a1a8600b0042a1b6d7384mr602245qtc.48.1705637318182; Thu, 18 Jan 2024 20:08:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705637318; cv=pass; d=google.com; s=arc-20160816; b=VY4XkRKQIOQ+uXkJ1K+NSYRwIrQfM0qmzGGdRc6zBAyU/9iXb4jS/XYKqohPb0vj+C M8ACwGcbYO1H95/1jsh+KVnatOpL02eIidQqf8fI0GVw+JKCEzjXVv/lLuXKGuebwu6V G2Slkx4cBL3ay6RMqiD65BBsGX0lrMkE9v6GRPqs4K1FZQSPeSOEIQMl7FlxZbykYCkB wHVv5dZb+l2v6i+Uq13wlEchhiQ1wIdbIBJdGKkr8Nr/6CKxzUQsPn7kq6JXcPc8YB9A A+eRAc/4hq90Xi3PczTa+ozjWS4Rgc+jPlym8Hbg+ryDwXPXgLkeYp0r0DSmBmgaQAx8 WohQ== 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; bh=uVJDI8Av8JIkW3qp8NXElwHq6/3MK+TAHkHyddmUi5I=; fh=Bniw+6GSTGRfFyC55GB3Thz1GNqaKHZWIdADbDjMDXE=; b=sNgm6F65p+tmRupBlAbb+tz4D7xujGuMFNfv5HxjkE0uicjLMgrn0H/5mtQPOsTHfl gY++4y97a6/I+4zHTOSdoYGvtF9eiAqYRY7p9aZRek3mhbJYh7ftp5Tj+gaKSCcE3NYS OHhgvOi/k1UDmYkdMPCdOyzj7BAK9kpe0vPBMOODcQMq56lZ6kCn1w0Zs+6W3nsrYsKF bHC/lwC0dGfY0D5REY//w90JvXEQZ2kOWYS/JxyRIgIN3Xvz7ZE7C2Jcxp7TvV7isqHd 4X19/bMIZ6DAeYZcTpb44NSnozJ1JyX++TuGhavHM7aZikJ0yo4RchZB44b3T6Gn6Uxc JF8w== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-30758-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30758-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 19-20020ac85753000000b0042a13396c3dsi4075587qtx.251.2024.01.18.20.08.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 20:08:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30758-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-30758-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30758-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E26B71C232DE for ; Fri, 19 Jan 2024 04:08:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B4E6FDDBE; Fri, 19 Jan 2024 04:07:39 +0000 (UTC) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (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 D08651C15; Fri, 19 Jan 2024 04:07:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705637257; cv=none; b=qaoidY0soZQtN/OY7MF/4j/WnbTfOemktz1m15mdXp2MaZezXFdypPZges+3XpHMOZ2B2EAsLwVB9dxNYAJ1rI7kEODT8qtlTSzByYlB6yZKs3DOgMVT3GfOcP+Fvok4wZzw5jFOArHmSCHeKXWOhiraJRTPRVQV+EiCIsKxg5g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705637257; c=relaxed/simple; bh=AOy4v0CB7AxenOdzrzI/1u6KpR6P+kRay885wVReU9U=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=J6e1Hr3onm4wrXG3REfhLXnojFYsRog+NfR1/IRnzFP/U3dQTDc8aCrjjEdqBoh003VNWICTwsLN1FiC4U2AAdDReX0CoPYMG+nZz6pi6WfOK6X5jssPYZGmSekqwMACtQF4P1iEKOz4WAIswkMdHA23A+K+De1HemR7kFbgTcY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4TGR010Yr9zGpqH; Fri, 19 Jan 2024 12:07:13 +0800 (CST) Received: from kwepemm600003.china.huawei.com (unknown [7.193.23.202]) by mail.maildlp.com (Postfix) with ESMTPS id ACEFC1402DE; Fri, 19 Jan 2024 12:07:33 +0800 (CST) Received: from ubuntu2204.huawei.com (10.67.174.22) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 19 Jan 2024 12:07:33 +0800 From: Yang Jihong To: , , , , , , , , , , CC: Subject: [PATCH 3/3] perf data: Minor code style alignment cleanup Date: Fri, 19 Jan 2024 04:03:04 +0000 Message-ID: <20240119040304.3708522-4-yangjihong1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240119040304.3708522-1-yangjihong1@huawei.com> References: <20240119040304.3708522-1-yangjihong1@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600003.china.huawei.com (7.193.23.202) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788490357042780288 X-GMAIL-MSGID: 1788490357042780288 Minor code style alignment cleanup for perf_data__switch() and perf_data__write(). No functional change. Signed-off-by: Yang Jihong --- tools/perf/builtin-record.c | 7 ++++--- tools/perf/util/data.c | 8 ++++---- tools/perf/util/data.h | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 5e3ea5cf1429..0b6f29fa0064 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1853,16 +1853,17 @@ record__switch_output(struct record *rec, bool at_exit) } fd = perf_data__switch(data, timestamp, - rec->session->header.data_offset, - at_exit, &new_filename); + rec->session->header.data_offset, + at_exit, &new_filename); if (fd >= 0 && !at_exit) { rec->bytes_written = 0; rec->session->header.data_size = 0; } - if (!quiet) + if (!quiet) { fprintf(stderr, "[ perf record: Dump %s.%s ]\n", data->path, timestamp); + } if (rec->switch_output.num_files) { int n = rec->switch_output.cur_file + 1; diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c index 550675ce0b78..08c4bfbd817f 100644 --- a/tools/perf/util/data.c +++ b/tools/perf/util/data.c @@ -413,7 +413,7 @@ ssize_t perf_data_file__write(struct perf_data_file *file, } ssize_t perf_data__write(struct perf_data *data, - void *buf, size_t size) + void *buf, size_t size) { if (data->use_stdio) { if (fwrite(buf, size, 1, data->file.fptr) == 1) @@ -424,9 +424,9 @@ ssize_t perf_data__write(struct perf_data *data, } int perf_data__switch(struct perf_data *data, - const char *postfix, - size_t pos, bool at_exit, - char **new_filepath) + const char *postfix, + size_t pos, bool at_exit, + char **new_filepath) { int ret; diff --git a/tools/perf/util/data.h b/tools/perf/util/data.h index effcc195d7e9..110f3ebde30f 100644 --- a/tools/perf/util/data.h +++ b/tools/perf/util/data.h @@ -80,7 +80,7 @@ int perf_data__open(struct perf_data *data); void perf_data__close(struct perf_data *data); ssize_t perf_data__read(struct perf_data *data, void *buf, size_t size); ssize_t perf_data__write(struct perf_data *data, - void *buf, size_t size); + void *buf, size_t size); ssize_t perf_data_file__write(struct perf_data_file *file, void *buf, size_t size); /* @@ -91,8 +91,8 @@ ssize_t perf_data_file__write(struct perf_data_file *file, * Return value is fd of new output. */ int perf_data__switch(struct perf_data *data, - const char *postfix, - size_t pos, bool at_exit, char **new_filepath); + const char *postfix, + size_t pos, bool at_exit, char **new_filepath); int perf_data__create_dir(struct perf_data *data, int nr); int perf_data__open_dir(struct perf_data *data);