All of lore.kernel.org
 help / color / mirror / Atom feed
From: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
To: yangjihong <yangjihong@bytedance.com>
Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
	namhyung@kernel.org, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@kernel.org,
	irogers@google.com, adrian.hunter@intel.com,
	kan.liang@linux.intel.com, james.clark@arm.com,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	Madadi Vineeth Reddy <vineethr@linux.ibm.com>
Subject: RE: [PATCH v2] perf sched timehist: Fixed timestamp error when unable to confirm event sched_in time
Date: Wed, 21 Aug 2024 15:58:15 +0530	[thread overview]
Message-ID: <ab337b83-ac74-43ce-83f0-25885c136574@linux.ibm.com> (raw)
In-Reply-To: <CAPePreJCahzH0LwfXN_X+UdxU54_UMRPZgDgGqt7+PC+ky997Q@mail.gmail.com>

Hi Yang Jihong,

On 21/08/24 11:46, yangjihong wrote:
> Hello,
> 
> On 2024/8/21 2:00, Madadi Vineeth Reddy wrote:
>> Hi Yang Jihong,
>>
>> On 19/08/24 08:17, Yang Jihong wrote:
>>> If sched_in event for current task is not recorded, sched_in timestamp
>>> will be set to end_time of time window interest, causing an error in
>>> timestamp show. In this case, we choose to ignore this event.
>>>
>>
>> Why sched-in is not happening for the perf task continuously
>>
>> perf sched record -a sleep 5
>>
>> perf sched script
>> perf 19593 [000] 42668.450179: sched:sched_stat_runtime: comm=perf
> pid=19593 runtime=69449 [ns] vruntime=7303687 [ns]
>> perf 19593 [000] 42668.450190: sched:sched_stat_runtime: comm=perf
> pid=19593 runtime=6039 [ns] vruntime=7309726 [ns]
>> perf 19593 [000] 42668.450191: sched:sched_waking: comm=migration/0
> pid=19 prio=0 target_cpu=000
>> perf 19593 [000] 42668.450192: sched:sched_stat_runtime: comm=perf
> pid=19593 runtime=2397 [ns] vruntime=7312123 [ns]
>> perf 19593 [000] 42668.450193: sched:sched_switch: perf:19593 [120] R ==>
> migration/0:19 [0]
>> migration/0 19 [000] 42668.450195: sched:sched_migrate_task: comm=perf
> pid=19593 prio=120 orig_cpu=0 dest_cpu=1
>> migration/0 19 [000] 42668.450200: sched:sched_switch: migration/0:19 [0]
> S ==> swapper/0:0 [120]
>> perf 19593 [001] 42668.450308: sched:sched_stat_runtime: comm=perf
> pid=19593 runtime=112515 [ns] vruntime=9972397 [ns]
>> perf 19593 [001] 42668.450311: sched:sched_waking: comm=migration/1
> pid=24 prio=0 target_cpu=001
>> perf 19593 [001] 42668.450313: sched:sched_stat_runtime: comm=perf
> pid=19593 runtime=4690 [ns] vruntime=9977087 [ns]
>> perf 19593 [001] 42668.450314: sched:sched_switch: perf:19593 [120] R ==>
> migration/1:24 [0]
>> migration/1 24 [001] 42668.450316: sched:sched_migrate_task: comm=perf
> pid=19593 prio=120 orig_cpu=1 dest_cpu=2
>> migration/1 24 [001] 42668.450322: sched:sched_switch: migration/1:24 [0]
> S ==> swapper/1:0 [120]
>> perf 19593 [002] 42668.450385: sched:sched_stat_runtime: comm=perf
> pid=19593 runtime=67379 [ns] vruntime=2885994 [ns]
>> perf 19593 [002] 42668.450389: sched:sched_waking: comm=migration/2
> pid=30 prio=0 target_cpu=002
>> perf 19593 [002] 42668.450391: sched:sched_stat_runtime: comm=perf
> pid=19593 runtime=5526 [ns] vruntime=2891520 [ns]
>> perf 19593 [002] 42668.450392: sched:sched_switch: perf:19593 [120] R ==>
> migration/2:30 [0]
>>
>> The perf task (PID 19593) is being switched out without being switched in
> after CPU migration. The task migrates to a different CPU,
>> and then immediately switches out without a sched_in event in between.
>>
> Because the perf tool sets CPU affinity first (which causes perf process
> to migrate to the target core) and then enables events, by the time
> starts recording, task is likely to have migrated to the target core and
> started running. In this case, the sched_in event is not recorded.
> 

Got it. Thanks for the explanation!

Thanks and Regards
Madadi Vineeth Reddy

> Thanks,
> Yang
> 


      parent reply	other threads:[~2024-08-21 10:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-19  2:47 [PATCH v2] perf sched timehist: Fixed timestamp error when unable to confirm event sched_in time Yang Jihong
2024-08-19 20:08 ` Namhyung Kim
2024-08-30 13:32   ` Arnaldo Carvalho de Melo
2024-08-20 18:00 ` Madadi Vineeth Reddy
     [not found]   ` <CAPePreJCahzH0LwfXN_X+UdxU54_UMRPZgDgGqt7+PC+ky997Q@mail.gmail.com>
2024-08-21 10:28     ` Madadi Vineeth Reddy [this message]

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=ab337b83-ac74-43ce-83f0-25885c136574@linux.ibm.com \
    --to=vineethr@linux.ibm.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=james.clark@arm.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=yangjihong@bytedance.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.