From patchwork Fri May 24 17:34:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 165158 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp3886650ili; Fri, 24 May 2019 10:36:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqyD/NeAzmZd1a70zZ0It5jHSGE5zupdwDhIqTCh1w+oO9qMziBGxnkRNn1K8n7Cn3v7wquV X-Received: by 2002:a17:902:b704:: with SMTP id d4mr37740419pls.217.1558719401628; Fri, 24 May 2019 10:36:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558719401; cv=none; d=google.com; s=arc-20160816; b=fHjgEpOtF+xUbGtjaP2ryJ/FeoYaFep5EbKwyvj89Cp74YxybDFJg37gipbE3ORxUV 08O6ehxHOpDQmBXuy2L+L7mP7fTks1QyTBRGU7iNtpHoB3u0jlL0JmBDiP5k4RGaiNm1 RFDZa7vWh051o/QpcRv1Feq5lv+PThghebdEp5c/HZo00Ytwkl9/Ug3QnWwjHnL58mEi upHD4MWZaopX5IMMwqcHJnbc/eORXSOPcGEXYtnIqPDgmMpTPjEzxI8I1rCqsdsfVaPm m2cBWdLvXe/I3dUHeonUvwnVM1DucCJlduFsmCQvbl4x/5DJ3PHxNPO/mwFUaDlcTJxx vRXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=bHfFo/ORpsa03SvyTpjVHtc4WYRwtr5BeZCOvFgzYZo=; b=03Gj4B2ZViKZY5wvjZ6A9wXBuptTG3x1/vZuIfs26f4f+k2elgQvE0tvCKCGNNJY4B Fd+TJcM6bksHMEzCo/wbq4FTI+zaDVV/SwVnHrggsySGSr4yIzWnXpo2OcSReWUHEsSw pKlp99njFpTw5oheEYhOl8FB305nbsLvymPgQXpdSEpPPDAQaO2PtDeMpldUWGzjZaxM Q52gaUANHbJGKMaZ22YTd3jaHfQ6HSxc7TWLzRf+ZdMA04KONuieDAXZrCcJAuP9MmBN TozL55aISToL/O6L1G+HIkO69k3Ddr5vVyY00HonI2kYETkevnkLxj0tlDmcENIzxaAe 38Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hSBPmd0y; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b11si4451495pgq.455.2019.05.24.10.36.41; Fri, 24 May 2019 10:36:41 -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=@linaro.org header.s=google header.b=hSBPmd0y; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391641AbfEXRfT (ORCPT + 30 others); Fri, 24 May 2019 13:35:19 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:36368 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391421AbfEXRfP (ORCPT ); Fri, 24 May 2019 13:35:15 -0400 Received: by mail-pl1-f196.google.com with SMTP id d21so4439635plr.3 for ; Fri, 24 May 2019 10:35:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bHfFo/ORpsa03SvyTpjVHtc4WYRwtr5BeZCOvFgzYZo=; b=hSBPmd0yHRq5YPvvnYa5Gx0AuXkJSH3B/lf9UvmmoD/BV8lpht4l4I20wq2uLPOEPs u7ufCc6pRQ3OIj5ikzw7wj6tCJb8XA05l+3Ag8o3CxvMzdRYsLnd4zvezjzSjKixKYF9 tCi1s+z/0fQW6n6IyymDffRnqsMm0576GcSIFZko3qMfIcB7H2Yn1EIFnLBxojtntpDI up25DcEbYTZjo+CzyW8v3n6/ZyYz/e/SGmtK8MXqs7PkzM0602OyS2k2oNGTq/ntRLDa 9thUJP0L0kIiwr1tfYWkIzSUvthKBLIhli1z9zahMaCO5znW4HJDhWd/ywN2Z6EnDT0n do3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bHfFo/ORpsa03SvyTpjVHtc4WYRwtr5BeZCOvFgzYZo=; b=Cm+GQC/PbgYaMjnm5rd8cALxFZx/M3Noc1nl3NWjtuEcKaWG856wE1LYSKyh2iM0gw ayT2N1DP9Jb/SbaQZ+D/m+Wp4Pg2qB0IdH04qlMDOHTpFOJqDo+MRFgScEafdIc02Uh2 LhqS5o7YAUsVVJSw0Tvx0+ZcZfKbe9HUJqYiH2+KOGAb5mLRzq4/VHfPDps28gvBS0C4 gMTZeLoiJ0LQ5O6xYfUmTr3b7kIx4nu8rkEqAXNUoLKVIgAyHS7fCRkYiiLt2mIfhB9Z nbS7RXBca9lhnejZCqK4WppfJzIz2RwVGtU+FET8ObsQIm6aD73vMwHjdNZFkaJxGhbx Z2Xw== X-Gm-Message-State: APjAAAUprWX43ySPIqGLV6JGgEl0gOdBFctnP8egogjCtFwGp5C6Up9P iqh8Drw7JHkY98SfASFag/JUcw== X-Received: by 2002:a17:902:2e81:: with SMTP id r1mr91812796plb.0.1558719314882; Fri, 24 May 2019 10:35:14 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id k13sm2809575pgr.90.2019.05.24.10.35.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 May 2019 10:35:14 -0700 (PDT) From: Mathieu Poirier To: acme@kernel.org Cc: peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, suzuki.poulose@arm.com, leo.yan@linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org Subject: [PATCH v2 04/17] perf tools: Add handling of itrace start events Date: Fri, 24 May 2019 11:34:55 -0600 Message-Id: <20190524173508.29044-5-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190524173508.29044-1-mathieu.poirier@linaro.org> References: <20190524173508.29044-1-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- tools/perf/util/cs-etm.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) -- 2.17.1 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; }