From patchwork Wed Mar 11 03:15:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xunlei Pang X-Patchwork-Id: 45613 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6F0FD214C2 for ; Wed, 11 Mar 2015 03:19:33 +0000 (UTC) Received: by lbiz11 with SMTP id z11sf4501698lbi.2 for ; Tue, 10 Mar 2015 20:19:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=qrMvR4fcJN6pT23fwEyNBwMpEi0Tw0Ipoton5jOFXHA=; b=A+SXxhFKeom+rX3xH01ESdt/DT0e+e8gZYlp+96GCsT1z+R1E2ySf1H6LHnUMDz0ro QLrqo52KfWef8id3yx4lO7XfbNFt4TM6ou5slXWBqU7iCGbpyrqfHSiO0cq+ElRCy7pI eInJvpaUfwqns2GMhboyryxApuV595sRIopxyE6SMdlmpe6+PKlGM3G7uNEBv/metrBm hWzfMl6uSSZUQa2uU/ofJqVk8cFH9IXS3R/diOFlN5cduc2wvhWYhb4p3PfnxIKMJqpQ Ut0e/x9x98nIkHbtJT7sdOnxBPQ6RVYx8lBlyyc/2vhyFZzzGv/98to6JPTTCT1nXwIX plaQ== X-Gm-Message-State: ALoCoQnAhT4fs3fF+r39jYCwI5UW2w76Fil+ciLlKkMqBujhwLEZUbh3aJ9qCr5m16wugJMjuWY7 X-Received: by 10.152.45.7 with SMTP id i7mr5108211lam.9.1426043972143; Tue, 10 Mar 2015 20:19:32 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.69 with SMTP id kw5ls92975lac.86.gmail; Tue, 10 Mar 2015 20:19:31 -0700 (PDT) X-Received: by 10.112.181.231 with SMTP id dz7mr31845612lbc.47.1426043971958; Tue, 10 Mar 2015 20:19:31 -0700 (PDT) Received: from mail-la0-x234.google.com (mail-la0-x234.google.com. [2a00:1450:4010:c03::234]) by mx.google.com with ESMTPS id 7si1449977lai.138.2015.03.10.20.19.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Mar 2015 20:19:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::234 as permitted sender) client-ip=2a00:1450:4010:c03::234; Received: by labge10 with SMTP id ge10so5984264lab.7 for ; Tue, 10 Mar 2015 20:19:31 -0700 (PDT) X-Received: by 10.112.212.106 with SMTP id nj10mr14258683lbc.36.1426043971758; Tue, 10 Mar 2015 20:19:31 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp2512990lbj; Tue, 10 Mar 2015 20:19:30 -0700 (PDT) X-Received: by 10.70.91.75 with SMTP id cc11mr73289672pdb.150.1426043969980; Tue, 10 Mar 2015 20:19:29 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id va1si4487475pac.83.2015.03.10.20.19.29; Tue, 10 Mar 2015 20:19:29 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752596AbbCKDTX (ORCPT + 28 others); Tue, 10 Mar 2015 23:19:23 -0400 Received: from m15-112.126.com ([220.181.15.112]:48845 "EHLO m15-112.126.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751788AbbCKDTV (ORCPT ); Tue, 10 Mar 2015 23:19:21 -0400 Received: from localhost.localdomain (unknown [210.21.223.3]) by smtp2 (Coremail) with SMTP id DMmowEAp51Z4s_9UJTpwAw--.1055S3; Wed, 11 Mar 2015 11:17:33 +0800 (CST) From: Xunlei Pang To: linux-kernel@vger.kernel.org Cc: rtc-linux@googlegroups.com, Thomas Gleixner , Alessandro Zummo , John Stultz , Arnd Bergmann , linux-omap@vger.kernel.org, Tony Lindgren , linux-tegra@vger.kernel.org, Stephen Warren , linux390@de.ibm.com, Martin Schwidefsky , Ralf Baechle , Arnd Bergmann , Xunlei Pang Subject: [PATCH 1/8] time: Add y2038 safe read_boot_clock64() Date: Wed, 11 Mar 2015 11:15:08 +0800 Message-Id: <1426043715-22043-2-git-send-email-xlpang@126.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1426043715-22043-1-git-send-email-xlpang@126.com> References: <1426043715-22043-1-git-send-email-xlpang@126.com> X-CM-TRANSID: DMmowEAp51Z4s_9UJTpwAw--.1055S3 X-Coremail-Antispam: 1Uf129KBjvJXoW7AFW8uw47Gw18tFWDJryDtrb_yoW8trWxpr WUCw15GF4kJrW5urnrt393uw1agws8tF4xtrWfu34Fyry0vFn7JFy0k3yYqryDXF1fAa1q vF40vF4fAr1UZrJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jsgA7UUUUU= X-Originating-IP: [210.21.223.3] X-CM-SenderInfo: p0ost0bj6rjloofrz/1tbiJwS5v01sAr9NXAAAso Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Original-Sender: xlpang@126.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::234 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@; dmarc=fail (p=NONE dis=NONE) header.from=126.com Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Xunlei Pang As part of addressing in-kernel y2038 issues, this patch adds read_boot_clock64() and replaces all the call sites of read_boot_clock() with this function. This is a __weak implementation, which simply calls the existing y2038 unsafe read_boot_clock(). This allows architecture specific implementations to be converted independently, and eventually the y2038 unsafe read_boot_clock() can be removed after all its architecture specific implementations have been converted to read_boot_clock64(). Suggested-by: Arnd Bergmann Signed-off-by: Xunlei Pang --- include/linux/timekeeping.h | 1 + kernel/time/timekeeping.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 3eaae47..d53c522 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -263,6 +263,7 @@ static inline bool has_persistent_clock(void) extern void read_persistent_clock(struct timespec *ts); extern void read_boot_clock(struct timespec *ts); +extern void read_boot_clock64(struct timespec64 *ts); extern int update_persistent_clock(struct timespec now); diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 91db941..7080c21 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1072,6 +1072,14 @@ void __weak read_boot_clock(struct timespec *ts) ts->tv_nsec = 0; } +void __weak read_boot_clock64(struct timespec64 *ts64) +{ + struct timespec ts; + + read_boot_clock(&ts); + *ts64 = timespec_to_timespec64(ts); +} + /* * timekeeping_init - Initializes the clocksource and common timekeeping values */ @@ -1093,8 +1101,7 @@ void __init timekeeping_init(void) } else if (now.tv_sec || now.tv_nsec) persistent_clock_exist = true; - read_boot_clock(&ts); - boot = timespec_to_timespec64(ts); + read_boot_clock64(&boot); if (!timespec64_valid_strict(&boot)) { pr_warn("WARNING: Boot clock returned invalid value!\n" " Check your CMOS/BIOS settings.\n");