(CR): alarmtimer: add debug to identify alarmtimers

Based on KBA-200505201040

Print out timer wake-up info to debug the sources
of pm8xxx_rtc_alarm wake-ups.

Change-Id: I39f24dad0613a08844eefcd25076831589256e52
Signed-off-by: Ryan Lattrel <ryanl@motorola.com>
Reviewed-on: https://gerrit.mot.com/1668046
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Ling Jin <lingjin@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1778266
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
This commit is contained in:
Ryan Lattrel 2020-07-07 16:22:48 -05:00 • committed by Xiaojun Ji
commit bfcc95d87a
2 changed files with 23 additions and 0 deletions

View file

@ -238,6 +238,12 @@ static __poll_t timerfd_poll(struct file *file, poll_table *wait)
spin_lock_irqsave(&ctx->wqh.lock, flags);
if (ctx->ticks)
events |= EPOLLIN;
if (ctx->expired && isalarm(ctx))
pr_info("%s: comm:%s pid:%d exp:%llu\n", __func__,
current->comm, current->pid,
ktime_to_ms(ctx->t.alarm.node.expires));
spin_unlock_irqrestore(&ctx->wqh.lock, flags);
return events;

View file

@ -60,6 +60,7 @@ static struct wakeup_source *ws;
/* rtc timer and device for setting alarm wakeups at suspend */
static struct rtc_timer rtctimer;
static struct rtc_device *rtcdev;
static int alarm_debug = 0;
static DEFINE_SPINLOCK(rtcdev_lock);
/**
@ -215,6 +216,12 @@ static enum hrtimer_restart alarmtimer_fired(struct hrtimer *timer)
alarmtimer_dequeue(base, alarm);
spin_unlock_irqrestore(&base->lock, flags);
if(alarm_debug & 0x1){
pr_info("%s: type=%d, func=%pf, exp:%llu\n", __func__,
alarm->type, alarm->function, ktime_to_ms(alarm->node.expires));
alarm_debug &= 0xFE;
}
if (alarm->function)
restart = alarm->function(alarm, base->gettime());
@ -255,6 +262,7 @@ static int alarmtimer_suspend(struct device *dev)
struct rtc_device *rtc;
unsigned long flags;
struct rtc_time tm;
struct alarm* min_timer = NULL;
spin_lock_irqsave(&freezer_delta_lock, flags);
min = freezer_delta;
@ -281,6 +289,7 @@ static int alarmtimer_suspend(struct device *dev)
continue;
delta = ktime_sub(next->expires, base->gettime());
if (!min || (delta < min)) {
min_timer = container_of(next, struct alarm, node);
expires = next->expires;
min = delta;
type = i;
@ -289,6 +298,14 @@ static int alarmtimer_suspend(struct device *dev)
if (min == 0)
return 0;
if (min_timer){
pr_info("%s: [%p]type=%d, func=%pf, exp:%llu\n", __func__,
min_timer, min_timer->type, min_timer->function,
ktime_to_ms(min_timer->node.expires));
min_timer = NULL;
}
alarm_debug = 0x1;
if (ktime_to_ns(min) < 2 * NSEC_PER_SEC) {
__pm_wakeup_event(ws, 2 * MSEC_PER_SEC);
return -EBUSY;