Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3152087imm; Tue, 29 May 2018 01:52:53 -0700 (PDT) X-Google-Smtp-Source: AB8JxZof27Hzbqy+cYa9NYWl+f+7KRw+jnh8U15+EmFshJ1IhvPrLunpouXde27W1r/o5Py4jxk1 X-Received: by 2002:a17:902:bb8d:: with SMTP id m13-v6mr13577721pls.46.1527583973651; Tue, 29 May 2018 01:52:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527583973; cv=none; d=google.com; s=arc-20160816; b=tGxOKlVVrL+7AJWesxnI0EqjJ8NHcu4MkPnJKpD5Fk84sMiw9Agr01KlJnB2253XaB /ufjzsop13hsFMYLBP3uvV+Mvkj+llEFqnzIm9t18fyxQMgvWsixAwSFsCNY720MozxD axriY/r7Tt/jd8l3YnjlhtS0dqkGmseozAoUYAjs0y+hh3XUXWAtlvhCLVKCQU6E8spE J9p4gl8qtsfxxneLCX8741G87JfmnHqpu0HKwRtATiQqmnWKqGfPbfxxnQAras0ufi// SR0OzE9GogcwQB61wbG3LdWe4+v9jpIQZrCVp8xInr/QxoN/WSh67cHD3ib6WmZ2DycK N7Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=fAK7aPZNZH70E1RLJottgpG4OWNwba85SAFwe/jKYvg=; b=W37VtBzMpCnEq9eddn59NU/QsRqKzu5EzVZUFFOmolos++HyydRz1pEYXa/r8CCMYm EjBQApO9s3bDdtn+YZEFRmtUtedsxOHZG/MqGnGc7Rtemg+sYW6QZQmnw6blRpIEFjUh orRRdKv/OLSpPp8MdERBzRQ6k6u+7h7WTKov3y1fRVff8dslZxPBjDXwkqWyBWsqC3Rt sAztHhL4Xk2oC0tCtbH9/p7kQT1Oeju/ZMn7Q+/NjzP1sxi1HXlHL3OjaPtonW8r5/o0 YkYBReebi3nNsYBTUxEOLMJK0I5Rs2n6RbQP+TaTnenKixwCh4AgPQeji434v495qOas WqJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XLbBL4OV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 5-v6si32615651plx.517.2018.05.29.01.52.39; Tue, 29 May 2018 01:52:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XLbBL4OV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932562AbeE2Iua (ORCPT + 99 others); Tue, 29 May 2018 04:50:30 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:34420 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755356AbeE2IsW (ORCPT ); Tue, 29 May 2018 04:48:22 -0400 Received: by mail-pg0-f68.google.com with SMTP id k2-v6so6285544pgc.1 for ; Tue, 29 May 2018 01:48:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=fAK7aPZNZH70E1RLJottgpG4OWNwba85SAFwe/jKYvg=; b=XLbBL4OVM/FFjkGlkkaCQTvjBiKbsUtaWvql7w6iWvaeY/CJEfHM0/Gs1c4UnatinO TT3t5OUULVfvb/zNyGPVaMpH+NVMhZKM8D2jw7hKR29v/dgwsr2R8wwWRigYBdmRh7Dd wCHiLv8029gk/F5Kcpj6/YKAlIC5R4N6zHSVM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=fAK7aPZNZH70E1RLJottgpG4OWNwba85SAFwe/jKYvg=; b=U9eArEF4PHT39tlMsByC4ZL3qVcACueywHxvyy6VeEaFzoqIq/1Cl/hFDLeQAqrfyH Joh5LmZOxWVsQQ2v2ZKg51jymM+ZJh/4rzsAfiGPM7xN8IvJOj7HDLbgDR9AWoEcLO3a lHo/9oqODpcL7nJzKic3nUaNLlHDnQzOml1aQS/h+PvqY+Gtln3eQfVe5RdO0DgA6Y7l rmzL5+nv0JsR3kzmSZDQqNl05xhlRF3kqurkKObqVxO76tsiTXUlX2vgO+vYW/UTtU5l LlpFCwxH81k6tjwIuu1lI7+ccgDkwSI7CF7wTcY8OcoJr6i1o8TAJk1ozsG95BFw5DrE gVAg== X-Gm-Message-State: ALKqPwcafVtLlWW6nB0U1mYIvTKfcd+7QZ9F2K8CvLYyi7QvS2/8wOc0 JVyjm6Qj0V7j31NFjWhDeCpu+w== X-Received: by 2002:a62:5841:: with SMTP id m62-v6mr16356223pfb.116.1527583701775; Tue, 29 May 2018 01:48:21 -0700 (PDT) Received: from localhost ([122.167.97.238]) by smtp.gmail.com with ESMTPSA id a23-v6sm26853065pfk.71.2018.05.29.01.48.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 May 2018 01:48:21 -0700 (PDT) Date: Tue, 29 May 2018 14:18:19 +0530 From: Vinod Koul To: Mukesh Ojha Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] time: Fix sleeptime injection for non-stop clocksource & persistent clock Message-ID: <20180529084819.GI5666@vkoul-mobl> References: <1527581718-5624-1-git-send-email-mojha@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1527581718-5624-1-git-send-email-mojha@codeaurora.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29-05-18, 13:45, Mukesh Ojha wrote: > Currently, for both non-stop clocksource and persistent clock > there is a corner case, when a driver failed to go suspend mode > rtc_resume injects the sleeptime as timekeeping_rtc_skipresume > returned 'false' due to which we can see mismatch in time with > system clock. > > Success case: > {sleeptime_injected=true} > rtc_suspend() => timekeeping_suspend() => timekeeping_resume() => rtc_resume() > > Failure case: > {failure in sleep path} {sleeptime_injected=false} > rtc_suspend() => rtc_resume() > > Change-Id: I98928761c98cec21a3033a55d3e10fb34138f38c This does not belong in upstream please remove. I think checkpatch warns. Also I see that you have sent to lkml and arm-msm mailing list, but have not CCed any maintainers. Please run ./scripts/get_maintainer.pl to find who to send patches to. Chances are it will get ignored... > Signed-off-by: Mukesh Ojha > --- > kernel/time/timekeeping.c | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > > diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c > index 427e33d..c022d82 100644 > --- a/kernel/time/timekeeping.c > +++ b/kernel/time/timekeeping.c > @@ -1511,9 +1511,6 @@ void __weak read_boot_clock64(struct timespec64 *ts) > ts->tv_nsec = 0; > } > > -/* Flag for if timekeeping_resume() has injected sleeptime */ > -static bool sleeptime_injected; > - > /* Flag for if there is a persistent clock on this platform */ > static bool persistent_clock_exists; > > @@ -1611,7 +1608,14 @@ static void __timekeeping_inject_sleeptime(struct timekeeper *tk, > */ > bool timekeeping_rtc_skipresume(void) > { > - return sleeptime_injected; > + struct timekeeper *tk = &tk_core.timekeeper; > + bool skip_rtc_resume = false; > + > + skip_rtc_resume = ((tk->tkr_mono.clock->flags & > + CLOCK_SOURCE_SUSPEND_NONSTOP) || > + (persistent_clock_exists)) ? true : false; > + > + return skip_rtc_resume; > } > > /** > @@ -1671,8 +1675,8 @@ void timekeeping_resume(void) > unsigned long flags; > struct timespec64 ts_new, ts_delta; > cycle_t cycle_now, cycle_delta; > + bool sleeptime_injected = false; > > - sleeptime_injected = false; > read_persistent_clock64(&ts_new); > > clockevents_resume(); > -- > Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, > Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project > > -- > To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- ~Vinod