From patchwork Fri May 13 23:36:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 67801 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp504993qge; Fri, 13 May 2016 16:36:22 -0700 (PDT) X-Received: by 10.98.84.2 with SMTP id i2mr27156053pfb.55.1463182582732; Fri, 13 May 2016 16:36:22 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j187si26980175pfb.34.2016.05.13.16.36.22; Fri, 13 May 2016 16:36:22 -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; 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 dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753561AbcEMXgV (ORCPT + 29 others); Fri, 13 May 2016 19:36:21 -0400 Received: from mail-io0-f181.google.com ([209.85.223.181]:33670 "EHLO mail-io0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751208AbcEMXgT (ORCPT ); Fri, 13 May 2016 19:36:19 -0400 Received: by mail-io0-f181.google.com with SMTP id f89so150946576ioi.0 for ; Fri, 13 May 2016 16:36:19 -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; bh=PG2kfVw6c7+X+PQD+Y4uUpDb+eliPbqI0D1HebNYFSo=; b=I2s5FmQByNR2z5h9onwVPicO2BcyOfI4VpAp1LenwO54sMdvLsZj6qE4s3hficcqYs V2k3qeRwASJAGC27pb1guQsVsSaeQ/lr0yN8gKmzvWAKMx0FYVXuQuyBTGSjU1zfqvx4 1orgHeOF6IxlSIw6DWS+xjV+5g/xaEZQYroM4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=PG2kfVw6c7+X+PQD+Y4uUpDb+eliPbqI0D1HebNYFSo=; b=jyFxOxc5PHEaO25tg7eSXVu/uLUaU9Y2E663wvnLXh0fn1tdNjFGosXd80LDty+Vqf oNdh44x9UNpMZKGVkYseDy0ewFoJ3o15sFDoVIoATKxmXeKoeRJvkl96A5AoDuRUQZ2J rlie7Qisdi1dMW0aVTDEOSp4fzMaby+TDsAUEvKkR4QnySz6TCG0yJUaW+E9EKcRBIuF dmdpKYqBRxlH2o+l+GJvlZPa+ST71uPIMLqbTdhz9AOmrA6vTzw7EE4VnV+CTVi6HM6o rlUxFB2u/4gTWhWa+m2Yl+acadHUvJ4U/UiOPvKdVMyh5jleD6ygJh/Xn4snvu6hi9Un yiHA== X-Gm-Message-State: AOPr4FXapxDeQonEM79vReRJJwpLTqNYHO/X1LCi0/a9yTSjWOeIW6ub1qJcSMpgnIm/5vQ9 X-Received: by 10.107.59.130 with SMTP id i124mr9571418ioa.107.1463182578741; Fri, 13 May 2016 16:36:18 -0700 (PDT) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id gq3sm1684150igc.18.2016.05.13.16.36.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 May 2016 16:36:18 -0700 (PDT) From: Mathieu Poirier To: acme@kernel.org Cc: alexander.shishkin@linux.intel.com, jolsa@kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH] perf session: fixing uninitialised cpumode Date: Fri, 13 May 2016 17:36:16 -0600 Message-Id: <1463182576-6035-1-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.5.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following patch[1] adds a new "cpumode" to the perf_sample structure that gets initialised as events are read from the data event file. With the advent of HW tracers and more specifically the decoding of the traces they generate, function perf_session__deliver_synth_event() gets called directly from the infrastructure that decodes the traces, for example[2]. As such initialisation of perf_sample::cpumode doesn't get done, which prevents the shared object name from being printed in the perf report output. Before this patch: 4.13% 4.13% uname [unknown] [H] 0x0000007fae8b4758 3.74% 3.74% uname [unknown] [H] 0x0000007fae8b4e50 2.06% 2.06% uname [unknown] [H] 0x0000007fae938af4 1.65% 1.65% uname [unknown] [H] 0x0000007fae938ae4 1.59% 1.59% uname [unknown] [H] 0x0000007fae98f7f4 1.50% 1.50% uname [unknown] [H] 0x0000007fae8b4e40 1.43% 1.43% uname [unknown] [H] 0x0000007fae938ac4 1.31% 1.31% uname [unknown] [H] 0x0000007fae86b0c0 1.26% 1.26% uname [unknown] [H] 0x0000007fae99b888 And after this patch: 4.13% 4.13% uname libc-2.21.so [.] 0x0000000000078758 3.74% 3.74% uname libc-2.21.so [.] 0x0000000000078e50 2.06% 2.06% uname libc-2.21.so [.] 0x00000000000fcaf4 1.65% 1.65% uname libc-2.21.so [.] 0x00000000000fcae4 1.59% 1.59% uname ld-2.21.so [.] 0x000000000000a7f4 1.50% 1.50% uname libc-2.21.so [.] 0x0000000000078e40 1.43% 1.43% uname libc-2.21.so [.] 0x00000000000fcac4 1.31% 1.31% uname libc-2.21.so [.] 0x000000000002f0c0 1.26% 1.26% uname ld-2.21.so [.] 0x0000000000016888 This was tested using CoreSight but the same is very likely to happen on IntelPT. I'm pretty sure this isn't the right solution but we can start building from that. Comments welcomed. [1]. commit 473398a21d28 ("perf tools: Add cpumode to struct perf_sample") [2]. http://lxr.free-electrons.com/source/tools/perf/util/intel-pt.c#L1806 Signed-off-by: Mathieu Poirier --- tools/perf/util/session.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.5.0 diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 4abd85c6346d..28cc405e7245 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -1352,6 +1352,10 @@ int perf_session__deliver_synth_event(struct perf_session *session, { struct perf_evlist *evlist = session->evlist; struct perf_tool *tool = session->tool; + u8 mode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; + + if (sample) + sample->cpumode = mode; events_stats__inc(&evlist->stats, event->header.type);