From patchwork Fri Dec 18 21:39:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 58761 Delivered-To: patches@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp1285535lbb; Fri, 18 Dec 2015 13:39:47 -0800 (PST) X-Received: by 10.66.101.36 with SMTP id fd4mr8798629pab.76.1450474771052; Fri, 18 Dec 2015 13:39:31 -0800 (PST) Return-Path: Received: from mail-pf0-x233.google.com (mail-pf0-x233.google.com. [2607:f8b0:400e:c00::233]) by mx.google.com with ESMTPS id da6si26324528pad.156.2015.12.18.13.39.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Dec 2015 13:39:31 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c00::233 as permitted sender) client-ip=2607:f8b0:400e:c00::233; Authentication-Results: mx.google.com; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c00::233 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dkim=pass header.i=@linaro.org Received: by mail-pf0-x233.google.com with SMTP id n128so37282472pfn.0 for ; Fri, 18 Dec 2015 13:39:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zy6uLkGKnQxTYFuB10GW80ZZowKrLOk72C22x/VLd2U=; b=fk2wIBxc3HKJ2FTDaNsxIe9ZOYkBGTOkSX3c4z5aCO8D5Ly1GO+VvJZsFNwbEQrIkk B9+griyi9E0rHhoJ9hUxCalF4ckMLvjsx810TQRFyKCrB/kns2POyGYpf8aeYZLNhs5y /yJL+4o6VEAldTRx0duNtBehCK5lrnKBunv3s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zy6uLkGKnQxTYFuB10GW80ZZowKrLOk72C22x/VLd2U=; b=bSYs9N308ifbFzZkz3eZvOQW6/Pn0UY+6VLssfYMrLRlJdh/XHl8nnQ4Hy7xPySovV 8CLkMu9bWoB6VovSY5b9FkE5Uqi4FcdbhM3oRFICwAZqIPD+RRJNafq/TjbaY8SYamsp /J6Ylwfs7GAmk7IZkcMgK6r9wr2jEYe/nX589HTosAQHO9dNssV8LDV/MlHXy3p1IzJx 93WOUxUy84usleZJZVFi6FZ6NT8/Hzi/E1QYnAAlX5mbwCa/BATvsAJ/BMfb0eVikvaB jLMAfoTTjsDz+DjpJ+7Yo5Razh9orhramesojY6mFHcg0oBVjWquIZEMQRw466CHNuT7 xzqQ== X-Gm-Message-State: ALoCoQne5mxr6TRAZZ68reKw/DqmiwPIKMHP/xFmyfFlY9OcIw/kmt2O/V1xRN/xNOJ9d6dGyEP0Byb7DoyVkT+R/xMJSBUd0g== X-Received: by 10.98.72.71 with SMTP id v68mr8575413pfa.17.1450474770741; Fri, 18 Dec 2015 13:39:30 -0800 (PST) Return-Path: Received: from localhost.localdomain (c-76-115-103-22.hsd1.or.comcast.net. [76.115.103.22]) by smtp.gmail.com with ESMTPSA id w62sm19642284pfi.48.2015.12.18.13.39.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Dec 2015 13:39:30 -0800 (PST) From: John Stultz To: lkml Cc: DengChao , Thomas Gleixner , Ingo Molnar , Miroslav Lichvar , Prarit Bhargava , Richard Cochran , John Stultz Subject: [PATCH 08/11] timekeeping: Provide internal function __ktime_get_real_seconds Date: Fri, 18 Dec 2015 13:39:13 -0800 Message-Id: <1450474756-10144-9-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1450474756-10144-1-git-send-email-john.stultz@linaro.org> References: <1450474756-10144-1-git-send-email-john.stultz@linaro.org> From: DengChao In order to fix Y2038 issues in the ntp code we will need replace get_seconds() with ktime_get_real_seconds() but as the ntp code uses the timekeeping lock which is also used by ktime_get_real_seconds(), we need a version without locking. Add a new function __ktime_get_real_seconds() in timekeeping to do this. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Miroslav Lichvar Cc: Prarit Bhargava Cc: Richard Cochran Reviewed-by: John Stultz Signed-off-by: DengChao Signed-off-by: John Stultz --- kernel/time/timekeeping.c | 13 +++++++++++++ kernel/time/timekeeping_internal.h | 2 ++ 2 files changed, 15 insertions(+) -- 1.9.1 diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index d9249da..21cc239 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -845,6 +845,19 @@ time64_t ktime_get_real_seconds(void) } EXPORT_SYMBOL_GPL(ktime_get_real_seconds); +/** + * __ktime_get_real_seconds - The same as ktime_get_real_seconds + * but without the sequence counter protect. This internal function + * is called just when timekeeping lock is already held. + */ +time64_t __ktime_get_real_seconds(void) +{ + struct timekeeper *tk = &tk_core.timekeeper; + + return tk->xtime_sec; +} + + #ifdef CONFIG_NTP_PPS /** diff --git a/kernel/time/timekeeping_internal.h b/kernel/time/timekeeping_internal.h index 4ea005a..e20466f 100644 --- a/kernel/time/timekeeping_internal.h +++ b/kernel/time/timekeeping_internal.h @@ -26,4 +26,6 @@ static inline cycle_t clocksource_delta(cycle_t now, cycle_t last, cycle_t mask) } #endif +extern time64_t __ktime_get_real_seconds(void); + #endif /* _TIMEKEEPING_INTERNAL_H */