linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Peter Zijlstra <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: peterz@infradead.org, rafael.j.wysocki@intel.com,
	linux-kernel@vger.kernel.org, tglx@linutronix.de,
	diego.viola@gmail.com, mingo@kernel.org, hpa@zytor.com
Subject: [tip:timers/urgent] x86/tsc: Fix mark_tsc_unstable()
Date: Wed, 2 May 2018 07:14:21 -0700	[thread overview]
Message-ID: <tip-e3b4f79025e0a4eb7e2a2c7d24dadfa1e38893b0@git.kernel.org> (raw)
In-Reply-To: <20180430100344.533326547@infradead.org>

Commit-ID:  e3b4f79025e0a4eb7e2a2c7d24dadfa1e38893b0
Gitweb:     https://git.kernel.org/tip/e3b4f79025e0a4eb7e2a2c7d24dadfa1e38893b0
Author:     Peter Zijlstra <peterz@infradead.org>
AuthorDate: Mon, 30 Apr 2018 12:00:12 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 2 May 2018 16:10:40 +0200

x86/tsc: Fix mark_tsc_unstable()

mark_tsc_unstable() also needs to affect tsc_early, Now that
clocksource_mark_unstable() can be used on a clocksource irrespective of
its registration state, use it on both tsc_early and tsc.

This does however require cs->list to be initialized empty, otherwise it
cannot tell the registation state before registation.

Fixes: aa83c45762a2 ("x86/tsc: Introduce early tsc clocksource")
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Diego Viola <diego.viola@gmail.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: len.brown@intel.com
Cc: rjw@rjwysocki.net
Cc: rui.zhang@intel.com
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20180430100344.533326547@infradead.org

---
 arch/x86/kernel/tsc.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 23f36bc236ba..74392d9d51e0 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -1067,6 +1067,7 @@ static struct clocksource clocksource_tsc_early = {
 	.resume			= tsc_resume,
 	.mark_unstable		= tsc_cs_mark_unstable,
 	.tick_stable		= tsc_cs_tick_stable,
+	.list			= LIST_HEAD_INIT(clocksource_tsc_early.list),
 };
 
 /*
@@ -1086,6 +1087,7 @@ static struct clocksource clocksource_tsc = {
 	.resume			= tsc_resume,
 	.mark_unstable		= tsc_cs_mark_unstable,
 	.tick_stable		= tsc_cs_tick_stable,
+	.list			= LIST_HEAD_INIT(clocksource_tsc.list),
 };
 
 void mark_tsc_unstable(char *reason)
@@ -1098,13 +1100,9 @@ void mark_tsc_unstable(char *reason)
 		clear_sched_clock_stable();
 	disable_sched_clock_irqtime();
 	pr_info("Marking TSC unstable due to %s\n", reason);
-	/* Change only the rating, when not registered */
-	if (clocksource_tsc.mult) {
-		clocksource_mark_unstable(&clocksource_tsc);
-	} else {
-		clocksource_tsc.flags |= CLOCK_SOURCE_UNSTABLE;
-		clocksource_tsc.rating = 0;
-	}
+
+	clocksource_mark_unstable(&clocksource_tsc_early);
+	clocksource_mark_unstable(&clocksource_tsc);
 }
 
 EXPORT_SYMBOL_GPL(mark_tsc_unstable);

  reply	other threads:[~2018-05-02 14:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-30 10:00 [PATCH v2 0/7] Various tsc/clocksource fixes Peter Zijlstra
2018-04-30 10:00 ` [PATCH v2 1/7] x86,tsc: Always unregister clocksource_tsc_early Peter Zijlstra
2018-05-02 14:12   ` [tip:timers/urgent] x86/tsc: " tip-bot for Peter Zijlstra
2018-04-30 10:00 ` [PATCH v2 2/7] clocksource: Allow clocksource_mark_unstable() on unregisered clocksources Peter Zijlstra
2018-05-02 13:35   ` Thomas Gleixner
2018-05-02 13:53     ` Peter Zijlstra
2018-05-02 14:13       ` [tip:timers/urgent] clocksource: Allow clocksource_mark_unstable() on unregistered clocksources tip-bot for Peter Zijlstra
2018-04-30 10:00 ` [PATCH v2 3/7] clocksource: Initialize cs->wd_list Peter Zijlstra
2018-05-02 13:37   ` Thomas Gleixner
2018-05-02 13:55     ` Peter Zijlstra
2018-05-02 14:13   ` [tip:timers/urgent] " tip-bot for Peter Zijlstra
2018-04-30 10:00 ` [PATCH v2 4/7] x86,tsc: Fix mark_tsc_unstable() Peter Zijlstra
2018-05-02 14:14   ` tip-bot for Peter Zijlstra [this message]
2018-04-30 10:00 ` [PATCH v2 5/7] clocksource: Consistent de-rate when marking unstable Peter Zijlstra
2018-05-02 14:14   ` [tip:timers/urgent] " tip-bot for Peter Zijlstra
2018-04-30 10:00 ` [PATCH v2 6/7] clocksource: Rework stale comment Peter Zijlstra
2018-05-02 14:15   ` [tip:timers/urgent] " tip-bot for Peter Zijlstra
2018-04-30 10:00 ` [PATCH v2 7/7] clocksource: Remove kthread Peter Zijlstra
2018-05-02 14:42   ` [tip:timers/core] " tip-bot for Peter Zijlstra
2018-05-01  9:12 ` [PATCH v2 0/7] Various tsc/clocksource fixes Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-e3b4f79025e0a4eb7e2a2c7d24dadfa1e38893b0@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=diego.viola@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).