Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1526455

Re: [PATCH 1/4] time: alarmtimer: Add the trcepoints for alarmtimer

From Baolin Wang <baolin.wang@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH 1/4] time: alarmtimer: Add the trcepoints for alarmtimer
Date 2016-11-21 09:50 +0100
Message-ID <sFSsx-7jA-5@gated-at.bofh.it> (permalink)
References <sF5UR-78-3@gated-at.bofh.it> <sF5UR-78-11@gated-at.bofh.it> <sFRZw-7a5-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Ingo,

On 21 November 2016 at 16:13, Ingo Molnar <mingo@kernel.org> wrote:
>
> * 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.)

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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL][PATCH 0/4] Timekeeping items for 4.10 John Stultz <john.stultz@linaro.org> - 2016-11-19 06:00 +0100
  [PATCH 3/4] timekeeping: Ignore the bogus sleep time if pm_trace is enabled John Stultz <john.stultz@linaro.org> - 2016-11-19 06:00 +0100
    Re: [PATCH 3/4] timekeeping: Ignore the bogus sleep time if pm_trace  is enabled Ingo Molnar <mingo@kernel.org> - 2016-11-21 09:20 +0100
      RE: [PATCH 3/4] timekeeping: Ignore the bogus sleep time if  pm_trace is enabled "Chen, Yu C" <yu.c.chen@intel.com> - 2016-11-24 11:00 +0100
  [PATCH 1/4] time: alarmtimer: Add the trcepoints for alarmtimer John Stultz <john.stultz@linaro.org> - 2016-11-19 06:00 +0100
    Re: [PATCH 1/4] time: alarmtimer: Add the trcepoints for alarmtimer Ingo Molnar <mingo@kernel.org> - 2016-11-21 09:20 +0100
      Re: [PATCH 1/4] time: alarmtimer: Add the trcepoints for alarmtimer Baolin Wang <baolin.wang@linaro.org> - 2016-11-21 09:50 +0100
        Re: [PATCH 1/4] time: alarmtimer: Add the trcepoints for  alarmtimer Thomas Gleixner <tglx@linutronix.de> - 2016-11-21 10:00 +0100
          Re: [PATCH 1/4] time: alarmtimer: Add the trcepoints for alarmtimer Baolin Wang <baolin.wang@linaro.org> - 2016-11-21 10:10 +0100
  [PATCH 2/4] selftests/timers: Fix spelling mistake "Asyncrhonous" -> "Asynchronous" John Stultz <john.stultz@linaro.org> - 2016-11-19 06:00 +0100

csiph-web