From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC328C5CFFE for ; Mon, 10 Dec 2018 17:43:50 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9B9302082F for ; Mon, 10 Dec 2018 17:43:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LVDjFQfN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9B9302082F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=P39ScuoE6aENU7UprPuO11J4TVAlP/rt9Zjw+pUrJ3U=; b=LVDjFQfN8QdoQH p75F+W0v10B10tHQpjlQWY3nwkHJzA9YpN2c2RP0mb2IA+PQagDgN72xSUBWToeRCZgzjjWnQugy0 gVGdwdZsMdHL9iS4h/gplr3ROe+V0TZvjtJ2yGT+fbB/B8zNWdLmk1F7I7LPgZRjpMteWjKSteaDb 1ygoYxXiMuEBWDKE6Dv6veip/xiGXGlzEx2VA2gPxfDQ8NPcCF7skuEXsm46d6D6D2BLrOJTTsrMX F8+zq+KP4Rj4cGjDgnEjNrHR18nh/CjHRbvLmqYfhGC4Ea5tWKxicR60iGKD5LR7gaA39jLceb35J eN8ZZ6f7JpAwKg5FuWpg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWPau-0003s2-FW; Mon, 10 Dec 2018 17:43:48 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gWPap-0003r2-Ip for linux-arm-kernel@lists.infradead.org; Mon, 10 Dec 2018 17:43:46 +0000 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" 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 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) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181210_094343_637938_C5C9E17A X-CRM114-Status: GOOD ( 13.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, olaf@aepfle.de, sthemmin@microsoft.com, marc.zyngier@arm.com, catalin.marinas@armm.com, jasowang@redhat.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, apw@canonical.com, devel@linuxdriverproject.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FEB7C04EB8 for ; Mon, 10 Dec 2018 17:43:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 531A620851 for ; Mon, 10 Dec 2018 17:43:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 531A620851 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728925AbeLJRnd (ORCPT ); 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