From patchwork Mon Sep 7 04:15:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Ruffell X-Patchwork-Id: 1358554 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 4BlFMC2cqCz9sSP; Mon, 7 Sep 2020 14:15:50 +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 1kF8ZB-0001de-9H; Mon, 07 Sep 2020 04:15:41 +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 1kF8Z9-0001dJ-Ib for kernel-team@lists.ubuntu.com; Mon, 07 Sep 2020 04:15:39 +0000 Received: from mail-pg1-f199.google.com ([209.85.215.199]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kF8Z9-0007uv-5G for kernel-team@lists.ubuntu.com; Mon, 07 Sep 2020 04:15:39 +0000 Received: by mail-pg1-f199.google.com with SMTP id m16so5483167pgl.16 for ; Sun, 06 Sep 2020 21:15:39 -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=XBVDiKVGMwx36nnVSQCVU/vQsU865y3dkNp23R6SPAY=; b=iSpS1CfrbCVJpweQ7PGMzhIMAFP99GLakXCl6jLV896OkzYLCUObd8F8P8fqkQv96z s1bzzfjdkpdrk2bXQTx+xVVqwLgoZ69aA5cZvir/UxBxZJHkl7kRpEmiV8gcLbQC1ZOk QxHnX/HOLaALcSxRsJ3XeQDPNrnvGTN48VxqT4uxnI9BVS0kdnJX3d52pZM05oZu9SZ6 VmmDFbUgy4UGGeLIcsv3u4rVzhG8PqvPR2m9tUscvMM9subbs7MnCjAhjNluBrYOtyQg WxjzNE/vPlNQrOJ/QKbWLWgJi8d2Gz6okWyJysWbRMPmPc9ezmeOILFfRqCVD/hYQkUb 16bQ== X-Gm-Message-State: AOAM530UiF//ossRVMQQvPTSOlfbEjDIp5W0Z3tuc3j7GtLRl3qtJPA6 iCOwLUfJ69C+yYi/H1bxKvE8wT5O0zIe5V/MDcS5yVgNNidie/aeUGzfcJxhzFJMM0ZKH2t7lrW GBq2JHtMuaHVxPCDvJTDKtNZpWGzY4IFVFNqX5WLDRw== X-Received: by 2002:a17:90a:e207:: with SMTP id a7mr11747829pjz.117.1599452137617; Sun, 06 Sep 2020 21:15:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfRdQLc2l+7YWuMkQp6HXbvRX/X1djur7HHTUaY8lslKWmC+fqVwk/kRflkg3HG88zImn0xw== X-Received: by 2002:a17:90a:e207:: with SMTP id a7mr11747814pjz.117.1599452137223; Sun, 06 Sep 2020 21:15:37 -0700 (PDT) Received: from localhost.localdomain (222-152-178-139-fibre.sparkbb.co.nz. [222.152.178.139]) by smtp.gmail.com with ESMTPSA id lb1sm10009635pjb.26.2020.09.06.21.15.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Sep 2020 21:15:36 -0700 (PDT) From: Matthew Ruffell To: kernel-team@lists.ubuntu.com Subject: [SRU][X][PATCH 1/1] clocksource: Defer override invalidation unless clock is unstable Date: Mon, 7 Sep 2020 16:15:28 +1200 Message-Id: <20200907041528.12540-2-matthew.ruffell@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200907041528.12540-1-matthew.ruffell@canonical.com> References: <20200907041528.12540-1-matthew.ruffell@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: Kyle Walker BugLink: https://bugs.launchpad.net/bugs/1894591 Clocksources don't get the VALID_FOR_HRES flag until they have been checked by a watchdog. However, when using an override, the clocksource_select logic will clear the override value if the clocksource is not marked VALID_FOR_HRES during that inititial check. When using the boot arguments clocksource=, this selection can run before the watchdog, and can cause the override to be incorrectly cleared. To address this condition, the override_name is only invalidated for unstable clocksources. Otherwise, the override is left intact until after the watchdog has validated the clocksource as stable/unstable. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Richard Cochran Cc: Prarit Bhargava Cc: Martin Schwidefsky Signed-off-by: Kyle Walker Signed-off-by: John Stultz (cherry picked from commit 36374583f9084cdab4b5dcf5521a3ce55bebb9fa) Signed-off-by: Matthew Ruffell Acked-by: Kleber Sacilotto de Souza Acked-by: William Breathitt Gray --- kernel/time/clocksource.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index a20368e1a720..ac4c84361be0 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -607,9 +607,18 @@ static void __clocksource_select(bool skipcur) */ if (!(cs->flags & CLOCK_SOURCE_VALID_FOR_HRES) && oneshot) { /* Override clocksource cannot be used. */ - pr_warn("Override clocksource %s is not HRT compatible - cannot switch while in HRT/NOHZ mode\n", - cs->name); - override_name[0] = 0; + if (cs->flags & CLOCK_SOURCE_UNSTABLE) { + pr_warn("Override clocksource %s is unstable and not HRT compatible - cannot switch while in HRT/NOHZ mode\n", + cs->name); + override_name[0] = 0; + } else { + /* + * The override cannot be currently verified. + * Deferring to let the watchdog check. + */ + pr_info("Override clocksource %s is not currently HRT compatible - deferring\n", + cs->name); + } } else /* Override clocksource can be used. */ best = cs;