Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3661525imm; Mon, 18 Jun 2018 01:47:25 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKGzxvRhOc4bGyFltqJGRhZTsXhu065ScuD9jOeNF63fGKrGaopQEtB39mKInh35eM2mvwE X-Received: by 2002:a63:5f8b:: with SMTP id t133-v6mr10238766pgb.68.1529311645707; Mon, 18 Jun 2018 01:47:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529311645; cv=none; d=google.com; s=arc-20160816; b=Bjan3KlDXxNqmLBts94qnyt95JkArv5n4EH6j2Plxqoih9hoC5BASnKZohjot9m6M2 5/vED6mT8kQvUJm1nliCoJ4vkLRuLbRDH27AO2vVIZTrQCec0dmnLRrgf4Tqan+uc7RY rIWqCVgwWlnIaR59lpYsWylK53LpSHIh5NiaOD5IQA2GgKw5kp19Tj7IjLyRP4l3RhdX 9h1M+LDGhQhKIRE2V9Xb7rrjXFxAIJdoNC/jN0Y+W0+P9MS30I7zdEmVdyhYSusk+om3 6TN4qgNwaadmKMs/Vxd3fFQJRVPeRzexaAkNWVOcF856d5SXF6ErK2b1gKiTZfS2PVRH F0uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:mime-version:dkim-signature:arc-authentication-results; bh=nJ+CZnsKUZLN6StcvXGyqZaHNh8bZ9YdszgaE315IOo=; b=1Bvkp94NHVqUPWJigqLIgSMn/C4DkpFkpb90qRCDmqOkwDC/tyzx7l02OfHTTLRHak pAickfnyZxBqBFs1K8g2KejAnc6tLNzCDAeACFHKBYUXnht7haw1O2EqEyQ5jeBAdEEL 5DrGX2VRCuXmXm71YKgxTcoojm/90y35JFXHx9/zgduZMRmKkaV11n4Z8fayJKMuVROM KNK9X1ulJtGs/1Af7/wH1pdRZwHGzKSbxotkuC4WY0jaGdB1jxzYAs050O7VszrNDzUx AZfwffSIGDm8O84aolI5bxvch22FhWCxWYH0G1CgGiVbGNYGDOU5Szz64F5OWuTSpYE9 piWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=B7fQLUYb; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cc7-v6si15682576plb.5.2018.06.18.01.47.11; Mon, 18 Jun 2018 01:47:25 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=B7fQLUYb; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968182AbeFRIpM (ORCPT + 99 others); Mon, 18 Jun 2018 04:45:12 -0400 Received: from mail-vk0-f65.google.com ([209.85.213.65]:46404 "EHLO mail-vk0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968071AbeFRIpJ (ORCPT ); Mon, 18 Jun 2018 04:45:09 -0400 Received: by mail-vk0-f65.google.com with SMTP id b134-v6so9019438vke.13 for ; Mon, 18 Jun 2018 01:45:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:from:date:message-id:subject:to:cc; bh=nJ+CZnsKUZLN6StcvXGyqZaHNh8bZ9YdszgaE315IOo=; b=B7fQLUYb5dg6BspnsDwPuSlQwxyvtMJtcMhJH87mIya6JfXXSiw6lu6C3UnrV9q3kx 82MUT0YZHQxbD0gqG3adQWbvgH9dYJkZiuSP7mp8rWhOCkgkbJZyKC3zEt3Q8m1bI4cA KDoINuJa12hXHkKkyIX8WixdVnthRF2m/HI50tAWFvUYhdhZElgrFtaKjRqvaW0gzTt8 6FN9Lxs1oAyaOz/eOcn22E7H2IP3nFwn/sDzz2fG0fY0fW9Iny0ChiTCVK8iYRWIysza SZOgd7Hz1ITJ5RmF4diJRG9T+oak8QOq0yNMc8PVsKRgNojQg0eqsAlRzPlV8FWmHcRt yu0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:from:date:message-id :subject:to:cc; bh=nJ+CZnsKUZLN6StcvXGyqZaHNh8bZ9YdszgaE315IOo=; b=Gok+J6/gSkdShP8UyG6uiy4OgZQx98zx5ybPkb1tMGH5xvsGnHKu702Bd+UbGC7Mk4 nkwpL79tYb63jBNe34hLn4A0eQDUAOFRvLr4Tfr/jYxllvXUHz9Z0R466G8EufnxiZf1 XcmLgkESxkXgVwDJ/5+Pnben9jKFLYQvuf9+zlxMCGxbImSXLjH3wbt6rbpL9ilHmX04 9BHgonRZh5n696nvdBXRtwST+pJy8jeLl/FqV0TARdzUZSJvU5p5AZcBZG3Wg5FYws/0 aeaHN+HSzJ8+97XAVxIxwvjU8fTVj7G29c0w4sMwcQb8p5Otxjx7RnvvCAEgDZzLgssO Zztw== X-Gm-Message-State: APt69E1BPNXlI3AM4LwHxqnCKOPLxxhlOQxV6Dqjyft1ctbXUJMysINk grqN5+nxdyQV/QTCuhlGQRyj8XrOA+5xc3ctlaM= X-Received: by 2002:a1f:860b:: with SMTP id i11-v6mr6495254vkd.15.1529311508982; Mon, 18 Jun 2018 01:45:08 -0700 (PDT) MIME-Version: 1.0 References: <20180615174204.30581-1-pasha.tatashin@oracle.com> <20180615174204.30581-4-pasha.tatashin@oracle.com> From: Andy Shevchenko Date: Mon, 18 Jun 2018 11:44:57 +0300 Message-ID: Subject: Re: [PATCH v10 3/7] x86/time: read_boot_clock64() implementation To: Pavel Tatashin Cc: Steven Sistare , Daniel Jordan , Russell King - ARM Linux , Martin Schwidefsky , Heiko Carstens , John Stultz , Stephen Boyd , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Linux Kernel Mailing List , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Dou Liyang , "Peter Zijlstra (Intel)" , prarit@redhat.com, Feng Tang , Petr Mladek , One Thousand Gnomes Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 18, 2018 at 11:42 AM Andy Shevchenko wrote: > > On Fri, Jun 15, 2018 at 8:48 PM Pavel Tatashin wrote: > > > > read_boot_clock64() returns time of when system was started. Now, that > > early boot clock is going to be available on x86 it is possible to > > implement x86 specific version of read_boot_clock64() that takes advantage > > of this new feature. > Oops, sorry for previous empty mail. > > +void __init read_boot_clock64(struct timespec64 *now, struct timespec64 *ts) > > +{ > > + u64 ns_boot = sched_clock_cpu(smp_processor_id()); > > + bool valid_clock; > > + u64 ns_now; > > + > > + ns_now = timespec64_to_ns(now); > > + valid_clock = ns_boot && timespec64_valid_strict(now) && > > + (ns_now > ns_boot); > > + > > > + if (!valid_clock) Are we expecting more often clock to be non-valid? Perhaps change to positive conditional? > > + *ts = (struct timespec64){0, 0}; I dunno if additional variable would be better for readability, like struct timespec64 null_ts = {0,0}; ... *ts = null_ts; > > + else > > + *ts = ns_to_timespec64(ns_now - ns_boot); But I'm fine as long as Thomas is okay with this code. > > +} -- With Best Regards, Andy Shevchenko