NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/53016: Clock not stable



The following reply was made to PR kern/53016; it has been noted by GNATS.

From: Nathanial Sloss <nat%netbsd.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: kern/53016: Clock not stable
Date: Thu, 17 May 2018 13:27:53 +1000

 --Boundary-00=_6aP/apxLurubmRJ
 Content-Type: Text/Plain;
   charset="us-ascii"
 Content-Transfer-Encoding: 7bit
 
 Hi,
 
 My proposal, which seems to work is to only read the tsc register from the 
 boot cpu ensuring there is no discrepancy between tsc counters between cpus.
 
 With this patch the wall clock and assoc times seem to be stable.
 
 Best regards,
 
 Nat
 
 --Boundary-00=_6aP/apxLurubmRJ
 Content-Type: text/x-patch;
   charset="ISO-8859-1";
   name="tsc.c.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename="tsc.c.diff"
 
 Index: tsc.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/x86/x86/tsc.c,v
 retrieving revision 1.37
 diff -u -p -r1.37 tsc.c
 --- tsc.c	2 Oct 2017 19:23:16 -0000	1.37
 +++ tsc.c	17 May 2018 03:25:07 -0000
 @@ -314,7 +314,7 @@ cpu_hascounter(void)
  uint64_t
  cpu_counter_serializing(void)
  {
 -	if (tsc_good)
 +	if (tsc_good && curcpu() == tsc_sync_cpu)
  		return rdmsr(MSR_TSC);
  	else
  		return cpu_counter();
 
 --Boundary-00=_6aP/apxLurubmRJ--
 


Home | Main Index | Thread Index | Old Index