Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp584267pxj; Thu, 10 Jun 2021 07:58:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfN6qJ8LwuV3p7j6cyjb6+KwlkI0L68LRNN9xGHcj8jWy83WyXNkSoMUMB9BfpuHiLQwz2 X-Received: by 2002:a50:fd89:: with SMTP id o9mr5223882edt.336.1623337087814; Thu, 10 Jun 2021 07:58:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623337087; cv=none; d=google.com; s=arc-20160816; b=WSb4FM+BGMR0JB95NnZxBaYBD2dgxxz2dSjF7QqkJiTYVvgV3xF3ldxMpK1vLFYiy4 OvCVndTA0qkqVzxta6GNoCBzLhRK9v+ewREOJfNNbFuk5daKz0iNLMdzoHfHmREItFGf tbFtVGHyLFkWrU28HrZ1KVyWNOGn1pk5jIgKg7KRCQgD7vyRRd3WaM5PYGvDhVkJeIM5 u9pxBy472oPWxEJOekkAaXPScyxuYCZDJGeG8hgDr7cWNABoS8zjJr+pzbH5MhsDVBZQ RUbKcnri/u5BIbk2mrgojN2J00S6Fr8R6+3nRHWsPtiy3vgNKtx+PPE99S8vILp/gx5M 9bzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=eCd+n05pEztZE0SL95FxVSFhmQVPpfX/x4nYO1Ax0qk=; b=qhg1VzbNCmjdCVEBMK5uzLm6NyL4buIoowWGhFkYGHHJydz0bbhvSeiTjfuJ8jjj78 sLUNt9zCR0iPrUK6sccFioUjpBmrCwEKZCHrpyZNYahlcZwj3Dvqt16jpS9VJT2SJ5R8 rAcoGjFdCsn5uE1i2cp/VUYFPlGZErKqVgWwwQa06dZgsJLmA4veDFyv1IdLvvgrVKHV DV77xPlXJlPHmYrAgqiGY669hAsFzAesgWPKpU84pqTAmmgEkesq3ji1gDmvZ4QzLDHs hvI2sj4SFMpk3BmvRmVKnnMb332hpXIg2Ti9qIVMgaulK2hzlg6O7/+lWJVwzwtGL/wu gNQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 24si2651974ejl.207.2021.06.10.07.57.43; Thu, 10 Jun 2021 07:58:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230445AbhFJO4Y (ORCPT + 99 others); Thu, 10 Jun 2021 10:56:24 -0400 Received: from foss.arm.com ([217.140.110.172]:33760 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230322AbhFJO4U (ORCPT ); Thu, 10 Jun 2021 10:56:20 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 48FB3106F; Thu, 10 Jun 2021 07:54:24 -0700 (PDT) Received: from [10.57.5.44] (unknown [10.57.5.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DA2023F719; Thu, 10 Jun 2021 07:54:21 -0700 (PDT) Subject: Re: [PATCH v1 1/3] coresight: etm-perf: Correct buffer syncing for snapshot To: Leo Yan Cc: Arnaldo Carvalho de Melo , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Alexander Shishkin , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Jiri Olsa , Namhyung Kim , Daniel Kiss , Denis Nikitin , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org References: <20210528161552.654907-1-leo.yan@linaro.org> <20210528161552.654907-2-leo.yan@linaro.org> <20210601103504.GC10026@leoy-ThinkPad-X240s> From: James Clark Message-ID: <71158b94-863d-97d3-323a-e2406b708db7@arm.com> Date: Thu, 10 Jun 2021 17:54:20 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210601103504.GC10026@leoy-ThinkPad-X240s> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/06/2021 13:35, Leo Yan wrote: > Hi James, > > On Tue, Jun 01, 2021 at 12:53:16PM +0300, James Clark wrote: > > [...] > >> Hi Leo, >> >> I was testing out snapshot mode (without your patch) and I noticed that it >> only ever collects from the last CPU. For example on a 4 core system, >> the CPU ID of the AUX records and the AUXTRACE buffers is always 3. >> >> This is with systemwide tracing, and running "stress -m 2 -c 2". >> Is this something that your patch fixes, or am I doing something wrong, or >> is it just a coincidence? > > No, I think it's quite likely caused by blow code: > > static unsigned long > tmc_update_etr_buffer(struct coresight_device *csdev, > struct perf_output_handle *handle, > void *config) > { > unsigned long flags, offset, size = 0; > > ... > > /* Don't do anything if another tracer is using this sink */ > if (atomic_read(csdev->refcnt) != 1) { > spin_unlock_irqrestore(&drvdata->spinlock, flags); > goto out; > } > > ... > > return size; > } > > When using the system wide tracing, it updates the AUX ring buffer > until the last tracer is stopped. Thus whis is why it only records > AUX ring buffer for the last CPU. > > But this makes sense for me, this is because the last CPU is used to > copy trace data to AUX ring buffer (so the perf event PERF_RECORD_AUX > occurs on CPU3), but when you decode the trace data, you should can > see the activities from other CPUs. > > Thanks, > Leo > I have one more issue around snapshot mode which I'd like to check if it's related to this patchset. In "[PATCH v5 0/1] perf cs-etm: Split Coresight decode by aux records", I added the warning for a missing AUXTRACE buffer as you suggested. Now this warning gets triggered on the last AUX record when using snapshot mode. I don't know if you are able to reproduce this. Thanks James