From patchwork Wed Aug 12 18:42:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kelsey Skunberg X-Patchwork-Id: 1343845 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BRdqm71Bjz9sTN; Thu, 13 Aug 2020 04:43:00 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1k5viD-0003V1-36; Wed, 12 Aug 2020 18:42:57 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1k5viB-0003Ty-N9 for kernel-team@lists.ubuntu.com; Wed, 12 Aug 2020 18:42:55 +0000 Received: from mail-oi1-f198.google.com ([209.85.167.198]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1k5viB-0006ys-Ba for kernel-team@lists.ubuntu.com; Wed, 12 Aug 2020 18:42:55 +0000 Received: by mail-oi1-f198.google.com with SMTP id c137so1576418oig.6 for ; Wed, 12 Aug 2020 11:42:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d3j9lWMiTHnqq6rfmZZivNpyTmkNUcHj4USMa6dXB9g=; b=MB6UxCzOS0tJo2pC/3PPngp5Rp5uFULl1NRn+cqJhwZX0CVgOfk//q8qhuvmd7ShmY VV3dTyxsv+ZV6HSxdXiLbvfsdLfUiajp3hXfcjheCEgcDZXmUXSW9Vvw5ZzbUqsWzmuM b1H61y4MB7j5qGJPW6wPZzl+UJ8GNDT1Mb+bXmcXO5p6GDQTACbtQqjM5iJVzs4HtECt xLF3qx8MJ4/FiAQyS44HGVgYr6qra+TCMKdXc2AqjQmXMZaSOH2PbY5BqZ2fIwDIatTq K0Gpo+D99in1bJWKdKQL1oelIsHlJFSuQBxvlXZeZ8aC47cbUqaRbcL1J2xlPXPyMqlR ZGQQ== X-Gm-Message-State: AOAM5335kM5mws1QRsVJZnJKcFtFqZ+bR2zGsXWjdlBnPuVwZ2afce/U VTIVSfRwhUPkINh9DVmlalZmD4rlSu5g1SyQawvazu0M68t+CwG9vU1E9jKm14KBSyY7gj2ZPQt QARIt9tNdR23vkzsT6dihGj9i/1Zl6GC2wKAgsbsPoA== X-Received: by 2002:a9d:53c1:: with SMTP id i1mr991037oth.161.1597257773548; Wed, 12 Aug 2020 11:42:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbvSmiquZwIbe+ZDQ6Wo19mRPio98d/ItX6PtAV9MJWNETM3emWmlflAfxIMW8pizRsjnejw== X-Received: by 2002:a9d:53c1:: with SMTP id i1mr991021oth.161.1597257773244; Wed, 12 Aug 2020 11:42:53 -0700 (PDT) Received: from localhost.localdomain (c-73-243-191-173.hsd1.co.comcast.net. [73.243.191.173]) by smtp.gmail.com with ESMTPSA id x70sm644522oif.3.2020.08.12.11.42.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2020 11:42:52 -0700 (PDT) From: Kelsey Skunberg To: kernel-team@lists.ubuntu.com Subject: [focal:linux-azure][SRU][PATCH v2 4/4] clocksource/drivers/hyper-v: Set TSC clocksource as default w/ InvariantTSC Date: Wed, 12 Aug 2020 12:42:46 -0600 Message-Id: <20200812184246.14738-5-kelsey.skunberg@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200812184246.14738-1-kelsey.skunberg@canonical.com> References: <20200812184246.14738-1-kelsey.skunberg@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Andrea Parri BugLink: https://bugs.launchpad.net/bugs/1875467 Change the Hyper-V clocksource ratings to 250, below the TSC clocksource rating of 300. In configurations where Hyper-V offers an InvariantTSC, the TSC is not marked "unstable", so the TSC clocksource is available and preferred. With the higher rating, it will be the default. On older hardware and Hyper-V versions, the TSC is marked "unstable", so no TSC clocksource is created and the selected Hyper-V clocksource will be the default. Signed-off-by: Andrea Parri Reviewed-by: Michael Kelley Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20200109160650.16150-3-parri.andrea@gmail.com (backported from commit 9e0333ae38eeb42249e10f95d209244a6e22ac9f) [KelseyS: context changes to allow backporting] Signed-off-by: Kelsey Skunberg --- drivers/clocksource/hyperv_timer.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c index 3325ec9bc67e..038539ab019a 100644 --- a/drivers/clocksource/hyperv_timer.c +++ b/drivers/clocksource/hyperv_timer.c @@ -302,6 +302,14 @@ EXPORT_SYMBOL_GPL(hv_stimer_global_cleanup); * the other that uses the TSC reference page feature as defined in the * TLFS. The MSR version is for compatibility with old versions of * Hyper-V and 32-bit x86. The TSC reference page version is preferred. + * + * The Hyper-V clocksource ratings of 250 are chosen to be below the + * TSC clocksource rating of 300. In configurations where Hyper-V offers + * an InvariantTSC, the TSC is not marked "unstable", so the TSC clocksource + * is available and preferred. With the higher rating, it will be the + * default. On older hardware and Hyper-V versions, the TSC is marked + * "unstable", so no TSC clocksource is created and the selected Hyper-V + * clocksource will be the default. */ struct clocksource *hyperv_cs; @@ -356,7 +364,7 @@ static void resume_hv_clock_tsc(struct clocksource *arg) static struct clocksource hyperv_cs_tsc = { .name = "hyperv_clocksource_tsc_page", - .rating = 400, + .rating = 250, .read = read_hv_clock_tsc, .mask = CLOCKSOURCE_MASK(64), .flags = CLOCK_SOURCE_IS_CONTINUOUS, @@ -384,7 +392,7 @@ static u64 read_hv_sched_clock_msr(void) static struct clocksource hyperv_cs_msr = { .name = "hyperv_clocksource_msr", - .rating = 400, + .rating = 250, .read = read_hv_clock_msr, .mask = CLOCKSOURCE_MASK(64), .flags = CLOCK_SOURCE_IS_CONTINUOUS,