Date: Wed, 23 Dec 2020 19:21:27 +0200 From: Konstantin Belousov <kostikbel@gmail.com> To: Maxim Sobolev <sobomax@freebsd.org> Cc: src-committers <src-committers@freebsd.org>, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 84eaf2ccc6aa - x86: stop punishing VMs with low priority for TSC timecounter Message-ID: <X%2BN8l419NshP3LZD@kib.kiev.ua> In-Reply-To: <CAH7qZfvizCemKP4xENWdvEjOg5n7wLayuCPmpE_sFs5L8_OF4g@mail.gmail.com> References: <202012231046.0BNAkAEw027089@gitrepo.freebsd.org> <CAH7qZfvizCemKP4xENWdvEjOg5n7wLayuCPmpE_sFs5L8_OF4g@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Dec 23, 2020 at 08:59:54AM -0800, Maxim Sobolev wrote: > Thanks! The slowdown in my experience mostly comes from the fact that only > TSC has userspace-mapped implementation for the clock_gettime(2) and > friends. Combined of course with the fact that syscall is still HPET has userspace implementation, but of course HPET page access is slower by several orders than RDTSC, if hypervisor is not involved. That said, it really depends on hypervisor. It is possible to trap RDTSC* and some hypervisors do that. Some use feature available on most Intel machines, where tsc can be adjusted by some fixed amount, which avoids VMX exit. Other clocks, like typically used ACPI-fast or i8254 if TSC is disabled, always require VMX exit in addition to syscall, that makes gettimeofday() prohibitely slow. > horrendously expensive on VM. So if you have say 10 threads calling > clock_gettime() 100 times per second (not uncommon for RTP/RTC apps) that > causes 1,000 context switches just to do that. Let alone any useful > workload the app might be doing. > > Unless the MFC is planned it might also be a good idea to document that for > 12.x/11.x, the issue can easily be worked around by forcing TSC via loader > tunable / sysctl. I plan to do MFC, but plan to give a long time for this change in HEAD to see complains. Although in practicy I rarely get good feedback before such kind of changes are merged to stable.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?X%2BN8l419NshP3LZD>