From patchwork Fri Feb 16 19:17:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 128633 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp909234ljc; Fri, 16 Feb 2018 11:36:08 -0800 (PST) X-Google-Smtp-Source: AH8x224Xf/iSYqQVM/PiVoo3K+9KKEe2i8LztqUEltjZ6yh/gGvnFBygI8QuHlMYsplObxzH+cv0 X-Received: by 2002:a17:902:9a84:: with SMTP id w4-v6mr6831324plp.136.1518809768400; Fri, 16 Feb 2018 11:36:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518809768; cv=none; d=google.com; s=arc-20160816; b=amE0IaYOnzbmZoivDJjzCPqDpz51UCwc7dQo1ICVIvWtvaNYfQnMs8ZY35IPvr/JWc +8ckNKCjk4pYPyMR7TM0n0vorbTNIY1og6v4kxw8uoiLE5AkKLKan3psZ+KEhkMn1vXB ZX+7+KUKrDKRR8jtlRr4vtizmbHPW9YS9n9bvUV3/K7psybsKi6ZbakwVTSmeVJNHrZR lEtyYG37acuh1FWtaP5ufYKe/jTR2o2pkYbWEteIoNgVMYo98DbUYtYNBbthS+TbXHtR p9qIipUIGpE6YmmOlB2kGn+7ORuEFyQIKunQ81nu5dGymQDjfhzCZeVSXLjV6lFwpTfw G05w== 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:dmarc-filter:arc-authentication-results; bh=6SqXMQ1VG0TGa0bgvS3txW6NqUXp1HNAEN9SEpuuYIo=; b=gSMvrEg6OEjhBaiTSntKvaBdFAsPGdmq/bNBWur0j6G/HNwb8jLZxuz2feSEIWpFgU /vs6gUS9UdPVMD3WYR3IGFNq06/TcPgK97Dvk1folGL/5PWIEMXhHtRlVf9uNlqibUi0 9wfwEu2k2BSVsR/dqyZGMITQvZQ+1di5eIODCkXQ6CEgqnDlCj0ojA1EAfE29gGh1hu+ 3IOeEMkXkwkbC5IiTx0bNFOk5Rj/fSR/sjshcYPc6xIE2fliBbFfZ62dTUVbDkmiLugn l89tJYWusU7SisFjiymHkZbmJfIbG7s4JsPD7tndJHNg/mt9n15Fzg28BQMjJaNnxpQw 3pEw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w5-v6si4596249plz.426.2018.02.16.11.36.08; Fri, 16 Feb 2018 11:36:08 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751359AbeBPTgB (ORCPT + 28 others); Fri, 16 Feb 2018 14:36:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:56500 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753637AbeBPTTM (ORCPT ); Fri, 16 Feb 2018 14:19:12 -0500 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 08272217D2; Fri, 16 Feb 2018 19:19:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 08272217D2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=acme@kernel.org From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Mathieu Poirier , Alexander Shishkin , Jin Yao , Namhyung Kim , Peter Zijlstra , linux-arm-kernel@lists.infradead.org, Arnaldo Carvalho de Melo Subject: [PATCH 20/41] perf cs-etm: Freeing allocated memory Date: Fri, 16 Feb 2018 16:17:25 -0300 Message-Id: <20180216191746.11095-21-acme@kernel.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180216191746.11095-1-acme@kernel.org> References: <20180216191746.11095-1-acme@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mathieu Poirier This patch frees all the memory allocated in function cs_etm__alloc_queue(). Signed-off-by: Mathieu Poirier Cc: Alexander Shishkin Cc: Jin Yao Cc: Namhyung Kim Cc: Peter Zijlstra Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1518467557-18505-2-git-send-email-mathieu.poirier@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/cs-etm.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.14.3 diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index b9f0a53dfa65..f2c98774e665 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -174,6 +174,12 @@ static void cs_etm__free_queue(void *priv) { struct cs_etm_queue *etmq = priv; + if (!etmq) + return; + + thread__zput(etmq->thread); + cs_etm_decoder__free(etmq->decoder); + zfree(&etmq->event_buf); free(etmq); } From patchwork Fri Feb 16 19:17:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 128632 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp908840ljc; Fri, 16 Feb 2018 11:35:36 -0800 (PST) X-Google-Smtp-Source: AH8x224DwZd3GKRS+QPy7kyH9lFfAeszN8fPZj2z+iw4kOb/fEDpQxPMgsGPeWV7CPx/NFNyGNjU X-Received: by 10.99.181.94 with SMTP id u30mr6036351pgo.205.1518809736519; Fri, 16 Feb 2018 11:35:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518809736; cv=none; d=google.com; s=arc-20160816; b=cJ+yYak45evG9jgWw87AnqDmk0N1isqWY9rtc4WvtpZoxtb70xvQ/jedIIwveqFG+d WcQegrIjgzb15VUjduQIYf6kJvgFVMHo0ZpIclXSrKYRr6AuWIZAznqbyjC9RvXI2Qi3 v9dE8X7yMS5aBLDEGJZ/NkHfnChquKrPBViNLbyBppIwXLv5ReHRqEcff2rOruzYAe0B ptchN5fjHWRzWTNOMIe2/zHngvExux6MyvgZS73+infLHDTazzNYSfmqvPXtNKzSBLYf BGm+K5qIQMCGAGFAUhZ3gJNf700sAkiZ/GIch9PS1RShiQYaTYM6u44tcb1DuARxK314 7BSg== 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:dmarc-filter:arc-authentication-results; bh=XdZMZk2fw0J0PHoO2Rguy3MCevWXqCWx9vC+VjOVU44=; b=eh0E4YTdBzswxIjS3kTA/BzEZ6tP46QD62egP4I24yUOXfSp5TPprU3FC9t8YYAtFa OfMblvZWeMSB1h07YgXuf1hAtRqGprBL4p0D8jHupvEC0x4LZmqRk0TZIawawzvgCoT6 DAv11VGtVkgxoohHb62ta6QlMww85sjBhYkGbXFddbDCU+oZNjjWFI5hSOV6d9Kh11Zt IhlwjmLabE62yT3q6mjOQUM5C0ayeEIOc+/9hoHORRUY/g1ABS3LdEFtKZ/PrFRlbtPx bwQhqx8iCvuMdsaNR7XQSZweeqqy8BxmrnBV3mWNzyfyGybQWz3Eql+rm/iL5Y/t8Ytd 4kEQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t1-v6si5166904plr.558.2018.02.16.11.35.36; Fri, 16 Feb 2018 11:35:36 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751364AbeBPTfc (ORCPT + 28 others); Fri, 16 Feb 2018 14:35:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:56532 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753684AbeBPTTT (ORCPT ); Fri, 16 Feb 2018 14:19:19 -0500 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5E198217C9; Fri, 16 Feb 2018 19:19:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E198217C9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=acme@kernel.org From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Mathieu Poirier , Alexander Shishkin , Jin Yao , Namhyung Kim , Peter Zijlstra , linux-arm-kernel@lists.infradead.org, Arnaldo Carvalho de Melo Subject: [PATCH 22/41] perf auxtrace arm: Fixing uninitialised variable Date: Fri, 16 Feb 2018 16:17:27 -0300 Message-Id: <20180216191746.11095-23-acme@kernel.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180216191746.11095-1-acme@kernel.org> References: <20180216191746.11095-1-acme@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mathieu Poirier When working natively on arm64 the compiler gets pesky and complains that variable 'i' is uninitialised, something that breaks the compilation. Here no further checks are needed since variable 'found_spe' can only be true if variable 'i' has been initialised as part of the for loop. Signed-off-by: Mathieu Poirier Cc: Alexander Shishkin Cc: Jin Yao Cc: Namhyung Kim Cc: Peter Zijlstra Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1518467557-18505-4-git-send-email-mathieu.poirier@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/arch/arm/util/auxtrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.14.3 diff --git a/tools/perf/arch/arm/util/auxtrace.c b/tools/perf/arch/arm/util/auxtrace.c index 2323581b157d..fa639e3e52ac 100644 --- a/tools/perf/arch/arm/util/auxtrace.c +++ b/tools/perf/arch/arm/util/auxtrace.c @@ -68,7 +68,7 @@ struct auxtrace_record bool found_spe = false; static struct perf_pmu **arm_spe_pmus = NULL; static int nr_spes = 0; - int i; + int i = 0; if (!evlist) return NULL; From patchwork Fri Feb 16 19:17:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 128631 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp895857ljc; Fri, 16 Feb 2018 11:19:38 -0800 (PST) X-Google-Smtp-Source: AH8x2248gOYAkPwcyZstUwOsB22zvFqc2kCj/Q58bcOe15h5LRVhruGhebR0ifsyIdw1T81jCO8p X-Received: by 10.101.77.69 with SMTP id j5mr928423pgt.352.1518808778728; Fri, 16 Feb 2018 11:19:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518808778; cv=none; d=google.com; s=arc-20160816; b=DTFR7QwJ7LV4T10mS0q4mXxWTAeQDqV+HXf/hnxrFM9dBt3FLx+WGI/GgdyG1g2cfW 00852TmyS/pzA1nMcq0wznLgEA2aQPb9tOtsvEN1aKW+4CMyxSlDHUmmeFM+YLYnrdo8 Kv7lgAEgZOyqD9HYTbtstf0suGMGdUBZm2NK/eUKMK4PzCQ0bNqEMwdh9QCw49L7kzi3 n/2WFJfxcMtWaaG3ZfMb+iuKvLvRD37/OjB+aynN56cV2bSpWF0E9DvFVF+tkwmBzwWh HldjoAKsKTrPnnt281l2LSAfj2OPvDUSQy8DDDxmqvHu65T7ZjBQA0YFEMAXwx7KJ9KS yjMA== 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:dmarc-filter:arc-authentication-results; bh=oIIBryZyCec3NoauUvF2QIGK6Ywg1eW/vve4FuC/qGA=; b=OZyJezP3ofNcbY+LwSvO907GFRgRzjKXnCYNVFTf/5SMhKIpOsuDlO5Q1sucKED8aK Xzbl/xh9ZX4bqECKjzJR+TZX4lSKXFKNVWgUjF9w7YMezBaK3J9Xtme4r5sDELxNVElh xkOr+/8hnn2f0Lba05AkejW/7cnNbLT7O1omy0XMnKbES6PiuNbk7C/g0iy9jqauFAkl 02Z2juBM6dp+ILY3J7kYiDHOtydW9NUYijdj3g+f31DF/AiRo4oErBVZVjcQvQOu8mU2 +bHfh3RL0D4SQrsFVtOnc/l149vWSP48Nd3bdnABZ1ECtmOwLJtGb5JE+wVhiI13EIVx JADA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u69si1455732pgd.619.2018.02.16.11.19.38; Fri, 16 Feb 2018 11:19:38 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753746AbeBPTT2 (ORCPT + 28 others); Fri, 16 Feb 2018 14:19:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:56568 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753677AbeBPTTX (ORCPT ); Fri, 16 Feb 2018 14:19:23 -0500 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AF71F217CB; Fri, 16 Feb 2018 19:19:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AF71F217CB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=acme@kernel.org From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Mathieu Poirier , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Peter Zijlstra , linux-arm-kernel@lists.infradead.org, Arnaldo Carvalho de Melo Subject: [PATCH 23/41] perf cs-etm: Properly deal with cpu maps Date: Fri, 16 Feb 2018 16:17:28 -0300 Message-Id: <20180216191746.11095-24-acme@kernel.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180216191746.11095-1-acme@kernel.org> References: <20180216191746.11095-1-acme@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mathieu Poirier This patch allows the CoreSight AUX info section to fit topologies where only a subset of all available CPUs are present, avoiding at the same time accessing the ETM configuration areas of CPUs that have been offlined. Signed-off-by: Mathieu Poirier Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1518478737-24649-1-git-send-email-mathieu.poirier@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/arch/arm/util/cs-etm.c | 51 +++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 15 deletions(-) -- 2.14.3 diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c index fbfc055d3f4d..5c655ad4621e 100644 --- a/tools/perf/arch/arm/util/cs-etm.c +++ b/tools/perf/arch/arm/util/cs-etm.c @@ -298,12 +298,17 @@ cs_etm_info_priv_size(struct auxtrace_record *itr __maybe_unused, { int i; int etmv3 = 0, etmv4 = 0; - const struct cpu_map *cpus = evlist->cpus; + struct cpu_map *event_cpus = evlist->cpus; + struct cpu_map *online_cpus = cpu_map__new(NULL); /* cpu map is not empty, we have specific CPUs to work with */ - if (!cpu_map__empty(cpus)) { - for (i = 0; i < cpu_map__nr(cpus); i++) { - if (cs_etm_is_etmv4(itr, cpus->map[i])) + if (!cpu_map__empty(event_cpus)) { + for (i = 0; i < cpu__max_cpu(); i++) { + if (!cpu_map__has(event_cpus, i) || + !cpu_map__has(online_cpus, i)) + continue; + + if (cs_etm_is_etmv4(itr, i)) etmv4++; else etmv3++; @@ -311,6 +316,9 @@ cs_etm_info_priv_size(struct auxtrace_record *itr __maybe_unused, } else { /* get configuration for all CPUs in the system */ for (i = 0; i < cpu__max_cpu(); i++) { + if (!cpu_map__has(online_cpus, i)) + continue; + if (cs_etm_is_etmv4(itr, i)) etmv4++; else @@ -318,6 +326,8 @@ cs_etm_info_priv_size(struct auxtrace_record *itr __maybe_unused, } } + cpu_map__put(online_cpus); + return (CS_ETM_HEADER_SIZE + (etmv4 * CS_ETMV4_PRIV_SIZE) + (etmv3 * CS_ETMV3_PRIV_SIZE)); @@ -447,7 +457,9 @@ static int cs_etm_info_fill(struct auxtrace_record *itr, int i; u32 offset; u64 nr_cpu, type; - const struct cpu_map *cpus = session->evlist->cpus; + struct cpu_map *cpu_map; + struct cpu_map *event_cpus = session->evlist->cpus; + struct cpu_map *online_cpus = cpu_map__new(NULL); struct cs_etm_recording *ptr = container_of(itr, struct cs_etm_recording, itr); struct perf_pmu *cs_etm_pmu = ptr->cs_etm_pmu; @@ -458,8 +470,21 @@ static int cs_etm_info_fill(struct auxtrace_record *itr, if (!session->evlist->nr_mmaps) return -EINVAL; - /* If the cpu_map is empty all CPUs are involved */ - nr_cpu = cpu_map__empty(cpus) ? cpu__max_cpu() : cpu_map__nr(cpus); + /* If the cpu_map is empty all online CPUs are involved */ + if (cpu_map__empty(event_cpus)) { + cpu_map = online_cpus; + } else { + /* Make sure all specified CPUs are online */ + for (i = 0; i < cpu_map__nr(event_cpus); i++) { + if (cpu_map__has(event_cpus, i) && + !cpu_map__has(online_cpus, i)) + return -EINVAL; + } + + cpu_map = event_cpus; + } + + nr_cpu = cpu_map__nr(cpu_map); /* Get PMU type as dynamically assigned by the core */ type = cs_etm_pmu->type; @@ -472,15 +497,11 @@ static int cs_etm_info_fill(struct auxtrace_record *itr, offset = CS_ETM_SNAPSHOT + 1; - /* cpu map is not empty, we have specific CPUs to work with */ - if (!cpu_map__empty(cpus)) { - for (i = 0; i < cpu_map__nr(cpus) && offset < priv_size; i++) - cs_etm_get_metadata(cpus->map[i], &offset, itr, info); - } else { - /* get configuration for all CPUs in the system */ - for (i = 0; i < cpu__max_cpu(); i++) + for (i = 0; i < cpu__max_cpu() && offset < priv_size; i++) + if (cpu_map__has(cpu_map, i)) cs_etm_get_metadata(i, &offset, itr, info); - } + + cpu_map__put(online_cpus); return 0; }