Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 25e41933 authored by Thomas Renninger's avatar Thomas Renninger Committed by Ingo Molnar
Browse files

perf: Clean up power events by introducing new, more generic ones



Add these new power trace events:

 power:cpu_idle
 power:cpu_frequency
 power:machine_suspend

The old C-state/idle accounting events:
  power:power_start
  power:power_end

Have now a replacement (but we are still keeping the old
tracepoints for compatibility):

  power:cpu_idle

and
  power:power_frequency

is replaced with:
  power:cpu_frequency

power:machine_suspend is newly introduced.

Jean Pihet has a patch integrated into the generic layer
(kernel/power/suspend.c) which will make use of it.

the type= field got removed from both, it was never
used and the type is differed by the event type itself.

perf timechart userspace tool gets adjusted in a separate patch.

Signed-off-by: default avatarThomas Renninger <trenn@suse.de>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Acked-by: default avatarArjan van de Ven <arjan@linux.intel.com>
Acked-by: default avatarJean Pihet <jean.pihet@newoldbits.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: rjw@sisk.pl
LKML-Reference: <1294073445-14812-3-git-send-email-trenn@suse.de>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
LKML-Reference: <1290072314-31155-2-git-send-email-trenn@suse.de>
parent 61a0d49c
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -373,6 +373,7 @@ void default_idle(void)
{
{
	if (hlt_use_halt()) {
	if (hlt_use_halt()) {
		trace_power_start(POWER_CSTATE, 1, smp_processor_id());
		trace_power_start(POWER_CSTATE, 1, smp_processor_id());
		trace_cpu_idle(1, smp_processor_id());
		current_thread_info()->status &= ~TS_POLLING;
		current_thread_info()->status &= ~TS_POLLING;
		/*
		/*
		 * TS_POLLING-cleared state must be visible before we
		 * TS_POLLING-cleared state must be visible before we
@@ -443,6 +444,7 @@ EXPORT_SYMBOL_GPL(cpu_idle_wait);
void mwait_idle_with_hints(unsigned long ax, unsigned long cx)
void mwait_idle_with_hints(unsigned long ax, unsigned long cx)
{
{
	trace_power_start(POWER_CSTATE, (ax>>4)+1, smp_processor_id());
	trace_power_start(POWER_CSTATE, (ax>>4)+1, smp_processor_id());
	trace_cpu_idle((ax>>4)+1, smp_processor_id());
	if (!need_resched()) {
	if (!need_resched()) {
		if (cpu_has(&current_cpu_data, X86_FEATURE_CLFLUSH_MONITOR))
		if (cpu_has(&current_cpu_data, X86_FEATURE_CLFLUSH_MONITOR))
			clflush((void *)&current_thread_info()->flags);
			clflush((void *)&current_thread_info()->flags);
@@ -459,6 +461,7 @@ static void mwait_idle(void)
{
{
	if (!need_resched()) {
	if (!need_resched()) {
		trace_power_start(POWER_CSTATE, 1, smp_processor_id());
		trace_power_start(POWER_CSTATE, 1, smp_processor_id());
		trace_cpu_idle(1, smp_processor_id());
		if (cpu_has(&current_cpu_data, X86_FEATURE_CLFLUSH_MONITOR))
		if (cpu_has(&current_cpu_data, X86_FEATURE_CLFLUSH_MONITOR))
			clflush((void *)&current_thread_info()->flags);
			clflush((void *)&current_thread_info()->flags);


@@ -480,10 +483,12 @@ static void mwait_idle(void)
static void poll_idle(void)
static void poll_idle(void)
{
{
	trace_power_start(POWER_CSTATE, 0, smp_processor_id());
	trace_power_start(POWER_CSTATE, 0, smp_processor_id());
	trace_cpu_idle(0, smp_processor_id());
	local_irq_enable();
	local_irq_enable();
	while (!need_resched())
	while (!need_resched())
		cpu_relax();
		cpu_relax();
	trace_power_end(0);
	trace_power_end(smp_processor_id());
	trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
}
}


/*
/*
+1 −1
Original line number Original line Diff line number Diff line
@@ -113,8 +113,8 @@ void cpu_idle(void)
			stop_critical_timings();
			stop_critical_timings();
			pm_idle();
			pm_idle();
			start_critical_timings();
			start_critical_timings();

			trace_power_end(smp_processor_id());
			trace_power_end(smp_processor_id());
			trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
		}
		}
		tick_nohz_restart_sched_tick();
		tick_nohz_restart_sched_tick();
		preempt_enable_no_resched();
		preempt_enable_no_resched();
+2 −0
Original line number Original line Diff line number Diff line
@@ -142,6 +142,8 @@ void cpu_idle(void)
			start_critical_timings();
			start_critical_timings();


			trace_power_end(smp_processor_id());
			trace_power_end(smp_processor_id());
			trace_cpu_idle(PWR_EVENT_EXIT,
				       smp_processor_id());


			/* In many cases the interrupt that ended idle
			/* In many cases the interrupt that ended idle
			   has already called exit_idle. But some idle
			   has already called exit_idle. But some idle
+1 −0
Original line number Original line Diff line number Diff line
@@ -355,6 +355,7 @@ void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state)
		dprintk("FREQ: %lu - CPU: %lu", (unsigned long)freqs->new,
		dprintk("FREQ: %lu - CPU: %lu", (unsigned long)freqs->new,
			(unsigned long)freqs->cpu);
			(unsigned long)freqs->cpu);
		trace_power_frequency(POWER_PSTATE, freqs->new, freqs->cpu);
		trace_power_frequency(POWER_PSTATE, freqs->new, freqs->cpu);
		trace_cpu_frequency(freqs->new, freqs->cpu);
		srcu_notifier_call_chain(&cpufreq_transition_notifier_list,
		srcu_notifier_call_chain(&cpufreq_transition_notifier_list,
				CPUFREQ_POSTCHANGE, freqs);
				CPUFREQ_POSTCHANGE, freqs);
		if (likely(policy) && likely(policy->cpu == freqs->cpu))
		if (likely(policy) && likely(policy->cpu == freqs->cpu))
+1 −0
Original line number Original line Diff line number Diff line
@@ -107,6 +107,7 @@ static void cpuidle_idle_call(void)
	if (cpuidle_curr_governor->reflect)
	if (cpuidle_curr_governor->reflect)
		cpuidle_curr_governor->reflect(dev);
		cpuidle_curr_governor->reflect(dev);
	trace_power_end(smp_processor_id());
	trace_power_end(smp_processor_id());
	trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
}
}


/**
/**
Loading