Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2831046pxk; Tue, 15 Sep 2020 03:35:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqPZZZ2D0uVUd4K+SJJjo++M5/652NTBG5ChROj2J/l8q3sGXK1PV8hWUNK5lB+05LLAZv X-Received: by 2002:a50:fc91:: with SMTP id f17mr22447631edq.319.1600166108529; Tue, 15 Sep 2020 03:35:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600166108; cv=none; d=google.com; s=arc-20160816; b=k43f8Pv2XJodENiq2oG9u/YysPcsMlegFPmZEErhjwX7QNY+Ij7O6WRcv9rfIwtKdC 7xVR6KlTdQ/sfrnXkqEfVcoByocOxS2d0g9cCRmsccLiJ/U0mMsVqQQUR+G7OYgFj2FE p5ehsCFIc5lirVIx206zm9IvHVr9/M2bm6j8ts9oEhK/A66ci0aggJEH2EdXGvJHh/8v DkKGMIIf119H7ZSpx0lC02kmlFS69d3pjpXNz3bRbhl7SH0Br6xXahhGGdIKkQQvcDoF RksIJlxJo7hfMnZVbliRuWdGmbsOYKjk46XR5sj2X12d984ZwVj2WmfcNI7/a68IuHQ1 y0TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Iu1a051qw6glF2gbjBYkACqFqsFXF3vFbvUgHvXqm8s=; b=J4J6QCx7fQNsog0z2NacEejUQiccNMFoq7de7Mc1QQ/35U83S4JsFRvl0tLb6q8YGE 6KQAGCd+UFGvSd2+J4ULwqBkrmh/NbZ1tIfobm8VOzLd5FrhxoYEk8z2yj/34Cbej9d1 T5cyqZc/gWK8Fvx/6uvhhDetpgdzoJ3At2TaeZ5LGoex8RAhS3OvHv1Xc6dru0xhiD2P XMAB+4mA6FWzJnScKQXS9Bk2cR7IArjZyTYLETxNvDhYSEdn3P7bb1iPy67pxBqh3AxX C9X4OjoAu0Q+FyQfd8Sdm9m0xDopnGu/gv31gROKq1AZF1rYqpkIItNPG4p7SbreZfEv 5CNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r26si10231808eda.569.2020.09.15.03.34.46; Tue, 15 Sep 2020 03:35:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726299AbgIOKcK (ORCPT + 99 others); Tue, 15 Sep 2020 06:32:10 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:34369 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726131AbgIOKcI (ORCPT ); Tue, 15 Sep 2020 06:32:08 -0400 Received: by mail-wm1-f67.google.com with SMTP id l15so7777511wmh.1; Tue, 15 Sep 2020 03:32:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Iu1a051qw6glF2gbjBYkACqFqsFXF3vFbvUgHvXqm8s=; b=CGGuXF2dk9T5CRX54TmyufVE21PuvHkBHin9OL2JKqc1jZ8b1W6QMvKNijTMKIp2Mn 71dZSRdkGMTkyWmGDpeRJvSmyHJiuRElIqxThKWDBkgluQEo167sggteVyIjD7kgITg+ m0EyRMSWx1HuATDcp0KdOWrXxNA3hIY1G+z0TfTSsni9Y1Zjd/79hdUiIDuN7cIVocEJ K+Dhf5+X3/kc1iUxio/CS2x5rR7pCjAUaK7nCxAhwzBK7kqGZjwV/AhyECXoTc8KpiuB LH5Rwj+iLAHNJPL+ijFVzUvSvWq/ScadzrdaQnT4L4LhVoIJXyqsgRtNSyqopde6a6yF YwTQ== X-Gm-Message-State: AOAM532sZuq+SvE+tMCSCq/ygcpQo0E+AAsl+cDrMf7UXHW77JDa4sX6 vp2ae1hjzwfLuKv9GCvH5cM= X-Received: by 2002:a1c:7c01:: with SMTP id x1mr3800243wmc.57.1600165926455; Tue, 15 Sep 2020 03:32:06 -0700 (PDT) Received: from liuwe-devbox-debian-v2 ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id n21sm24208316wmi.21.2020.09.15.03.32.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2020 03:32:06 -0700 (PDT) Date: Tue, 15 Sep 2020 10:32:04 +0000 From: Wei Liu To: Vitaly Kuznetsov Cc: Wei Liu , Linux on Hyper-V List , virtualization@lists.linux-foundation.org, Linux Kernel List , Michael Kelley , Vineeth Pillai , Sunil Muthuswamy , Nuno Das Neves , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Daniel Lezcano , Thomas Gleixner Subject: Re: [PATCH RFC v1 05/18] clocksource/hyperv: use MSR-based access if running as root Message-ID: <20200915103204.53zlqx4jq7z2hpjw@liuwe-devbox-debian-v2> References: <20200914112802.80611-1-wei.liu@kernel.org> <20200914112802.80611-6-wei.liu@kernel.org> <874knzl5ab.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <874knzl5ab.fsf@vitty.brq.redhat.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 15, 2020 at 12:10:04PM +0200, Vitaly Kuznetsov wrote: > Wei Liu writes: > > > Signed-off-by: Wei Liu > > --- > > drivers/clocksource/hyperv_timer.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c > > index 09aa44cb8a91..fe96082ce85e 100644 > > --- a/drivers/clocksource/hyperv_timer.c > > +++ b/drivers/clocksource/hyperv_timer.c > > @@ -426,6 +426,9 @@ static bool __init hv_init_tsc_clocksource(void) > > if (!(ms_hyperv.features & HV_MSR_REFERENCE_TSC_AVAILABLE)) > > return false; > > > > + if (hv_root_partition) > > + return false; > > + > > Out of pure curiosity, > > TSC page clocksource seems to be available to the root partition (as > HV_MSR_REFERENCE_TSC_AVAILABLE is set), why don't we use it? (I > understand that with TSC scaling support in modern CPUs even migration > is a no-issue and we can use raw TSC but this all seems to be > independent from root/non-root partition question). > Yes. It is available to the root partition. An earlier version of this patch did use that. With some major restructuring of the code between 4.19 and 5.6 (splitting out the clocksource to and getting initialized earlier), the old code wouldn't work anymore. The catch is that the page will have been set up by the hypervisor, so in the function we will need to take a different path. And making that work again on 5.8 requires a bit more code churn. Like I said in the cover letter, this is the bare minimum to get things going. I try not distract people too much with less important stuff at this stage, but making the reference TSC work again is definitely something we want to look into in the future. Wei. > > hv_read_reference_counter = read_hv_clock_tsc; > > phys_addr = virt_to_phys(hv_get_tsc_page()); > > -- > Vitaly >