From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751793AbdKMDru (ORCPT ); Sun, 12 Nov 2017 22:47:50 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:4826 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751349AbdKMDrt (ORCPT ); Sun, 12 Nov 2017 22:47:49 -0500 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="30121180" Subject: Re: [PATCH v8 2/6] time: sync read_boot_clock64() with persistent clock To: Pavel Tatashin , , , , , , , , , , , , References: <20171109030201.5991-1-pasha.tatashin@oracle.com> <20171109030201.5991-3-pasha.tatashin@oracle.com> From: Dou Liyang Message-ID: <3049ead9-af20-a334-74ca-5efbb251e60f@cn.fujitsu.com> Date: Mon, 13 Nov 2017 11:47:41 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20171109030201.5991-3-pasha.tatashin@oracle.com> Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.167.226.106] X-yoursite-MailScanner-ID: E04B8480D720.AA4BD X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: douly.fnst@cn.fujitsu.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Pavel, At 11/09/2017 11:01 AM, Pavel Tatashin wrote: > read_boot_clock64() returns a boot start timestamp from epoch. Some arches > may need to access the persistent clock interface in order to calculate the > epoch offset. The resolution of the persistent clock, however, might be > low. Therefore, in order to avoid time discrepancies a new argument 'now' > is added to read_boot_clock64() parameters. Arch may decide to use it > instead of accessing persistent clock again. > > Also, change read_boot_clock64() to have __init prototype since it is > accessed only during boot. > > Signed-off-by: Pavel Tatashin > --- > arch/arm/kernel/time.c | 2 +- > arch/s390/kernel/time.c | 2 +- > include/linux/timekeeping.h | 7 +++---- > kernel/time/timekeeping.c | 8 ++++++-- > 4 files changed, 11 insertions(+), 8 deletions(-) > > diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c > index 629f8e9981f1..5b259261a268 100644 > --- a/arch/arm/kernel/time.c > +++ b/arch/arm/kernel/time.c > @@ -90,7 +90,7 @@ void read_persistent_clock64(struct timespec64 *ts) > __read_persistent_clock(ts); > } > > -void read_boot_clock64(struct timespec64 *ts) > +void __init read_boot_clock64(struct timespec64 *now, struct timespec64 *ts) > { > __read_boot_clock(ts); > } > diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c > index 5cbd52169348..780b770e6a89 100644 > --- a/arch/s390/kernel/time.c > +++ b/arch/s390/kernel/time.c > @@ -220,7 +220,7 @@ void read_persistent_clock64(struct timespec64 *ts) > ext_to_timespec64(clk, ts); > } > > -void read_boot_clock64(struct timespec64 *ts) > +void __init read_boot_clock64(struct timespec64 *now, struct timespec64 *ts) > { > unsigned char clk[STORE_CLOCK_EXT_SIZE]; > __u64 delta; > diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h > index c198ab40c04f..73919982045e 100644 > --- a/include/linux/timekeeping.h > +++ b/include/linux/timekeeping.h > @@ -211,9 +211,8 @@ extern void ktime_get_snapshot(struct system_time_snapshot *systime_snapshot); > */ > extern int persistent_clock_is_local; > > -extern void read_persistent_clock64(struct timespec64 *ts); > -extern void read_boot_clock64(struct timespec64 *ts); > -extern int update_persistent_clock64(struct timespec64 now); > - > +void read_persistent_clock64(struct timespec64 *ts); > +void read_boot_clock64(struct timespec64 *now, struct timespec64 *ts); > +int update_persistent_clock64(struct timespec64 now); > why we should remove the *extern* keyword? Thanks, dou.