From patchwork Thu Oct 30 11:15:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "pang.xunlei" X-Patchwork-Id: 39823 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7D5A0202FE for ; Thu, 30 Oct 2014 11:18:13 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id e51sf3021067eek.6 for ; Thu, 30 Oct 2014 04:18:12 -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=CES3Yhs5UFpkrQ6Y3cV/xGHMxU9PSMLZF7aBMUTZgIs=; b=mkGmhKYOLp8zoDcQw+1Wg6SWnZklD2gG/jxIJFMriy/ROGbDlZDbhDOpIwMOqOZsON IsDyQNcdakVvIrkBUh9beTlkEvOYAxBQiXt3Tugrm3CdNIX4BhCHwI1oIzxHu9Vb3dYf IYWhVmNbxOV+WIiq/XX1L4md06VnLuqyGUa5YjB4gB13fR0pBVcVcSiXjpM8AKuYGTZx Lxo+QAay25Pe6bZZGb3Am096iAyim+cZd1NNAdefzBXBkCSv4abp+l4T19gx9Tj7GRLR wxMrHRQd0P5v8go+R4cnG760dKZ6qJrw/WB3Opym6Dbm3B4wmK/zdgx6VQnpaAsWBKWf 93Lg== X-Gm-Message-State: ALoCoQkdQa3r+OeGxYx8tv7e8ax6RLQbRkJHYfA47pBp20Gd64o48sSN11oZozcPLiredXxPedWJ X-Received: by 10.112.26.82 with SMTP id j18mr55351lbg.16.1414667892660; Thu, 30 Oct 2014 04:18:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.108 with SMTP id lf12ls275116lac.48.gmail; Thu, 30 Oct 2014 04:18:12 -0700 (PDT) X-Received: by 10.153.11.133 with SMTP id ei5mr18170292lad.75.1414667892336; Thu, 30 Oct 2014 04:18:12 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id bc10si11575708lab.15.2014.10.30.04.18.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 30 Oct 2014 04:18:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id ge10so4227807lab.30 for ; Thu, 30 Oct 2014 04:18:12 -0700 (PDT) X-Received: by 10.112.77.74 with SMTP id q10mr17940979lbw.66.1414667892202; Thu, 30 Oct 2014 04:18:12 -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.84.229 with SMTP id c5csp22444lbz; Thu, 30 Oct 2014 04:18:11 -0700 (PDT) X-Received: by 10.70.37.8 with SMTP id u8mr16833531pdj.9.1414667890492; Thu, 30 Oct 2014 04:18:10 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d7si6405623pds.56.2014.10.30.04.18.09 for ; Thu, 30 Oct 2014 04:18:10 -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 S1759444AbaJ3LRh (ORCPT + 26 others); Thu, 30 Oct 2014 07:17:37 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:43417 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759381AbaJ3LRe (ORCPT ); Thu, 30 Oct 2014 07:17:34 -0400 Received: by mail-pa0-f49.google.com with SMTP id lj1so5200219pab.8 for ; Thu, 30 Oct 2014 04:17:33 -0700 (PDT) X-Received: by 10.66.90.230 with SMTP id bz6mr16263453pab.125.1414667853791; Thu, 30 Oct 2014 04:17:33 -0700 (PDT) Received: from wangdeqiang.com ([210.21.227.66]) by mx.google.com with ESMTPSA id i10sm6874826pdr.21.2014.10.30.04.17.28 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 30 Oct 2014 04:17:33 -0700 (PDT) From: "pang.xunlei" To: linux-kernel@vger.kernel.org Cc: rtc-linux@googlegroups.com, xen-devel@lists.xenproject.org, John Stultz , Thomas Gleixner , Alessandro Zummo , Stefano Stabellini , "pang.xunlei" Subject: [RFC PATCH v2 08/11] time: Convert xen_read_wallclock() to use timespec64 Date: Thu, 30 Oct 2014 19:15:42 +0800 Message-Id: <1414667745-7703-9-git-send-email-pang.xunlei@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1414667745-7703-1-git-send-email-pang.xunlei@linaro.org> References: <1414667745-7703-1-git-send-email-pang.xunlei@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pang.xunlei@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org 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: , As part of addressing 2038 safety for in-kernel uses, this patch creates no functional change, converts xen_read_wallclock() to use timespec64 instead of timespec. Signed-off-by: pang.xunlei Acked-by: David Vrabel --- arch/x86/xen/time.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c index 16fce39..4e14439 100644 --- a/arch/x86/xen/time.c +++ b/arch/x86/xen/time.c @@ -169,20 +169,27 @@ static cycle_t xen_clocksource_get_cycles(struct clocksource *cs) return xen_clocksource_read(); } -static void xen_read_wallclock(struct timespec *ts) +static void xen_read_wallclock(struct timespec64 *ts) { + struct timespec ts_unsafe; struct shared_info *s = HYPERVISOR_shared_info; struct pvclock_wall_clock *wall_clock = &(s->wc); struct pvclock_vcpu_time_info *vcpu_time; vcpu_time = &get_cpu_var(xen_vcpu)->time; - pvclock_read_wallclock(wall_clock, vcpu_time, ts); + /* TODO: [2038 safety] pvclock_read_wallclock() uses timespec64 */ + pvclock_read_wallclock(wall_clock, vcpu_time, &ts_unsafe); + *ts = timespec_to_timespec64(ts_unsafe); put_cpu_var(xen_vcpu); } +/* TODO: [2038 safety] xen_get_wallclock() uses timespec64 */ static void xen_get_wallclock(struct timespec *now) { - xen_read_wallclock(now); + struct timespec64 now64; + + xen_read_wallclock(&now64); + *now = timespec64_to_timespec(now64); } static int xen_set_wallclock(const struct timespec *now) @@ -485,8 +492,7 @@ static const struct pv_time_ops xen_time_ops __initconst = { static void __init xen_time_init(void) { int cpu = smp_processor_id(); - struct timespec tp; - struct timespec64 tp64; + struct timespec64 tp; clocksource_register_hz(&xen_clocksource, NSEC_PER_SEC); @@ -497,13 +503,8 @@ static void __init xen_time_init(void) xen_clockevent = &xen_vcpuop_clockevent; } - /* - * Set initial system time with full resolution - * TODO: [2038 safety] xen_read_wallclock() uses timespec64 - */ xen_read_wallclock(&tp); - tp64 = timespec_to_timespec64(tp); - do_settimeofday64(&tp64); + do_settimeofday64(&tp); setup_force_cpu_cap(X86_FEATURE_TSC);