From patchwork Mon Oct 26 15:22:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deng Chao X-Patchwork-Id: 55570 Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1263442lbq; Mon, 26 Oct 2015 08:23:20 -0700 (PDT) X-Received: by 10.50.6.100 with SMTP id z4mr17715009igz.97.1445873000640; Mon, 26 Oct 2015 08:23:20 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e87si8236136iod.189.2015.10.26.08.23.20; Mon, 26 Oct 2015 08:23:20 -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; 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 S1752207AbbJZPXK (ORCPT + 28 others); Mon, 26 Oct 2015 11:23:10 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:33533 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750962AbbJZPXH (ORCPT ); Mon, 26 Oct 2015 11:23:07 -0400 Received: by pacfa8 with SMTP id fa8so12303758pac.0 for ; Mon, 26 Oct 2015 08:23:07 -0700 (PDT) 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=QxnO8SZmIlMNJIFE0p5zeg0Mb6xdAENjrYR0+XFqdMU=; b=ARtwdHefG0siGuls9Sc5vx2KyFzc7YZMjxGcHzWEdswdaWimaOGci7jPrnzIffy5kc 1fg+7BvV66wmYWBtNaygPbEZXN2T9ntOtJsYoMm133AET7aQt+19HkkGqkpMFnylx2nn Sma/NRbJx+tU6mmEXFNv8zWVJE0jglH0JAMREOveFz9OJXfMUAYC0iQGByCclH6ul5Uq N263YW3lLUgfnVttBHwmT13hGbORIsM4BY4d5zERf201FGobQOH+eSvjUi9quBG6aZMN SLxDefFEos/HwoWza7Cj/iYSKo8mVyyX4RsHuBATvvI3zfZt25jW5zUHb5qaVmBxjRrd pzOA== 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=QxnO8SZmIlMNJIFE0p5zeg0Mb6xdAENjrYR0+XFqdMU=; b=I/zAisQcpMHm4PpwATsaMwuecuYorhRaO1cBmFWWdC+bULw8vmfRl5pp0r2Y6RK+iY fzzA8SKPiH1rh/n+Lt5ozorU5ipBh6tAHCSRBvuVEgAZTYSdO8uzrFFbaj5ppp77IYGx monMdM1hmKGZa9stwFz07544jDZ8/A6HyxQuqwKQruZujxIILq1fXqBi/V+oS2unaVTn xcfKrr5U0g1IjlOTjacPO3T3oyeX9DDKEER3OazLh51Tv+XzG/IFK8c8qXhVIyo8zsRt X9eqB5oZjATlOFTjjdejHRQfpPYkY6sZMh5RJ9QXAKdXP3GWtMQ+CwrbI86lrXlqvvvj fpgQ== X-Gm-Message-State: ALoCoQl06SO6JIvv/eaLObn8OtjvddF/Whh1pDNzmyKFDK+bvookbm5YZty+GTwPYNPkcUXtC7mV X-Received: by 10.68.163.69 with SMTP id yg5mr22601670pbb.157.1445872987001; Mon, 26 Oct 2015 08:23:07 -0700 (PDT) Received: from localhost.localdomain ([167.160.116.82]) by smtp.gmail.com with ESMTPSA id ez1sm12232122pab.6.2015.10.26.08.23.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Oct 2015 08:23:06 -0700 (PDT) From: DengChao To: linux-kernel@vger.kernel.org Cc: chao.deng@linaro.org Subject: [PATCH 1/2] timekeeping: Provide internal function Date: Mon, 26 Oct 2015 23:22:42 +0800 Message-Id: <1445872963-29988-2-git-send-email-chao.deng@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445872963-29988-1-git-send-email-chao.deng@linaro.org> References: <1445872963-29988-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. 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 bca3667..e958e6a 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 */