From patchwork Sun Dec 13 04:24:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deng Chao X-Patchwork-Id: 58316 Delivered-To: patch@linaro.org Received: by 10.112.73.68 with SMTP id j4csp768331lbv; Sat, 12 Dec 2015 20:25:11 -0800 (PST) X-Received: by 10.66.253.5 with SMTP id zw5mr36581855pac.100.1449980711008; Sat, 12 Dec 2015 20:25:11 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id la15si8831250pab.205.2015.12.12.20.25.10; Sat, 12 Dec 2015 20:25:10 -0800 (PST) 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; 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; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751654AbbLMEZH (ORCPT + 28 others); Sat, 12 Dec 2015 23:25:07 -0500 Received: from mail-pf0-f181.google.com ([209.85.192.181]:36737 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751345AbbLMEZE (ORCPT ); Sat, 12 Dec 2015 23:25:04 -0500 Received: by pfbu66 with SMTP id u66so43279728pfb.3 for ; Sat, 12 Dec 2015 20:25:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NGUVpkLuRpfsaZp42bTChaS7FsStv5XoU9nSp/5cNlo=; b=Wg6IF43+j/4/miAxU15NcvLRJKHkeeqNCbaxjkKRCYmZz/LJ2a330YFxws2IhMa6rW lg8tkpInyZII9kKvi32KSxnxLeamdzN6tFAlHhL7R5AYSIg20J4fFpw3C5j2OyBdsf2H Y1NW1AgBrUyu0OUt6+sPIVCj2szTBtszhzBu4JMHcMeebD5UdHOUikShRVX1suzUceEM IYDb8H+GUtysLTs2bpihQb4OUcxF9aPONdtMW3nHNSiXzgF9P0qGTSjLaaxIwXlZMpRf yXvMcOtN1NVQkn7kMZNjni09TYj8mjH8lAq5bRr0avyb37djJpev2Gp3FnbbJQ0Yb+Ud N9ww== 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=NGUVpkLuRpfsaZp42bTChaS7FsStv5XoU9nSp/5cNlo=; b=f4UdTLJV/NYuEp6TgyUt/5Qp2nn2XKSc3FWR0FtUXfvCZF2MsE1m1+Ltb4pYn8GlqB 5NrVqek6OW+6dY5NprBV5DlPxLU/BinkHVil6eFYK5h6uQfc418NSq1y3sUoP5Nu8ZFY b3RCTPmJDXCRk4/vkp44hUdNbCRB7g6a0YcrcnAIOWojDQ8Tnxy2V3g2x5IckTXoEsHD RmKVI/0XPhkevwSJp4HwuHikMd+ALS6xEWvhfXKXtjki6kTFCjdBK09V3JVdAGgaLxUG cHsz9S56bhegjDOepkvi6q3PrcnhJKxsTkBRMrZpBfrOY659zMfF9idA1rZa9wFudTXO k+HA== X-Gm-Message-State: ALoCoQmgr0zeecENLfPmzBtXIg6N1pMtr4L5B3C5kbnG8WDQgVF1Y9Nyz8nKPa+AdrOqf8srnQO/vV003iqogj31Vzj+Sy5MCA== X-Received: by 10.98.42.150 with SMTP id q144mr5828864pfq.81.1449980704618; Sat, 12 Dec 2015 20:25:04 -0800 (PST) Received: from localhost.localdomain ([167.160.116.42]) by smtp.gmail.com with ESMTPSA id by2sm34454489pab.20.2015.12.12.20.24.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 12 Dec 2015 20:25:03 -0800 (PST) From: DengChao To: linux-kernel@vger.kernel.org, tglx@linutronix.de, john.stultz@linaro.org Cc: chao.deng@linaro.org Subject: [PATCH 1/2] timekeeping: Provide internal function __ktime_get_real_seconds Date: Sun, 13 Dec 2015 12:24:18 +0800 Message-Id: <1449980659-2948-2-git-send-email-chao.deng@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1449980659-2948-1-git-send-email-chao.deng@linaro.org> References: <1449980659-2948-1-git-send-email-chao.deng@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Reviewed-by: John Stultz Signed-off-by: DengChao --- kernel/time/timekeeping.c | 13 +++++++++++++ kernel/time/timekeeping_internal.h | 2 ++ 2 files changed, 15 insertions(+) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index d563c19..55acadb 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -846,6 +846,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 */