public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Michael Kelley <mikelley@microsoft.com>,
	"K . Y . Srinivasan" <kys@microsoft.com>
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
Date: Mon, 10 Dec 2018 18:43:27 +0100	[thread overview]
Message-ID: <87mupdcm68.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20181122031059.16338-1-kys@linuxonhyperv.com>

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

      parent reply	other threads:[~2018-12-10 17:43 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-22  3:09 [PATCH 0/4] Hyper-V: Enable Linux guests on Hyper-V on ARM64 kys
2018-11-22  3:10 ` [PATCH 1/4] arm64: hyperv: Add core Hyper-V include files kys
2018-11-22  3:10   ` [PATCH 2/4] arm64: hyperv: Add support for Hyper-V as a hypervisor kys
2018-11-26 19:19     ` Greg KH
2018-12-07 13:42     ` Will Deacon
2018-12-07 14:43     ` Marc Zyngier
2018-12-12  5:00       ` Michael Kelley
2018-12-13 11:23         ` Marc Zyngier
2019-01-04 20:05           ` Michael Kelley
2019-01-21  4:38             ` Michael Kelley
2018-11-22  3:10   ` [PATCH 3/4] Drivers: hv: vmbus: Add hooks for per-CPU IRQ kys
2018-11-26 19:21     ` Greg KH
2018-11-26 19:47       ` Michael Kelley
2018-11-26 19:57         ` Greg KH
2018-11-26 20:56           ` Michael Kelley
2018-11-27  6:20             ` Greg KH
2018-11-27 10:19               ` Will Deacon
2018-12-03  1:47                 ` Michael Kelley
2018-11-22  3:10   ` [PATCH 4/4] Drivers: hv: Enable CONFIG_HYPERV on ARM64 kys
2018-11-26 19:18   ` [PATCH 1/4] arm64: hyperv: Add core Hyper-V include files Greg KH
2018-11-26 20:21     ` Joshua R. Poulson
2018-11-27  3:06     ` KY Srinivasan
2018-12-07 13:42   ` Will Deacon
2018-12-12  1:19     ` Michael Kelley
2018-12-10 17:43   ` Vitaly Kuznetsov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mupdcm68.fsf@vitty.brq.redhat.com \
    --to=vkuznets@redhat.com \
    --cc=apw@canonical.com \
    --cc=catalin.marinas@armm.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jasowang@redhat.com \
    --cc=kys@microsoft.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=mikelley@microsoft.com \
    --cc=olaf@aepfle.de \
    --cc=sthemmin@microsoft.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox