public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mukesh Ojha <mojha@codeaurora.org>
To: John Stultz <john.stultz@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	lkml <linux-kernel@vger.kernel.org>,
	gkohli@codeaurora.org, cpandya@codeaurora.org,
	neeraju@codeaurora.org
Subject: Re: [PATCH v4] time: Fix extra sleeptime injection when suspend fails
Date: Tue, 17 Jul 2018 11:59:11 +0530	[thread overview]
Message-ID: <793798fc-4c5a-da9a-2ca4-35fc1c39eb00@codeaurora.org> (raw)
In-Reply-To: <CALAqxLVMaU4FJ1xu78ow=FwSbmQObw0-HGBUTpgr27vjKTOqrw@mail.gmail.com>



On 7/17/2018 2:31 AM, John Stultz wrote:
> On Mon, Jul 16, 2018 at 1:40 PM, Mukesh Ojha <mojha@codeaurora.org> wrote:
>> Currently, there exists a corner case assuming when there is
>> only one clocksource e.g RTC, and system failed to go to
>> suspend mode. While resume rtc_resume() injects the sleeptime
>> as timekeeping_rtc_skipresume() returned 'false' (default value
>> of sleeptime_injected) due to which we can see mismatch in
>> timestamps.
>>
>> This issue can also come in a system where more than one
>> clocksource are present and very first suspend fails.
>>
>> Fix this by handling the sleeptime_injected flag properly.
>>
>> Success case:
>> ------------
>>                                          {sleeptime_injected=false}
>> rtc_suspend() => timekeeping_suspend() => timekeeping_resume() =>
>>
>> (sleeptime injected)
>>   rtc_resume()
>>
>> Failure case:
>> ------------
>>           {failure in sleep path} {sleeptime_injected=false}
>> rtc_suspend()     =>          rtc_resume()
>>
>> sleeptime injected again which was not required as the suspend failed)
>>
>> Originally-by: Thomas Gleixner <tglx@linutronix.de>
>> Signed-off-by: Mukesh Ojha <mojha@codeaurora.org>
>> ---
>> Changes in V4:
>>   * Changes as suggested by John
>>      - Changed the variable name from sleeptime_injected to suspend_timing_needed
>>      - Changed the boolean logic.
> Thanks so much for reworking and resending this again!
>
>
>> diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
>> index d37588f..ee455cc 100644
>> --- a/drivers/rtc/class.c
>> +++ b/drivers/rtc/class.c
>> @@ -102,7 +102,7 @@ static int rtc_resume(struct device *dev)
>>          struct timespec64       sleep_time;
>>          int err;
>>
>> -       if (timekeeping_rtc_skipresume())
>> +       if (!timekeeping_rtc_skipresume())
>
> Hrm... So I'd have instead inverted the logic *in*
> timekeeping_rtc_skipresume(), rather then here,  but this looks to be
> close enough and I can fix that bit up.

Will take care of yours and Thomas comment in v5.

>
> Can you confirm you've validated this version of the patch resolves
> the issue you reported?
Yeah, I validated.

Thanks
Mukesh


>
> thanks
> -john


      reply	other threads:[~2018-07-17  6:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-16 20:40 [PATCH v4] time: Fix extra sleeptime injection when suspend fails Mukesh Ojha
2018-07-16 20:50 ` Thomas Gleixner
2018-07-17  6:19   ` Mukesh Ojha
2018-07-16 21:01 ` John Stultz
2018-07-17  6:29   ` Mukesh Ojha [this message]

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=793798fc-4c5a-da9a-2ca4-35fc1c39eb00@codeaurora.org \
    --to=mojha@codeaurora.org \
    --cc=cpandya@codeaurora.org \
    --cc=gkohli@codeaurora.org \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neeraju@codeaurora.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