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

Commit 81d47999 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "cpu/hotplug: Add cpuhp_latency trace event"

parents c87cf542 0a293434
Loading
Loading
Loading
Loading
+28 −0
Original line number Original line Diff line number Diff line
@@ -88,6 +88,34 @@ TRACE_EVENT(cpuhp_exit,
		  __entry->cpu, __entry->state, __entry->idx,  __entry->ret)
		  __entry->cpu, __entry->state, __entry->idx,  __entry->ret)
);
);


TRACE_EVENT(cpuhp_latency,

	TP_PROTO(unsigned int cpu, unsigned int state,
		 u64 start_time,  int ret),

	TP_ARGS(cpu, state, start_time, ret),

	TP_STRUCT__entry(
		__field(unsigned int,	cpu)
		__field(unsigned int,	state)
		__field(u64,		time)
		__field(int,		ret)
	),

	TP_fast_assign(
		__entry->cpu	= cpu;
		__entry->state	= state;
		__entry->time	= div64_u64(sched_clock() - start_time, 1000);
		__entry->ret	= ret;
	),

	TP_printk(" cpu:%d state:%s latency:%llu USEC ret: %d",
		__entry->cpu, __entry->state ? "online" : "offline",
		__entry->time, __entry->ret)
);



#endif
#endif


/* This part must be outside protection */
/* This part must be outside protection */
+8 −0
Original line number Original line Diff line number Diff line
@@ -898,6 +898,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen,
	struct cpuhp_cpu_state *st = per_cpu_ptr(&cpuhp_state, cpu);
	struct cpuhp_cpu_state *st = per_cpu_ptr(&cpuhp_state, cpu);
	int prev_state, ret = 0;
	int prev_state, ret = 0;
	bool hasdied = false;
	bool hasdied = false;
	u64 start_time = 0;


	if (num_online_cpus() == 1)
	if (num_online_cpus() == 1)
		return -EBUSY;
		return -EBUSY;
@@ -909,6 +910,8 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen,
		return -EBUSY;
		return -EBUSY;


	cpu_hotplug_begin();
	cpu_hotplug_begin();
	if (trace_cpuhp_latency_enabled())
		start_time = sched_clock();


	cpuhp_tasks_frozen = tasks_frozen;
	cpuhp_tasks_frozen = tasks_frozen;


@@ -947,6 +950,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen,


	hasdied = prev_state != st->state && st->state == CPUHP_OFFLINE;
	hasdied = prev_state != st->state && st->state == CPUHP_OFFLINE;
out:
out:
	trace_cpuhp_latency(cpu, 0, start_time, ret);
	cpu_hotplug_done();
	cpu_hotplug_done();
	/* This post dead nonsense must die */
	/* This post dead nonsense must die */
	if (!ret && hasdied)
	if (!ret && hasdied)
@@ -1020,8 +1024,11 @@ static int _cpu_up(unsigned int cpu, int tasks_frozen, enum cpuhp_state target)
	struct cpuhp_cpu_state *st = per_cpu_ptr(&cpuhp_state, cpu);
	struct cpuhp_cpu_state *st = per_cpu_ptr(&cpuhp_state, cpu);
	struct task_struct *idle;
	struct task_struct *idle;
	int ret = 0;
	int ret = 0;
	u64 start_time = 0;


	cpu_hotplug_begin();
	cpu_hotplug_begin();
	if (trace_cpuhp_latency_enabled())
		start_time = sched_clock();


	if (!cpu_present(cpu)) {
	if (!cpu_present(cpu)) {
		ret = -EINVAL;
		ret = -EINVAL;
@@ -1069,6 +1076,7 @@ static int _cpu_up(unsigned int cpu, int tasks_frozen, enum cpuhp_state target)
	target = min((int)target, CPUHP_BRINGUP_CPU);
	target = min((int)target, CPUHP_BRINGUP_CPU);
	ret = cpuhp_up_callbacks(cpu, st, target);
	ret = cpuhp_up_callbacks(cpu, st, target);
out:
out:
	trace_cpuhp_latency(cpu, 1, start_time, ret);
	cpu_hotplug_done();
	cpu_hotplug_done();
	return ret;
	return ret;
}
}