Date: Fri, 03 Jun 2011 15:12:52 +0300 From: Andriy Gapon <avg@FreeBSD.org> To: John Baldwin <jhb@FreeBSD.org> Cc: freebsd-hackers@FreeBSD.org, Jung-uk Kim <jkim@FreeBSD.org> Subject: Re: [RFC] Enabling invariant TSC timecounter on SMP Message-ID: <4DE8CFC4.8070602@FreeBSD.org> In-Reply-To: <201106030750.37264.jhb@freebsd.org> References: <201105241356.45543.jkim@FreeBSD.org> <201106011655.51233.jkim@FreeBSD.org> <4DE8794B.60100@FreeBSD.org> <201106030750.37264.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
on 03/06/2011 14:50 John Baldwin said the following: > On Friday, June 03, 2011 2:03:55 am Andriy Gapon wrote: >>> Consecutive RDTSCs used on a same CPU is always incremental but we >>> cannot 100% guarantee that on two cores, even if TSC is derived from >>> the same clock. I am hoping at least latency difference (I believe >>> it's about few tens of cycles max) is "eaten up" by lowering >>> resolution. It's not perfect but it's better than serialization >>> (Linux) or heuristics (OpenSolaris), just because there are few rare >>> conditions to consider. Thoughts? >> >> I am still not sure which case this code should solve. >> >> Thread T1: x1 = rdtsc() on CPU1; >> Thread T1: x2 = rdtsc() on CPU2; >> x2 < x1 ? >> Or? > > Yes, that can happen. Well, I think that the test based on smp_rendezvous should ensure that difference in TSC values is "small enough"; that is, I expect that cost (in TSC ticks) of migrating a thread from CPU to CPU should be larger than that difference if the test was passed. Is this an unreasonable expectation? -- Andriy Gapon
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4DE8CFC4.8070602>