From patchwork Tue Jun 11 18:58:33 2019 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: 166483 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2722854ilk; Tue, 11 Jun 2019 12:02:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqyqDxzHKYPyUEe5q/OTKrU14/JlI9uitHSJ7aOQXXCkK0zADpF/VISYjVUL/GgrZ7cG/tek X-Received: by 2002:a17:90a:1706:: with SMTP id z6mr27427105pjd.108.1560279777615; Tue, 11 Jun 2019 12:02:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560279777; cv=none; d=google.com; s=arc-20160816; b=ST+sCElm5QAdC+XhVDPQbaEOE+ZPfDRgCMRnrZ7foIeetBlp7LhYfL+STQE8w6Ar4F OPk1kSkgVKzzIE2azlLOaffiU85/ErUGQThP+O49x0mM09Na0BJP/z7wN5IieMw91yfp 4GMEpgTMTNiL6JnL+zjl3r0ZgE1t0KEKOU/p9UAzR1ordSMW0ulZ2J2VTkI3nUarEmMj R/l3YxzFg0gUB5CdvMYS4OS7z7LV6lKVqDNvmYFC2nSBp3LYKPwTMwQd5P9CSiMIpZkD SSF76WjXguuFxAu+autjfO5WUdYt4OVVqVHj/rS1/cFWE3pB5RDpxU8LvP7VQ9Ajk7Mb PluQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Tdl79xy/cLpa/gFg1+vOa1qybkadN7alouaH7TWt054=; b=I8CMDutiE6Dy3zbOTTsUizVIG2ewHTs94cLtaL8lNfr2w+rBWOuysLLXGgUxaCT4Uz YovUMlPOggFVpv/I+hJPqXwscZwa+cRL5nYS29xQ6ZbXONIYAzlSd6FU4T6FFFCJP7xY 1/a+qMKMzehYI88lFjz/2tT2GL4mCuNwfMWsToacA5kvBhegaQGBrJLU21s/dW2175pU 6uUnGwDKcJsXP9OnrtWHJTtJYhUuBkfahySYDfXNgs6oyoyetkNgobdoJp6XGEW2re1R Q0E6XxtOxnSrAhvOQDyNqTQOTClYqfLFVhlbmljZMiVyBaiyzMo90LegmVvwaEagMVLs hk1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=v9Q8vqfS; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d7si5393868plj.74.2019.06.11.12.02.56; Tue, 11 Jun 2019 12:02:57 -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=@kernel.org header.s=default header.b=v9Q8vqfS; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392423AbfFKTCz (ORCPT + 30 others); Tue, 11 Jun 2019 15:02:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:39050 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392010AbfFKTCy (ORCPT ); Tue, 11 Jun 2019 15:02:54 -0400 Received: from quaco.ghostprotocols.net (unknown [179.97.35.11]) (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 0EAE22183E; Tue, 11 Jun 2019 19:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560279773; bh=22JvqhMRFadlku1d18uzDdaZ+nanOpO9WyNtz0V2N0o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v9Q8vqfS6dvj1JpborORWGI2Xcu0YKv0IK6kPZ+NJBkxtkPBpC5dJclYkEolnuCSr AW5lmGtgpeHGrTEF9H7sjl1sjmimnMni6kfYop1djPAR7nyIWEg/KbEFj8dPBAQ/BK joH5DS1CIpHTl1jK3vUj+kKvrAliq/diDf1B89UY= From: Arnaldo Carvalho de Melo To: Ingo Molnar , Thomas Gleixner Cc: Jiri Olsa , Namhyung Kim , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Mathieu Poirier , Leo Yan , Alexander Shishkin , Jiri Olsa , Peter Zijlstra , Suzuki Poulouse , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, Arnaldo Carvalho de Melo Subject: [PATCH 47/85] perf cs-etm: Move thread to traceid_queue Date: Tue, 11 Jun 2019 15:58:33 -0300 Message-Id: <20190611185911.11645-48-acme@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611185911.11645-1-acme@kernel.org> References: <20190611185911.11645-1-acme@kernel.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mathieu Poirier The thread field of structure cs_etm_queue is CPU dependent and as such need to be part of the cs_etm_traceid_queue in order to support CPU-wide trace scenarios. 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-12-mathieu.poirier@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/cs-etm.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) -- 2.20.1 diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 531bbb355ba4..0d51d6d9a594 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -65,6 +65,7 @@ struct cs_etm_traceid_queue { u64 period_instructions; size_t last_branch_pos; union perf_event *event_buf; + struct thread *thread; struct branch_stack *last_branch; struct branch_stack *last_branch_rb; struct cs_etm_packet *prev_packet; @@ -74,7 +75,6 @@ struct cs_etm_traceid_queue { struct cs_etm_queue { struct cs_etm_auxtrace *etm; - struct thread *thread; struct cs_etm_decoder *decoder; struct auxtrace_buffer *buffer; unsigned int queue_nr; @@ -415,7 +415,7 @@ static void cs_etm__free_queue(void *priv) if (!etmq) return; - thread__zput(etmq->thread); + thread__zput(etmq->traceid_queues->thread); cs_etm_decoder__free(etmq->decoder); zfree(&etmq->traceid_queues->event_buf); zfree(&etmq->traceid_queues->last_branch); @@ -503,7 +503,7 @@ static u32 cs_etm__mem_access(struct cs_etm_queue *etmq, u64 address, machine = etmq->etm->machine; cpumode = cs_etm__cpu_mode(etmq, address); - thread = etmq->thread; + thread = etmq->traceid_queues->thread; if (!thread) { if (cpumode != PERF_RECORD_MISC_KERNEL) return 0; @@ -819,18 +819,21 @@ cs_etm__get_trace(struct cs_etm_queue *etmq) static void cs_etm__set_pid_tid_cpu(struct cs_etm_auxtrace *etm, struct auxtrace_queue *queue) { + struct cs_etm_traceid_queue *tidq; struct cs_etm_queue *etmq = queue->priv; + tidq = cs_etm__etmq_get_traceid_queue(etmq, CS_ETM_PER_THREAD_TRACEID); + /* CPU-wide tracing isn't supported yet */ if (queue->tid == -1) return; - if ((!etmq->thread) && (etmq->tid != -1)) - etmq->thread = machine__find_thread(etm->machine, -1, + if ((!tidq->thread) && (etmq->tid != -1)) + tidq->thread = machine__find_thread(etm->machine, -1, etmq->tid); - if (etmq->thread) - etmq->pid = etmq->thread->pid_; + if (tidq->thread) + etmq->pid = tidq->thread->pid_; } static int cs_etm__synth_instruction_sample(struct cs_etm_queue *etmq,