mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: German Gomez <german.gomez@arm.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>, Leo Yan <leo.yan@linaro.org>
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Namhyung Kim <namhyung@kernel.org>,
	John Garry <john.garry@huawei.com>, Will Deacon <will@kernel.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/3] perf arm-spe: Track task context switch for cpu-mode events
Date: Mon, 8 Nov 2021 11:32:05 +0000	[thread overview]
Message-ID: <2d6b41a0-2ded-d8c8-630a-d418a0ef285a@arm.com> (raw)
In-Reply-To: <YYbcOmudBPDcLKMd@kernel.org>


On 06/11/2021 19:49, Arnaldo Carvalho de Melo wrote:
> Em Sat, Nov 06, 2021 at 11:29:07AM +0800, Leo Yan escreveu:
>> [...]
>> Reviewed-by: Leo Yan <leo.yan@linaro.org>
>>
>> Note for one thing, please keep "Namhyung Kim" as the author for this
>> patch, thanks.
> This merits a v2 submission, please do so.
>
> - Arnaldo
>  

Will do,

Also will fix the authorship of [2/3].

Thanks,
German

>> Leo
>>
>>> ---
>>>  tools/perf/arch/arm64/util/arm-spe.c |  6 +++++-
>>>  tools/perf/util/arm-spe.c            | 25 +++++++++++++++++++++++++
>>>  2 files changed, 30 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c
>>> index a4420d4df..58ba8d15c 100644
>>> --- a/tools/perf/arch/arm64/util/arm-spe.c
>>> +++ b/tools/perf/arch/arm64/util/arm-spe.c
>>> @@ -166,8 +166,12 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
>>>  	tracking_evsel->core.attr.sample_period = 1;
>>>  
>>>  	/* In per-cpu case, always need the time of mmap events etc */
>>> -	if (!perf_cpu_map__empty(cpus))
>>> +	if (!perf_cpu_map__empty(cpus)) {
>>>  		evsel__set_sample_bit(tracking_evsel, TIME);
>>> +		evsel__set_sample_bit(tracking_evsel, CPU);
>>> +		/* also track task context switch */
>>> +		tracking_evsel->core.attr.context_switch = 1;
>>> +	}
>>>  
>>>  	return 0;
>>>  }
>>> diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
>>> index 58b7069c5..230bc7ab2 100644
>>> --- a/tools/perf/util/arm-spe.c
>>> +++ b/tools/perf/util/arm-spe.c
>>> @@ -681,6 +681,25 @@ static int arm_spe_process_timeless_queues(struct arm_spe *spe, pid_t tid,
>>>  	return 0;
>>>  }
>>>  
>>> +static int arm_spe_context_switch(struct arm_spe *spe, union perf_event *event,
>>> +				  struct perf_sample *sample)
>>> +{
>>> +	pid_t pid, tid;
>>> +	int cpu;
>>> +
>>> +	if (!(event->header.misc & PERF_RECORD_MISC_SWITCH_OUT))
>>> +		return 0;
>>> +
>>> +	pid = event->context_switch.next_prev_pid;
>>> +	tid = event->context_switch.next_prev_tid;
>>> +	cpu = sample->cpu;
>>> +
>>> +	if (tid == -1)
>>> +		pr_warning("context_switch event has no tid\n");
>>> +
>>> +	return machine__set_current_tid(spe->machine, cpu, pid, tid);
>>> +}
>>> +
>>>  static int arm_spe_process_event(struct perf_session *session,
>>>  				 union perf_event *event,
>>>  				 struct perf_sample *sample,
>>> @@ -718,6 +737,12 @@ static int arm_spe_process_event(struct perf_session *session,
>>>  		}
>>>  	} else if (timestamp) {
>>>  		err = arm_spe_process_queues(spe, timestamp);
>>> +		if (err)
>>> +			return err;
>>> +
>>> +		if (event->header.type == PERF_RECORD_SWITCH_CPU_WIDE ||
>>> +		    event->header.type == PERF_RECORD_SWITCH)
>>> +			err = arm_spe_context_switch(spe, event, sample);
>>>  	}
>>>  
>>>  	return err;
>>> -- 
>>> 2.25.1
>>>

  reply	other threads:[~2021-11-08 11:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-02 18:07 [PATCH 0/3] perf arm-spe: Track pid/tid for Arm SPE samples German Gomez
2021-11-02 18:07 ` [PATCH 1/3] perf arm-spe: Track task context switch for cpu-mode events German Gomez
2021-11-06  3:29   ` Leo Yan
2021-11-06 19:49     ` Arnaldo Carvalho de Melo
2021-11-08 11:32       ` German Gomez [this message]
2021-11-02 18:07 ` [PATCH 2/3] perf arm-spe: Save context ID in record German Gomez
2021-11-06  3:32   ` Leo Yan
2021-11-06 13:47   ` Leo Yan
2021-11-09 10:41     ` German Gomez
2021-11-02 18:07 ` [PATCH 3/3] perf arm-spe: Support hardware-based PID tracing German Gomez
2021-11-06 14:57   ` Leo Yan
2021-11-09 11:15     ` German Gomez

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=2d6b41a0-2ded-d8c8-630a-d418a0ef285a@arm.com \
    --to=german.gomez@arm.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --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=mathieu.poirier@linaro.org \
    --cc=namhyung@kernel.org \
    --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

all inboxes | Powered by JetHome®