* Re: [PATCH] x86: tsc: fix L2 guest always in tsc_early clocksource
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
0 siblings, 0 replies; 2+ messages in thread
From: Peter Zijlstra @ 2018-04-23 19:37 UTC (permalink / raw)
To: Peng Hao; +Cc: tglx, pbonzini, mingo, x86, len.brown, linux-kernel
On Tue, Apr 24, 2018 at 09:08:54AM +0800, Peng Hao wrote:
> 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.
Help me out a little. What's an L2 guest?
And I'm assuming you don't have HPET and then end up wanting to use
PM-timer? Which is also busted and resturns crap results?
So if the whole TSC sync has no way of ever working; what is your patch
doing? How is the actual TSC calibrated?
Should you instead be using fast_calibrate() and passing in a known
value from the host? Thereby avoiding all this calibration nonsense
entirely.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [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 related [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;
as well as URLs for NNTP newsgroup(s).