diff --git a/include/trace/events/cpuhp.h b/include/trace/events/cpuhp.h index ad16f77310c6..f302ab6dbfb8 100644 --- a/include/trace/events/cpuhp.h +++ b/include/trace/events/cpuhp.h @@ -89,6 +89,28 @@ TRACE_EVENT(cpuhp_exit, __entry->cpu, __entry->state, __entry->idx, __entry->ret) ); +TRACE_EVENT(cpuhp_pause, + TP_PROTO(struct cpumask *cpus, u64 start_time, unsigned char pause), + + TP_ARGS(cpus, start_time, pause), + + TP_STRUCT__entry( + __field( unsigned int, cpus ) + __field( unsigned int, active_cpus ) + __field( unsigned int, time ) + __field( unsigned char, pause ) + ), + + TP_fast_assign( + __entry->cpus = cpumask_bits(cpus)[0]; + __entry->active_cpus = cpumask_bits(cpu_active_mask)[0]; + __entry->time = div64_u64(sched_clock() - start_time, 1000); + __entry->pause = pause; + ), + + TP_printk("req_cpus=0x%x act_cpus=0x%x time=%u us paused=%d", + __entry->cpus, __entry->active_cpus, __entry->time, __entry->pause) +); #endif /* This part must be outside protection */ diff --git a/kernel/cpu.c b/kernel/cpu.c index d7e6c5bac443..98087a6fd37f 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1135,6 +1135,9 @@ int pause_cpus(struct cpumask *cpus) { int err = 0; int cpu; + u64 start_time = 0; + + start_time = sched_clock(); cpu_maps_update_begin(); @@ -1232,6 +1235,8 @@ err_cpus_write_unlock: err_cpu_maps_update: cpu_maps_update_done(); + trace_cpuhp_pause(cpus, start_time, 1); + return err; } EXPORT_SYMBOL_GPL(pause_cpus); @@ -1240,6 +1245,9 @@ int resume_cpus(struct cpumask *cpus) { unsigned int cpu; int err = 0; + u64 start_time = 0; + + start_time = sched_clock(); cpu_maps_update_begin(); @@ -1298,6 +1306,8 @@ err_cpus_write_unlock: err_cpu_maps_update: cpu_maps_update_done(); + trace_cpuhp_pause(cpus, start_time, 0); + return err; } EXPORT_SYMBOL_GPL(resume_cpus);