From owner-freebsd-current@freebsd.org Wed Jan 20 10:18:53 2021 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D2194F0D83 for ; Wed, 20 Jan 2021 10:18:53 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLM1n085dz4Vrk for ; Wed, 20 Jan 2021 10:18:52 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 10KAIiTg078614 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 20 Jan 2021 12:18:47 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 10KAIiTg078614 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 10KAIiDF078613; Wed, 20 Jan 2021 12:18:44 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 20 Jan 2021 12:18:44 +0200 From: Konstantin Belousov To: Jakob Alvermark Cc: freebsd-current Subject: Re: Waiting for bufdaemon Message-ID: References: <369b3d82-98c5-b31e-6168-4003a042f174@FreeBSD.org> <556d40b8-92d7-303e-7d87-ea496d0ca733@FreeBSD.org> <9ae3cc65-193a-39c3-4067-0d42e9f634b0@gwdg.de> <1d675d77-8bdb-c285-ffa2-28330b839734@alvermark.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1d675d77-8bdb-c285-ffa2-28330b839734@alvermark.net> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4DLM1n085dz4Vrk X-Spamd-Bar: / X-Spamd-Result: default: False [-1.00 / 15.00]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2001:470:d5e7:1::1:from]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_SPF_SOFTFAIL(0.00)[~all:c]; NEURAL_SPAM_SHORT(1.00)[1.000]; SPAMHAUS_ZRD(0.00)[2001:470:d5e7:1::1:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[freebsd-current]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 10:18:53 -0000 On Wed, Jan 20, 2021 at 11:02:21AM +0100, Jakob Alvermark wrote: > This patch hides the problem for me. The system seems to work better now. > > No waiting on reboot, and the webcam works better. I am curious what do you mean by the above reference to webcam. Can you explain it with more details, even if only the impressions? I probably going to commit the following patch in the next 24 hours. commit 02505d07bca320a638c96918ac9076c6eece2fff Author: Konstantin Belousov Date: Wed Jan 20 11:32:21 2021 +0200 AMD Zen CPUs: switch TSC timecounter to RDTSCP Reported by: many MFC after: 1 weel Sponsored by: The FreeBSD Foundation diff --git a/lib/libc/x86/sys/__vdso_gettc.c b/lib/libc/x86/sys/__vdso_gettc.c index 7f224f8758cb..7a64f2a0b556 100644 --- a/lib/libc/x86/sys/__vdso_gettc.c +++ b/lib/libc/x86/sys/__vdso_gettc.c @@ -125,7 +125,7 @@ struct tsc_selector_tag { }; static const struct tsc_selector_tag tsc_selector[] = { - [0] = { /* Intel or AMD Zen+, LFENCE */ + [0] = { /* Intel, LFENCE */ .ts_rdtsc32 = rdtsc32_mb_lfence, .ts_rdtsc_low = rdtsc_low_mb_lfence, }, @@ -164,9 +164,6 @@ tsc_selector_idx(u_int cpu_feature) do_cpuid(1, p); cpu_id = p[0]; - if (amd_cpu && CPUID_TO_FAMILY(cpu_id) >= 0x17) - return (0); - if (cpu_feature != 0) { do_cpuid(0x80000000, p); cpu_exthigh = p[0]; diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c index 85924df98312..de0a1505c2f6 100644 --- a/sys/x86/x86/tsc.c +++ b/sys/x86/x86/tsc.c @@ -633,19 +633,12 @@ init_TSC_tc(void) /* * Timecounter implementation selection, top to bottom: - * - For AMD Zens and newer, use LFENCE;RDTSC. * - If RDTSCP is available, use RDTSCP. * - If fence instructions are provided (SSE2), use LFENCE;RDTSC * on Intel, and MFENCE;RDTSC on AMD. * - For really old CPUs, just use RDTSC. */ - if ((cpu_vendor_id == CPU_VENDOR_AMD || - cpu_vendor_id == CPU_VENDOR_HYGON) && - CPUID_TO_FAMILY(cpu_id) >= 0x17) { - tsc_timecounter.tc_get_timecount = shift > 0 ? - tsc_get_timecount_low_lfence : - tsc_get_timecount_lfence; - } else if ((amd_feature & AMDID_RDTSCP) != 0) { + if ((amd_feature & AMDID_RDTSCP) != 0) { tsc_timecounter.tc_get_timecount = shift > 0 ? tscp_get_timecount_low : tscp_get_timecount; } else if ((cpu_feature & CPUID_SSE2) != 0 && mp_ncpus > 1) {