Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753434AbcKUIqg (ORCPT ); Mon, 21 Nov 2016 03:46:36 -0500 Received: from mail-yw0-f169.google.com ([209.85.161.169]:34218 "EHLO mail-yw0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753271AbcKUIqf (ORCPT ); Mon, 21 Nov 2016 03:46:35 -0500 MIME-Version: 1.0 In-Reply-To: <20161121081301.GA14231@gmail.com> References: <1479531014-25264-1-git-send-email-john.stultz@linaro.org> <1479531014-25264-2-git-send-email-john.stultz@linaro.org> <20161121081301.GA14231@gmail.com> From: Baolin Wang Date: Mon, 21 Nov 2016 16:46:34 +0800 Message-ID: Subject: Re: [PATCH 1/4] time: alarmtimer: Add the trcepoints for alarmtimer To: Ingo Molnar Cc: John Stultz , lkml , Thomas Gleixner , Richard Cochran , Steven Rostedt Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1788 Lines: 60 Hi Ingo, On 21 November 2016 at 16:13, Ingo Molnar wrote: > > * John Stultz 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.) Make sense. I will send out new patch to fix this. Thanks for your comments. > > That would disambiguate the freezer_delta special case in the trace. > > (Unless I missed something.) > > Thanks, > > Ingo -- Baolin.wang Best Regards