linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: John Stultz <john.stultz@linaro.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Baolin Wang <baolin.wang@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Richard Cochran <richardcochran@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH 1/4] time: alarmtimer: Add the trcepoints for alarmtimer
Date: Mon, 21 Nov 2016 09:13:01 +0100	[thread overview]
Message-ID: <20161121081301.GA14231@gmail.com> (raw)
In-Reply-To: <1479531014-25264-2-git-send-email-john.stultz@linaro.org>


* John Stultz <john.stultz@linaro.org> wrote:

> @@ -222,7 +226,7 @@ static int alarmtimer_suspend(struct device *dev)
>  	ktime_t min, now;
>  	unsigned long flags;
>  	struct rtc_device *rtc;
> -	int i;
> +	int i, type = 0;
>  	int ret;
>  
>  	spin_lock_irqsave(&freezer_delta_lock, flags);
> @@ -247,8 +251,10 @@ static int alarmtimer_suspend(struct device *dev)
>  		if (!next)
>  			continue;
>  		delta = ktime_sub(next->expires, base->gettime());
> -		if (!min.tv64 || (delta.tv64 < min.tv64))
> +		if (!min.tv64 || (delta.tv64 < min.tv64)) {
>  			min = delta;
> +			type = i;
> +		}
>  	}
>  	if (min.tv64 == 0)
>  		return 0;
> @@ -264,6 +270,8 @@ static int alarmtimer_suspend(struct device *dev)
>  	now = rtc_tm_to_ktime(tm);
>  	now = ktime_add(now, min);
>  
> +	trace_alarmtimer_suspend(now, type);
> +
>  	/* Set alarm, if in the past reject suspend briefly to handle */
>  	ret = rtc_timer_start(rtc, &rtctimer, now, ktime_set(0, 0));
>  	if (ret < 0)

Hm, there's a weirdness here: if freezer_delta != 0 when alarmtimer_suspend() is 
called then type might be '0', although it's not alarm_bases[0] this value is 
picked up from.

Wouldn't it be better to initialize 'type' to -1 instead? (And rename it to 
min_type or so.)

That would disambiguate the freezer_delta special case in the trace.

(Unless I missed something.)

Thanks,

	Ingo

  reply	other threads:[~2016-11-21  8:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-19  4:50 [GIT PULL][PATCH 0/4] Timekeeping items for 4.10 John Stultz
2016-11-19  4:50 ` [PATCH 1/4] time: alarmtimer: Add the trcepoints for alarmtimer John Stultz
2016-11-21  8:13   ` Ingo Molnar [this message]
2016-11-21  8:46     ` Baolin Wang
2016-11-21  8:56       ` Thomas Gleixner
2016-11-21  9:02         ` Baolin Wang
2016-11-19  4:50 ` [PATCH 2/4] selftests/timers: Fix spelling mistake "Asyncrhonous" -> "Asynchronous" John Stultz
2016-11-19  4:50 ` [PATCH 3/4] timekeeping: Ignore the bogus sleep time if pm_trace is enabled John Stultz
2016-11-21  8:17   ` Ingo Molnar
2016-11-24  9:54     ` Chen, Yu C
2016-11-28 18:39       ` John Stultz
2016-11-28 23:45         ` Chen, Yu C
2016-11-19  4:50 ` [PATCH 4/4] timekeeping: clocksource_cyc2ns: Document intended range limitation John Stultz
2016-11-21  8:54   ` Ingo Molnar
2016-11-21 15:28     ` Chris Metcalf
2016-11-21 22:06       ` John Stultz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161121081301.GA14231@gmail.com \
    --to=mingo@kernel.org \
    --cc=baolin.wang@linaro.org \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).