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: 405024 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-qa0-x23c.google.com (mail-qa0-x23c.google.com [IPv6:2607:f8b0:400d:c00::23c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48E1514007B for ; Thu, 30 Oct 2014 22:17:36 +1100 (AEDT) Received: by mail-qa0-f60.google.com with SMTP id bm13sf335564qab.5 for ; Thu, 30 Oct 2014 04:17:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:sender:list-subscribe:list-unsubscribe:content-type; bh=6rT4TH+cuMT7Rw2hQZ3OwyTmIRwkX4i68PK8Xd4aGFY=; b=OuCdaJeacC0h+nDq09vS9jM2/PwYN12PttHKwmnpiLOYDOg/8f2k9YZKeqdmpa5uFP rS93mpz8ZC5eWyTRF4kSlQ+esKOvud/k180wLJQiAn0U63aglAWsnaUWryGbwexJ4Btn U/Yq3q/FN3f+2k/kIGYNd3VJ1ZlXTdgudiJwONXtnBrQ+fwfW/wbOVOxgLUg/sjnBjMs iOSw90oYF4BZris6dWDR0rZZbhlamQpFqX8caTWpE2nI+0+16WC2JZHBECuvpx+Cnxsz BGJsLkMYw8XZwgTdeJlUoFOmwjeVm5ECiLAAaid82FPlzOmsf6CSU91DaOSaHWpsOT1l faeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :in-reply-to:references:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; bh=6rT4TH+cuMT7Rw2hQZ3OwyTmIRwkX4i68PK8Xd4aGFY=; b=HXnw/zgFKXcjggaOfruGkj7CRj++Niy1lG4IlaCNv8/49ZrA8fbubPZf4S9AfWgWwW yKbsASlhRikZG9KeuJ53QjP60ba31Ir2PC8hPcLiobG9UQISbC3uX/fGwEVhUqxTiUp/ tBWIxTVLK32uwvkKl5lcND5AHKjBH3xV02HkKyWH+M5/IvjARP4983kWbNoKfrlexChS atyU4YHoXU+oJdheh/WBsvoyZW8zPtMPCXwBvFfhsNee/7JJb6cRlZI+Le/R6/ocMIet ggKjjYEKSuTHsQtNc2BfLQC3JbHCWfQHXBlPonVLUuUYIF7l8zDqQsxxTVHcuB243xuY /xww== X-Received: by 10.50.20.198 with SMTP id p6mr551921ige.10.1414667854470; Thu, 30 Oct 2014 04:17:34 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.50.79.229 with SMTP id m5ls15736igx.40.canary; Thu, 30 Oct 2014 04:17:33 -0700 (PDT) X-Received: by 10.68.132.234 with SMTP id ox10mr11620467pbb.8.1414667853890; Thu, 30 Oct 2014 04:17:33 -0700 (PDT) Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com. [209.85.220.42]) by gmr-mx.google.com with ESMTPS id yr4si933099pab.1.2014.10.30.04.17.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 30 Oct 2014 04:17:33 -0700 (PDT) Received-SPF: pass (google.com: domain of pang.xunlei@linaro.org designates 209.85.220.42 as permitted sender) client-ip=209.85.220.42; Received: by mail-pa0-f42.google.com with SMTP id bj1so5292821pad.29 for ; Thu, 30 Oct 2014 04:17:33 -0700 (PDT) X-Gm-Message-State: ALoCoQloOhXcC9vRUqwA3OKZFVsxUUkzTNSn8Z4t4dE6k/NCICGUUpmLcb6lyMGb1IuLaqXqDqMz 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: [rtc-linux] [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> X-Original-Sender: pang.xunlei@linaro.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of pang.xunlei@linaro.org designates 209.85.220.42 as permitted sender) smtp.mail=pang.xunlei@linaro.org Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 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);