Date: Fri, 18 Mar 2016 12:38:42 -0700 From: John Baldwin <jhb@freebsd.org> To: Stanislav Sedov <stas@freebsd.org> Cc: Ryan Stone <rysto32@gmail.com>, Adrian Chadd <adrian.chadd@gmail.com>, Konstantin Belousov <kostikbel@gmail.com>, "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org> Subject: Re: Peformance issues with r278325 Message-ID: <3213721.SRyKE0LtiG@ralph.baldwin.cx> In-Reply-To: <59BA610B-3754-43D6-839D-84FEE8F13CF7@FreeBSD.org> References: <FA50A68E-7F3D-4361-8A8A-EB7F97EF3D00@FreeBSD.org> <CAFMmRNz1PnzHDstZ4sgMs7aTgA_c0ydkxaFCi%2B8We6k3GG8wGw@mail.gmail.com> <59BA610B-3754-43D6-839D-84FEE8F13CF7@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Friday, March 18, 2016 11:58:19 AM Stanislav Sedov wrote: > > > On Mar 18, 2016, at 11:49 AM, Ryan Stone <rysto32@gmail.com> wrote: > > > > On Fri, Mar 18, 2016 at 1:37 PM, John Baldwin <jhb@freebsd.org> wrote: > > I think I'll likely just convert it to use a direct > > TSC delay loop always in HEAD (assuming that verifies ok in testing as well). > > > > Couldn't that work incorrectly on VM guests? The tsc is not guaranteed to be monotonic in that environment. > > > > Another concern is SMP systems where the clock is not synchronized. SMP TSC requires > a complicated setup procedure on the system boot which is not followed properly by all > vendors, and I have seen some recent systems with SMP TSC skew. > > I'm afraid that using TSC in this code will make FreeBSD unusable on such (arguably buggy) > systems. Eh, SMP does not matter here. DELAY() already uses TSC on FreeBSD. The current thread is pinned to a single CPU in lapic_ipi_wait(). The idea would be to do this: deadline = rdtsc() + freq * delay / 1000000; while (rdtsc() < deadline) { if (APIC_DELSTAT_IDLE) return (1); ia32_pause(); } -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3213721.SRyKE0LtiG>