Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1800442pxu; Tue, 24 Nov 2020 09:11:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5nZcKYathCxoDCPNexWMzUNDYrlTvGUrL5wHLgWpoacV/FU1QrP/lf9YbwLzZtU/ex3fR X-Received: by 2002:a05:6402:22e1:: with SMTP id dn1mr4960101edb.142.1606237916997; Tue, 24 Nov 2020 09:11:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606237916; cv=none; d=google.com; s=arc-20160816; b=rQeZAEsvhHOB/LrbrbmY809pmcLI8GasHZQlATpzIa668CjikbICEiT1+MRzX8hxUB XcDYPbqI9+zxulBcfH2DfwhZpGfPQh7jgmh/3YleYKPwiNYbPZZEY6HtFri2YeVlvH1j 5opFmMYuMj3VwZmTwuLMbvNL48eoE4VCeif2z5/sPlWAATVQBJ7KOhlvXK9+jDZMFTn/ 7zBafhAjSKs3AV3YQDWedwedV02b7gtDOkwKeiDjTEcdaHX6M7ACiBMrU3/Ry/3aF2+T k7x1t9T0m6QibdC7p0gQuyaC9OhrIAHiEyDEPC3LSp8H3ASaF0q1kLFxns/yWEfTvFEs LpVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=5A3GMg0kaUdhNbdjiZ51gEYmRqMxSWUTkm0nm29z41k=; b=mmclVWAGmCepmXy/7VhJ6pSB3lqTjfJ8lQQTAZZNARb4ImgM8wL8xat0mUvxGS19o4 ZGuiUVRn+x/yF5fxjnz0G+dSRvUb8VZiB58HArWiHUGCgoOYIZZ0U3TqCStP9pn/y/zF mOIQNup/WdvS406EBIlOexgscEc0BKmmBRfZu4YPA2Zu26PtIFC2RliivVeyNfodygtE s0JNkDfXVMKxg4j6V/5bnq6u5guvK5aOTNjpKFKKvBOlYwwCRW3/TyJ7PTZhDuIazmmg jhPXA9mhGFyUUMSx6ZIqrSbe8SL+lJUJOJFdgeh8oorbAPXWxWxvR1sU6JX0jor+Q1Ws 9r+g== 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 b4si4211852ejc.589.2020.11.24.09.11.32; Tue, 24 Nov 2020 09:11:56 -0800 (PST) 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 S2390698AbgKXRH5 (ORCPT + 99 others); Tue, 24 Nov 2020 12:07:57 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:38969 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390631AbgKXRHz (ORCPT ); Tue, 24 Nov 2020 12:07:55 -0500 Received: by mail-wm1-f68.google.com with SMTP id s13so3619888wmh.4; Tue, 24 Nov 2020 09:07:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5A3GMg0kaUdhNbdjiZ51gEYmRqMxSWUTkm0nm29z41k=; b=Ke798OeulGthIouymUM9kjTbt7oiEgBB92bNnLlxeZbRWFgVSCWPFcMRRUeJ2G+STr 50iZx7EvTNp3dUe3b2SbmTbSfvjMPb8j1pDeSxIeqyZ3ivLZzpq1/tChTH9LhxIbKN67 PulnupHQPyrODUUUCXqZfaXmCq/09TivTq7HG+GuehzJTWW/c5nVgyWD/qY5enHUtdoA 9gsvOWp/XpHaAJlw9BDHRdRAUrwDfVrqvugmmrHiBObJokUS+xUQKmmiUr62WtWXEeFv luIAYhk2j7Im8pq6f0WOrQkUFChP2BGH01S2Vc2KK2p9ESnpd8Yyw57OdRQxbjs3FY2o TgeQ== X-Gm-Message-State: AOAM531fR62ThxXbaH549m66XAIHBhp0y8Vfh6XgiOfVeUOXEeZeqkra bN/i6hbXHCe/ztus4xvQ+7HfMrco4XI= X-Received: by 2002:a1c:9ad0:: with SMTP id c199mr5387178wme.46.1606237672950; Tue, 24 Nov 2020 09:07:52 -0800 (PST) Received: from liuwe-devbox-debian-v2.j3c5onc20sse1dnehy4noqpfcg.zx.internal.cloudapp.net ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id v20sm6419874wmh.44.2020.11.24.09.07.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Nov 2020 09:07:52 -0800 (PST) From: Wei Liu To: Linux on Hyper-V List Cc: virtualization@lists.linux-foundation.org, Linux Kernel List , Michael Kelley , Vineeth Pillai , Sunil Muthuswamy , Nuno Das Neves , Wei Liu , Daniel Lezcano , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Thomas Gleixner Subject: [PATCH v3 05/17] clocksource/hyperv: use MSR-based access if running as root Date: Tue, 24 Nov 2020 17:07:32 +0000 Message-Id: <20201124170744.112180-6-wei.liu@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201124170744.112180-1-wei.liu@kernel.org> References: <20201124170744.112180-1-wei.liu@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When Linux runs as the root partition, the setup required for TSC page is different. Luckily Linux also has access to the MSR based clocksource. We can just disable the TSC page clocksource if Linux is the root partition. Signed-off-by: Wei Liu Acked-by: Daniel Lezcano --- 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 ba04cb381cd3..269a691bd2c4 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; + hv_read_reference_counter = read_hv_clock_tsc; phys_addr = virt_to_phys(hv_get_tsc_page()); -- 2.20.1