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

Commit 67847f22 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "cpuidle: menu: trace menu governor decisions"

parents 3d48305c 1f820e14
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -24,6 +24,15 @@ config CPU_IDLE_GOV_LADDER
config CPU_IDLE_GOV_MENU
	bool "Menu governor (for tickless system)"

config QGKI_MENU_GOV_DEBUG
	bool "Trace menu governor decisions"
	depends on QGKI && CPU_IDLE_GOV_MENU && FTRACE
	help
	  Trace menu governor decisions to help understand the system
	  state. The predicted sleep time, latency requirement for the
	  CPU and the idle state chosen based on the parameters are all
	  logged in the trace.

config CPU_IDLE_GOV_TEO
	bool "Timer events oriented (TEO) governor (for tickless systems)"
	help
+17 −0
Original line number Diff line number Diff line
@@ -18,6 +18,9 @@
#include <linux/sched/loadavg.h>
#include <linux/sched/stat.h>
#include <linux/math64.h>
#ifdef CONFIG_QGKI_MENU_GOV_DEBUG
#include <trace/events/power.h>
#endif

/*
 * Please note when changing the tuning values:
@@ -277,6 +280,9 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
{
	struct menu_device *data = this_cpu_ptr(&menu_devices);
	int latency_req = cpuidle_governor_latency_req(dev->cpu);
#ifdef CONFIG_QGKI_MENU_GOV_DEBUG
	int qos = latency_req;
#endif
	int i;
	int idx;
	unsigned int interactivity_req;
@@ -305,6 +311,9 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
		 * polling one.
		 */
		*stop_tick = !(drv->states[0].flags & CPUIDLE_FLAG_POLLING);
#ifdef CONFIG_QGKI_MENU_GOV_DEBUG
		trace_cpuidle_select(dev->cpu, 0, 0, *stop_tick, 0);
#endif
		return 0;
	}

@@ -393,6 +402,11 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
			    s->target_residency <= ktime_to_us(delta_next))
				idx = i;

#ifdef CONFIG_QGKI_MENU_GOV_DEBUG
			trace_cpuidle_select(dev->cpu, predicted_us, qos,
					     *stop_tick, idx);
#endif

			return idx;
		}
		if (s->exit_latency > latency_req)
@@ -433,6 +447,9 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
		}
	}

#ifdef CONFIG_QGKI_MENU_GOV_DEBUG
	trace_cpuidle_select(dev->cpu, predicted_us, qos, *stop_tick, idx);
#endif
	return idx;
}

+30 −0
Original line number Diff line number Diff line
@@ -40,6 +40,36 @@ DEFINE_EVENT(cpu, cpu_idle,
	TP_ARGS(state, cpu_id)
);

#ifdef CONFIG_QGKI_MENU_GOV_DEBUG
TRACE_EVENT(cpuidle_select,

	TP_PROTO(int cpu, long residency, unsigned int latency, bool tick,
		 int idx),

	TP_ARGS(cpu, residency, latency, tick, idx),

	TP_STRUCT__entry(
			 __field(int,  cpu)
			 __field(long, residency)
			 __field(u32,  latency)
			 __field(bool, tick)
			 __field(int,  idx)
	),

	TP_fast_assign(
		       __entry->cpu = cpu;
		       __entry->residency = residency;
		       __entry->latency = latency;
		       __entry->tick = tick;
		       __entry->idx = idx;
	),

	TP_printk("cpu: %d residency: %lld latency: %d tick: %d idx: %d",
		  __entry->cpu, __entry->residency, __entry->latency,
		  __entry->tick, __entry->idx)
);
#endif

TRACE_EVENT(powernv_throttle,

	TP_PROTO(int chip_id, const char *reason, int pmax),