linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Leo Yan <leo.yan@linaro.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Mike Leach <mike.leach@linaro.org>,
	John Garry <john.garry@huawei.com>, Will Deacon <will@kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>,
	linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] perf cs-etm: Pass -1 as pid value for machine__set_current_tid()
Date: Thu, 18 Nov 2021 10:14:12 -0700	[thread overview]
Message-ID: <20211118171412.GB2530497@p14s> (raw)
In-Reply-To: <20211113143540.53957-1-leo.yan@linaro.org>

Good morning Leo,

On Sat, Nov 13, 2021 at 10:35:40PM +0800, Leo Yan wrote:
> Currently, cs-etm passes the tid value for both tid and pid parameters
> when calling machine__set_current_tid(), this can lead to confusion for
> thread handling.  E.g. we arbitrarily pass the same value for pid and
> tid, perf tool will be misled to consider it is a main thread (see
> thread__main_thread()).
> 
> On the other hand, Perf tool only can retrieve tid from Arm CoreSight
> context packet, and we have no chance to know pid (it maps to kernel's
> task_struct::tgid) from hardware tracing data.  For this reason, this
> patch passes -1 as pid for function machine__set_current_tid().
> 
> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> ---
>  tools/perf/util/cs-etm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
> index f323adb1af85..eed1a5930072 100644
> --- a/tools/perf/util/cs-etm.c
> +++ b/tools/perf/util/cs-etm.c
> @@ -1118,7 +1118,7 @@ int cs_etm__etmq_set_tid(struct cs_etm_queue *etmq,
>  	if (cs_etm__get_cpu(trace_chan_id, &cpu) < 0)
>  		return err;
>  
> -	err = machine__set_current_tid(etm->machine, cpu, tid, tid);
> +	err = machine__set_current_tid(etm->machine, cpu, -1, tid);

I remember wondering about what to do with the pid parameter when I wrote this
patch... 

Do you have a before-and-after snapshot you can add to the changelog?  I also
think it will require a "Fixes" tag.  In your next revision please CC James
since you guys are working in that area nowadays.

Thanks,
Mathieu

>  	if (err)
>  		return err;
>  
> -- 
> 2.25.1
> 

  reply	other threads:[~2021-11-18 17:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-13 14:35 [PATCH v1] perf cs-etm: Pass -1 as pid value for machine__set_current_tid() Leo Yan
2021-11-18 17:14 ` Mathieu Poirier [this message]
2021-11-19  0:33   ` Leo Yan
2021-11-23  3:14   ` Leo Yan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211118171412.GB2530497@p14s \
    --to=mathieu.poirier@linaro.org \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=coresight@lists.linaro.org \
    --cc=john.garry@huawei.com \
    --cc=jolsa@redhat.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mike.leach@linaro.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).