mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86: tsc: fix L2 guest always in tsc_early clocksource
@ 2018-04-24  1:08 Peng Hao
  2018-04-23 19:37 ` Peter Zijlstra
  0 siblings, 1 reply; 2+ messages in thread
From: Peng Hao @ 2018-04-24  1:08 UTC (permalink / raw)
  To: tglx, pbonzini, mingo, x86, peterz, len.brown; +Cc: linux-kernel, Peng Hao

In L2 guest tsc_read_refs always return ULLONG_MAX, and that will
call tsc_refine_calibration_work periodly. So L2 guest will read
acpi timer port 0x608 periodly.
The patch will let it out of "if(tsc_start == -1){}" infinite loop.

Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
---
 arch/x86/kernel/tsc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index ef32297..828ef50 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -1236,7 +1236,7 @@ struct system_counterval_t convert_art_ns_to_tsc(u64 art_ns)
  */
 static void tsc_refine_calibration_work(struct work_struct *work)
 {
-	static u64 tsc_start = -1, ref_start;
+	static u64 tsc_start = 0, ref_start;
 	static int hpet;
 	u64 tsc_stop, ref_stop, delta;
 	unsigned long freq;
@@ -1251,7 +1251,7 @@ static void tsc_refine_calibration_work(struct work_struct *work)
 	 * delayed the first time we expire. So set the workqueue
 	 * again once we know timers are working.
 	 */
-	if (tsc_start == -1) {
+	if (tsc_start == 0) {
 		/*
 		 * Only set hpet once, to avoid mixing hardware
 		 * if the hpet becomes enabled later.
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-23 19:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-24  1:08 [PATCH] x86: tsc: fix L2 guest always in tsc_early clocksource Peng Hao
2018-04-23 19:37 ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®