Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2902612ybi; Mon, 17 Jun 2019 12:23:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqygHJnlbvTwn4iGT/5G8RBBYCNr0SVDcvMQYBmSDuLZKpBGPuI9uw6aF+aIoJfjUvDP8aQM X-Received: by 2002:a17:902:9898:: with SMTP id s24mr10830970plp.226.1560799398109; Mon, 17 Jun 2019 12:23:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560799398; cv=none; d=google.com; s=arc-20160816; b=Hay0a/DjQxWyp0IPwhnp1sxNvojY8soKK0nl7UJ0E3QQYOFp39lvtnNFy2aVOBYZQG n0UUDogSwAzbKed22jm53HV0JDDKeywGcl1kZ0Rttj1KxbtQNDy1U3wmWkFVFD/p6kpG fxj7CD7Yxy9+LDufntnGudRe+IQ+RDqH0Gx7UC5gP5Uh0awzieqreClZ97fIrTC7r8oB Xc1NYYpDDiHPWnRsfKBi477xlqTDKe7c6qw19uPAc7BrE9qxSIs2YSSiEMLoJQ0PbkDT oRIXBdFp7879WMPh9O6UwZ+VwZT5jDOiYCJByQnwVrOvp3a2B5/Gi/U50ccHHzQHrV4D 8Pdg== 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=I0f8c8zlutdhaZ/vrHnn52hSauWLCUniL5rHMFHk7Jg=; b=ntzo5fxRu/CATYqw+XOAmquQKnIJV0CvSKmi9z7AikAE1ryDHzPONOQcGsKdmzf6Gm lS8voBrHGRcCZMp+XnFLG90n9Rm80X6gRUBf7B41Rq2sxAl7Fk9/IqFD1a60oUQj/WUC w9pgVybsx3xEfD9msLPVxTQcs1yYWKvYR9TTNI+F3/7KZWfpof5nYladnkMBMlCpTyo+ tlxzv7HlmaZxBkrok3ea8zn8NR9eRl5mvW1MX1X/1G6H42ZxYHkP9q13YK9ZN22vr9Yj jqn/KAYpg3VWWp3u4PyBfoBLadZ1R+AHzwMFVo6tV0l12TymVXdfIsR5/b7ypR44jLJq fwLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2019051801 header.b=P43tJP6I; 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 b184si11303031pfa.227.2019.06.17.12.23.03; Mon, 17 Jun 2019 12:23:18 -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=2019051801 header.b=P43tJP6I; 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 S1727409AbfFQTWs (ORCPT + 99 others); Mon, 17 Jun 2019 15:22:48 -0400 Received: from terminus.zytor.com ([198.137.202.136]:42551 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725497AbfFQTWs (ORCPT ); Mon, 17 Jun 2019 15:22:48 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x5HJMFC33560904 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 17 Jun 2019 12:22:16 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 terminus.zytor.com x5HJMFC33560904 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2019051801; t=1560799336; bh=I0f8c8zlutdhaZ/vrHnn52hSauWLCUniL5rHMFHk7Jg=; h=Date:From:Cc:Reply-To:In-Reply-To:References:To:Subject:From; b=P43tJP6Ib4Osl3Y9WK2GqOWKjF+cC1Msq9tZVN94xGbREef6TKl8HvPNshSo9qVOb T4oL+a1UQM7BeZP1IA8kQYv/EYgp8Dibo2oFcLz6cKpTjOglXaNdMTmIM6705Kvy6I khTS7hXnpiEABoWhrl6rNR1VxlLG1dPKhnWOGYv1eP9Hwk1Q45KwCM3WemMALBCqrf O7KQlR2z4OdthyMWgKbBR8DGEYIAe98+ggWmfeKhu9Tdxu1jOf3pqWpUTMB4BoW6y7 jCach/Jh0IQvecXOOBPke4tkSwhs4ruCZMWpOT/mDmxm4DrEAia6TmFo9zA94HigXa e1YNAmtxUQTdQ== Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x5HJMFK53560901; Mon, 17 Jun 2019 12:22:15 -0700 Date: Mon, 17 Jun 2019 12:22:15 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Mathieu Poirier Message-ID: Cc: jolsa@redhat.com, leo.yan@linaro.org, peterz@infradead.org, hpa@zytor.com, namhyung@kernel.org, mathieu.poirier@linaro.org, acme@redhat.com, tglx@linutronix.de, mingo@kernel.org, linux-kernel@vger.kernel.org, suzuki.poulose@arm.com, alexander.shishkin@linux.intel.com Reply-To: peterz@infradead.org, leo.yan@linaro.org, jolsa@redhat.com, alexander.shishkin@linux.intel.com, mingo@kernel.org, linux-kernel@vger.kernel.org, suzuki.poulose@arm.com, tglx@linutronix.de, hpa@zytor.com, namhyung@kernel.org, mathieu.poirier@linaro.org, acme@redhat.com In-Reply-To: <20190524173508.29044-5-mathieu.poirier@linaro.org> References: <20190524173508.29044-5-mathieu.poirier@linaro.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf cs-etm: Add handling of itrace start events Git-Commit-ID: a465f3c3e3e6da729c645ea17615d4ae673588bf 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=-1.2 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_06_12,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, DKIM_VALID_EF 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: a465f3c3e3e6da729c645ea17615d4ae673588bf Gitweb: https://git.kernel.org/tip/a465f3c3e3e6da729c645ea17615d4ae673588bf Author: Mathieu Poirier AuthorDate: Fri, 24 May 2019 11:34:55 -0600 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 10 Jun 2019 15:50:01 -0300 perf cs-etm: Add handling of itrace start events Add handling of ITRACE events in order to add the tid/pid of the executing process to the perf tools machine infrastructure. This information is later retrieved when a contextID packet is found in the trace stream. Signed-off-by: Mathieu Poirier Tested-by: Leo Yan Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Suzuki Poulouse Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/20190524173508.29044-5-mathieu.poirier@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/cs-etm.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index de488b43f440..0742c50fce46 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -1657,6 +1657,29 @@ static int cs_etm__process_timeless_queues(struct cs_etm_auxtrace *etm, return 0; } +static int cs_etm__process_itrace_start(struct cs_etm_auxtrace *etm, + union perf_event *event) +{ + struct thread *th; + + if (etm->timeless_decoding) + return 0; + + /* + * Add the tid/pid to the log so that we can get a match when + * we get a contextID from the decoder. + */ + th = machine__findnew_thread(etm->machine, + event->itrace_start.pid, + event->itrace_start.tid); + if (!th) + return -ENOMEM; + + thread__put(th); + + return 0; +} + static int cs_etm__process_event(struct perf_session *session, union perf_event *event, struct perf_sample *sample, @@ -1694,6 +1717,9 @@ static int cs_etm__process_event(struct perf_session *session, return cs_etm__process_timeless_queues(etm, event->fork.tid); + if (event->header.type == PERF_RECORD_ITRACE_START) + return cs_etm__process_itrace_start(etm, event); + return 0; }