#include <linux/sched/sysctl.h>
#include <linux/sched/rt.h>
#include <linux/timer.h>
+#include <linux/freezer.h>
#include <asm/uaccess.h>
#include <trace/events/timer.h>
+#include <linux/mt_sched_mon.h>
+
+//#define MTK_HRTIME_DEBUG /*MTK debug func*/
/*
* The timer bases:
*
goto again;
}
timer->base = new_base;
+ } else {
+ if (cpu != this_cpu && hrtimer_check_target(timer, new_base)) {
+ cpu = this_cpu;
+ goto again;
+ }
}
return new_base;
}
struct hrtimer_clock_base *base, *new_base;
unsigned long flags;
int ret, leftmost;
-
+ /*add MTK debug log for ALPS01804694*/
+ if(timer->function == NULL) {
+ pr_alert("add hrtimer but do nothing");
+ dump_stack();
+ }
+
base = lock_hrtimer_base(timer, &flags);
/* Remove an active timer from the queue: */
ret = remove_hrtimer(timer, base);
- /* Switch the timer base, if necessary: */
- new_base = switch_hrtimer_base(timer, base, mode & HRTIMER_MODE_PINNED);
-
if (mode & HRTIMER_MODE_REL) {
- tim = ktime_add_safe(tim, new_base->get_time());
+ tim = ktime_add_safe(tim, base->get_time());
/*
* CONFIG_TIME_LOW_RES is a temporary way for architectures
* to signal that they simply return xtime in
hrtimer_set_expires_range_ns(timer, tim, delta_ns);
+ /* Switch the timer base, if necessary: */
+ new_base = switch_hrtimer_base(timer, base, mode & HRTIMER_MODE_PINNED);
+
timer_stats_hrtimer_set_start_info(timer);
leftmost = enqueue_hrtimer(timer, new_base);
}
EXPORT_SYMBOL_GPL(hrtimer_get_res);
+#ifdef MTK_HRTIME_DEBUG
+static void dump_hrtimer_callinfo(struct hrtimer *timer)
+{
+
+ char symname[KSYM_NAME_LEN];
+ if (lookup_symbol_name((unsigned long)(timer->function), symname) < 0) {
+ pr_err("timer info1: state/%lx, func/%pK\n",
+ timer->state, timer->function);
+ } else {
+ pr_err("timer info2: state/%lx, func/%s\n",
+ timer->state, symname);
+ }
+
+ #ifdef CONFIG_TIMER_STATS
+ if (lookup_symbol_name((unsigned long)(timer->start_site),
+ symname) < 0) {
+ pr_err("timer stats1: pid/%d(%s), site/%pK\n",
+ timer->start_pid, timer->start_comm, timer->start_site);
+ } else {
+ pr_err("timer stats2: pid/%d(%s), site/%s\n",
+ timer->start_pid, timer->start_comm, symname);
+ }
+ #endif
+}
+#endif
static void __run_hrtimer(struct hrtimer *timer, ktime_t *now)
{
struct hrtimer_clock_base *base = timer->base;
*/
raw_spin_unlock(&cpu_base->lock);
trace_hrtimer_expire_entry(timer, now);
+
+ mt_trace_hrt_start(fn);
restart = fn(timer);
+ mt_trace_hrt_end(fn);
trace_hrtimer_expire_exit(timer);
raw_spin_lock(&cpu_base->lock);
t->task = NULL;
if (likely(t->task))
- schedule();
+ freezable_schedule();
hrtimer_cancel(&t->timer);
mode = HRTIMER_MODE_ABS;