Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2774269yba; Sat, 18 May 2019 02:40:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqzDDa4sAYRsFLu2/C5pd+vb2IZqA+7Ht2NsuDY1D0Z5P8Q36Qqo6UVxR+wvoZbsnbncvGwK X-Received: by 2002:a17:902:d890:: with SMTP id b16mr14002561plz.91.1558172435351; Sat, 18 May 2019 02:40:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558172435; cv=none; d=google.com; s=arc-20160816; b=HT77jCFNpsZAOrfQsJ82MKPB7feL6uJTc0rIXVM+OGnDNRi7y8+9b05HxvMOyNMi7K GwgVRNTGQR6oKbc9oW5BoPh1NiZ48tYDS83cGLggX07fr+1c1ePLM2fWhkP7Y/eHKd2D 4fXWF44eH5Xopt2GV/LkIN8sdX2yQZoHevjEzQxLY8LQwVi9NsxKCkfvxnCo48C6LE6/ Eo9CISSq6emkOAWZzLA/pcDRkMkPFL6uK+GvLX0vL6P7VyLISa3OvPvHnlnWmEq4w8U8 sbIkqqkswaJC8LeHLrMqEm7rPXOhoVnClwN3H3NUgmhAQEPhXbU1WlJrTKCyRy/uB7rY BAYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:dkim-signature:dkim-filter; bh=4ezdGJxCwlm5AdC0BB1raYs33wZemvU+BTAJmTS51N4=; b=Y8Tsalj+9WJBsaR+0Rm11of5x8ccE0qX0AKMNtFHq6YXNvWhEou+UKtrDfAIgIocch GeDSdCj/y6chALiRqvBKiRrr9hP0XqzLL+GKFa5FbYcHcmdfmkBs8h+Sfk730Nx0eCnj fOCx0pdqCnztozHMUM9R2Nl48PJIX16ukcvZraeIcJMrGC4x9w3A4062XamZZLhBpTcI dJubzSSY/nEwUtlUCdoQXfpNSDm8MjtvFGVtzOYPf/Bi05YG5OWP76lsAilGxWqYFkvK of4Kqve97cn0dn9V3RsnEGkmOmsEi1FIjyLT+ZhoWNU63RqXSe0b00DKARdA6GPzz/MI Nreg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2019041745 header.b=d9QIL6Q2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y184si10038491pgd.546.2019.05.18.02.40.20; Sat, 18 May 2019 02:40:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@zytor.com header.s=2019041745 header.b=d9QIL6Q2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729891AbfERJYE (ORCPT + 99 others); Sat, 18 May 2019 05:24:04 -0400 Received: from terminus.zytor.com ([198.137.202.136]:49003 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725468AbfERJYE (ORCPT ); Sat, 18 May 2019 05:24:04 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x4I9NpN41739252 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 18 May 2019 02:23:51 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 terminus.zytor.com x4I9NpN41739252 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2019041745; t=1558171432; bh=4ezdGJxCwlm5AdC0BB1raYs33wZemvU+BTAJmTS51N4=; h=Date:From:Cc:Reply-To:In-Reply-To:References:To:Subject:From; b=d9QIL6Q2Jnn90p7AgQpr+JEFUwbl9ozl6NUZ1XlCM71THh2NZYGwjpZdvYlPFVQAz GEPHDug7hsSeOXv5iUeAiQSFiSRtNAa2Ocx/ZP5LwMQr1Pe3x7MUfWBRzK17BqCINa FPT4a7SwCAgiwxgHt4D7OAw5kBfrlJAQ6/MZIrcEa7L7/+FRtUyFjf4nVR2lRRUtF0 kVBXE08YMkHW/D6+h+pNmh3eC0D9ROCE1uNWRHiNDnhjt/6bcSVR0sVvbOIdZX1z1x pqlQu7mxnELut/Q8AEBYVwu7jFEEll8GZIuJb4uni59irYACyjmw5lR33n4r+fYYC9 BEf68illMMYNg== Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x4I9NoYP1739249; Sat, 18 May 2019 02:23:50 -0700 Date: Sat, 18 May 2019 02:23:50 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Alexey Budankov Message-ID: Cc: alexey.budankov@linux.intel.com, alexander.shishkin@linux.intel.com, acme@redhat.com, linux-kernel@vger.kernel.org, ak@linux.intel.com, mingo@kernel.org, tglx@linutronix.de, hpa@zytor.com, peterz@infradead.org, namhyung@kernel.org Reply-To: linux-kernel@vger.kernel.org, acme@redhat.com, alexander.shishkin@linux.intel.com, alexey.budankov@linux.intel.com, ak@linux.intel.com, mingo@kernel.org, tglx@linutronix.de, hpa@zytor.com, peterz@infradead.org, namhyung@kernel.org In-Reply-To: <304b0a59-942c-3fe1-da02-aa749f87108b@linux.intel.com> References: <304b0a59-942c-3fe1-da02-aa749f87108b@linux.intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf report: Add stub processing of compressed events for -D Git-Commit-ID: 61a7773ca88f32ef7e185fdf9fc0d44e8ec18a66 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-3.1 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 61a7773ca88f32ef7e185fdf9fc0d44e8ec18a66 Gitweb: https://git.kernel.org/tip/61a7773ca88f32ef7e185fdf9fc0d44e8ec18a66 Author: Alexey Budankov AuthorDate: Mon, 18 Mar 2019 20:45:11 +0300 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 15 May 2019 16:36:49 -0300 perf report: Add stub processing of compressed events for -D Committer note: Split from a larger patch, this only dumps PERF_RECORD_COMPRESSED as unhandled, so that when we introduce the record part in the next patch, we don't see unhandled events when using 'perf record -D'. Changed it so that we dump the event if the handler is just a stub, i.e. for the case where we don't have ZSTD linked but we're processing a perf.data file generated by a tool with that linked. Also when failing to decompress we can't just dump the uncompressed event and return 0, we have to propagate the error. Signed-off-by: Alexey Budankov Cc: Alexander Shishkin Cc: Andi Kleen Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/304b0a59-942c-3fe1-da02-aa749f87108b@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/session.c | 19 ++++++++++++++++++- tools/perf/util/tool.h | 2 ++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index bad5f87ae001..ec1dec86d0e1 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -358,6 +358,14 @@ static int process_stat_round_stub(struct perf_session *perf_session __maybe_unu return 0; } +static int perf_session__process_compressed_event_stub(struct perf_session *session __maybe_unused, + union perf_event *event __maybe_unused, + u64 file_offset __maybe_unused) +{ + dump_printf(": unhandled!\n"); + return 0; +} + void perf_tool__fill_defaults(struct perf_tool *tool) { if (tool->sample == NULL) @@ -430,6 +438,8 @@ void perf_tool__fill_defaults(struct perf_tool *tool) tool->time_conv = process_event_op2_stub; if (tool->feature == NULL) tool->feature = process_event_op2_stub; + if (tool->compressed == NULL) + tool->compressed = perf_session__process_compressed_event_stub; } static void swap_sample_id_all(union perf_event *event, void *data) @@ -1373,7 +1383,9 @@ static s64 perf_session__process_user_event(struct perf_session *session, int fd = perf_data__fd(session->data); int err; - dump_event(session->evlist, event, file_offset, &sample); + if (event->header.type != PERF_RECORD_COMPRESSED || + tool->compressed == perf_session__process_compressed_event_stub) + dump_event(session->evlist, event, file_offset, &sample); /* These events are processed right away */ switch (event->header.type) { @@ -1426,6 +1438,11 @@ static s64 perf_session__process_user_event(struct perf_session *session, return tool->time_conv(session, event); case PERF_RECORD_HEADER_FEATURE: return tool->feature(session, event); + case PERF_RECORD_COMPRESSED: + err = tool->compressed(session, event, file_offset); + if (err) + dump_event(session->evlist, event, file_offset, &sample); + return err; default: return -EINVAL; } diff --git a/tools/perf/util/tool.h b/tools/perf/util/tool.h index 250391672f9f..9096a6e3de59 100644 --- a/tools/perf/util/tool.h +++ b/tools/perf/util/tool.h @@ -28,6 +28,7 @@ typedef int (*event_attr_op)(struct perf_tool *tool, typedef int (*event_op2)(struct perf_session *session, union perf_event *event); typedef s64 (*event_op3)(struct perf_session *session, union perf_event *event); +typedef int (*event_op4)(struct perf_session *session, union perf_event *event, u64 data); typedef int (*event_oe)(struct perf_tool *tool, union perf_event *event, struct ordered_events *oe); @@ -72,6 +73,7 @@ struct perf_tool { stat, stat_round, feature; + event_op4 compressed; event_op3 auxtrace; bool ordered_events; bool ordering_requires_timestamps;