Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4022446imu; Mon, 10 Dec 2018 11:43:32 -0800 (PST) X-Google-Smtp-Source: AFSGD/UnoDNn5XNOX9QnRyliwL6wJXWFFeIe68FzY5/SYFGFkUDjNSw02tg2fSoZZg4aDHQyJNG3 X-Received: by 2002:a62:6799:: with SMTP id t25mr13512933pfj.139.1544471012816; Mon, 10 Dec 2018 11:43:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544471012; cv=none; d=google.com; s=arc-20160816; b=G8oeEfSnpdtJLqe9MhyLFbEJ36sZVHU62byCAB1UUlEeR29ARdW6Myng4HUb+In45e FBV+EOhSA7u3dHN5vNqBfvOPsWQIwKn5ij5BXKisZOLgms5p2Y+TbM0jaE+bs8seFS9F DdKs4INtTN7ZrvcbAwbctkhxZAVNnxM9ZOKVwZtR2XLjOMQOVP153armvOpFpi+FID61 84d2pX6W8y8mx6tPP07FvCwWVFgTUDUAQLh71XiAg0oip/wV3RcdPV0pzDCUfWoBpaUN Z2jS7neDAMtFnxre0vcD05VsX1YfmUhxPtunn+VR6kE8FZmVDQhebg2BHVxyoKcZiJlv bgKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=weqXdlaz0b97S8EiQd1CzSACKY7a5Mon+3q/WWqszvA=; b=WDjnliX3SPL4/b95Qj7520RRIeX0//QpMTRR2fIPE2/pEZ5qyKOU7QMC+cuKJ3Hq45 nQo78vc+gZX0Fr/f0iPj7umZo+UEXL0shwHWaldm9Almr0BJF4O4ilGfLWGcoJp5E/da 8ZnX/Y5b4IideHMJOvG/qqZscVQ3FVpvOi6Tv2jayv3fGWIoxWhhBo76Yt9g3/tcBu0m ZBNTQPv16SABwkz6p8TSj1C4tEo2CsmrfiXijMWY/FK7Mc2eZWxatlfvpOYKrhcKeCQo XmuU9bQfIVpqHF/SKW9ccg6s63OiyVWZYQtSVx2qpBCcAGmzW5JRgA6+WvQXiixYp0oe 25WQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e15si10117079pgg.281.2018.12.10.11.43.18; Mon, 10 Dec 2018 11:43:32 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728533AbeLJRnd (ORCPT + 99 others); Mon, 10 Dec 2018 12:43:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47600 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727399AbeLJRnc (ORCPT ); Mon, 10 Dec 2018 12:43:32 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2334BC057F9F; Mon, 10 Dec 2018 17:43:32 +0000 (UTC) Received: from vitty.brq.redhat.com.redhat.com (unknown [10.43.2.155]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 35C3D5D962; Mon, 10 Dec 2018 17:43:29 +0000 (UTC) From: Vitaly Kuznetsov To: Michael Kelley , "K . Y . Srinivasan" Cc: will.deacon@arm.com, catalin.marinas@armm.com, mark.rutland@arm.com, marc.zyngier@arm.com, linux-arm-kernel@lists.infradead.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, jasowang@redhat.com, sthemmin@microsoft.com Subject: Re: [PATCH 1/4] arm64: hyperv: Add core Hyper-V include files In-Reply-To: <20181122031059.16338-1-kys@linuxonhyperv.com> References: <20181122030914.16274-1-kys@linuxonhyperv.com> <20181122031059.16338-1-kys@linuxonhyperv.com> Date: Mon, 10 Dec 2018 18:43:27 +0100 Message-ID: <87mupdcm68.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 10 Dec 2018 17:43:32 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kys@linuxonhyperv.com writes: > + > +static inline u64 hv_read_tsc_page_tsc(const struct ms_hyperv_tsc_page *tsc_pg, > + u64 *cur_tsc) > +{ > + u64 scale, offset; > + u32 sequence; > + > + /* > + * The protocol for reading Hyper-V TSC page is specified in Hypervisor > + * Top-Level Functional Specification. To get the reference time we > + * must do the following: > + * - READ ReferenceTscSequence > + * A special '0' value indicates the time source is unreliable and we > + * need to use something else. > + * - ReferenceTime = > + * ((HWclock val) * ReferenceTscScale) >> 64) + ReferenceTscOffset > + * - READ ReferenceTscSequence again. In case its value has changed > + * since our first reading we need to discard ReferenceTime and repeat > + * the whole sequence as the hypervisor was updating the page in > + * between. > + */ > + do { > + sequence = READ_ONCE(tsc_pg->tsc_sequence); (sorry if this was already discussed before) Current x86 code doing this actually checks for '0' here (note the comment about this special value above): sequence = READ_ONCE(tsc_pg->tsc_sequence); if (!sequence) return U64_MAX; Was it removed intentionally (and we need to fix the comment then)? -- Vitaly