Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5246975imm; Tue, 19 Jun 2018 07:26:25 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIqZnubLVIEsFO/0wNc5XIMTdTbCFaCAWwWgPGET5qzTLUFpYSviYvBorppK89qIgxKB463 X-Received: by 2002:a17:902:8b85:: with SMTP id ay5-v6mr19384756plb.30.1529418385222; Tue, 19 Jun 2018 07:26:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529418385; cv=none; d=google.com; s=arc-20160816; b=b9EdEIEorUCZG/m6qL6wbM8IQYTG1ReBLLwkMSb9gHHKR08PKNpdutzXDCqy6n1SEA +U/FJHWqXhKREdNCNJ1KX1qZvLoh7wT3LV8Z9wTu6Wt07Dpv/QGdVFYVakUNeiWrxkPN yY0YfpvQ9ejkAgZ97EhX3BNhxOwumaXgyh5BnmR/4rHZWXkWZXtp2wfMFAfAeDjxHKZ5 wsXYQvt5XPo2/97KunHH5RfaMhqV4Qqfyb/3B4djieINeU148qAgzNBDSjzHyK7ptyi9 PTzFUVMpl8hdrsI77aXeyTiOLGVy62q8xmfl4Smo9bUFOsZAtdQGkrR/cB9gYUXg1pKk 2MJg== 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 :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=7MEDc7lezLFksSusVQ9M2G3eeFXAiy3gOxfgpTLkY7I=; b=M0fJbo9cCn/ok438CjYu3CsxG5na3vRY7nL322NFAWPt/phL8oF86CYq6CyQFHiwze rcnKyu/rCrelvjkDz1btOwYwXNYb97+f+MmhC4yjALUe++8WrLHKstPmiNfbdXdnaaC3 jtB/lOJuEyisWBEJ8ATpqlZdeV9tdL4WRWubEHnLzxJx2q92L7ND0+AxMwKoAHBaL8in /+V9vg+VwLA1cLLsZ/ARZR5kAM0mGxtRo2pGrQruD7SqrQ4PJL2bLf6gZBd+2WLtTDwl /pk6/tnHGGzHuc49bFS43B75pZ72/N5038eUz7pFX1fWLQg6Vyd4sD/nHkIMHKiV5nLA tOZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=p5Ck556M; 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=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w23-v6si17864570ply.320.2018.06.19.07.26.11; Tue, 19 Jun 2018 07:26: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=@oracle.com header.s=corp-2017-10-26 header.b=p5Ck556M; 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=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757282AbeFSOYK (ORCPT + 99 others); Tue, 19 Jun 2018 10:24:10 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:55012 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757091AbeFSOYG (ORCPT ); Tue, 19 Jun 2018 10:24:06 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5JEJQiv170003 for ; Tue, 19 Jun 2018 14:24:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : references : in-reply-to : from : date : message-id : subject : to : cc : content-type; s=corp-2017-10-26; bh=7MEDc7lezLFksSusVQ9M2G3eeFXAiy3gOxfgpTLkY7I=; b=p5Ck556MqZxUEWINSdsuMmL6lYut+8C4TXEX/o+dD6xkyNM7RHYgcKivKhD16ruHNf4p gD0YEztZBxSE9MzzaMYH/JVBSaRWzUA+r61HK9wwMTPW6qXXtnYjtDgpoJPFSrxkbZpa h7aE7UQ9WERQvvH0I0yOx+ccn2Xri/L4ka6WzGDt7RhnqaFIIP4At/Mr5nGpKix7Ijha 0H5rSFcFLUNW274AIm0n5C3YsUXlIF9gQmSgnIYgc3y/sVNhbO5SVFF/TZmdGjfGdxEa uZQFtN2+3999E+8KCNVkwAZIbDD3WAg7hUCanx6iv0UzPtCgK2RHCP9Ny+uchF63T8Jh KQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2120.oracle.com with ESMTP id 2jmtgwrcg8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 19 Jun 2018 14:24:05 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w5JEO4w4000866 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 19 Jun 2018 14:24:04 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w5JEO3SA025667 for ; Tue, 19 Jun 2018 14:24:04 GMT Received: from mail-ot0-f181.google.com (/74.125.82.181) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 19 Jun 2018 07:24:03 -0700 Received: by mail-ot0-f181.google.com with SMTP id d19-v6so22747923oti.8 for ; Tue, 19 Jun 2018 07:24:03 -0700 (PDT) X-Gm-Message-State: APt69E03ftiBkEXr5UoWMm+Fxy2BDwJrSvVqdR1NJXfn7pI1dMqJRQWo X+1QAxeALQHHERsg+u6NVk+vMaaZ7nlAyAHCJiE= X-Received: by 2002:a9d:4305:: with SMTP id s5-v6mr9769584ote.11.1529418243020; Tue, 19 Jun 2018 07:24:03 -0700 (PDT) MIME-Version: 1.0 References: <20180615174204.30581-1-pasha.tatashin@oracle.com> <20180615174204.30581-4-pasha.tatashin@oracle.com> In-Reply-To: From: Pavel Tatashin Date: Tue, 19 Jun 2018 10:23:27 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v10 3/7] x86/time: read_boot_clock64() implementation To: Andy Shevchenko Cc: Steven Sistare , Daniel Jordan , linux@armlinux.org.uk, schwidefsky@de.ibm.com, Heiko Carstens , john.stultz@linaro.org, sboyd@codeaurora.org, x86@kernel.org, LKML , mingo@redhat.com, tglx@linutronix.de, hpa@zytor.com, douly.fnst@cn.fujitsu.com, peterz@infradead.org, prarit@redhat.com, feng.tang@intel.com, Petr Mladek , gnomes@lxorguk.ukuu.org.uk Content-Type: text/plain; charset="UTF-8" X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8928 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=975 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806190161 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > +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? Hi Andy, Sure, I will change to: if (valid_clock) ... else ... > > > > + *ts = (struct timespec64){0, 0}; > > I dunno if additional variable would be better for readability, like > > struct timespec64 null_ts = {0,0}; I don't mind adding ts_null, but I think, as-is ok here, > ... > *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. > Thank you for the review! Pavel