From owner-freebsd-current@freebsd.org Wed Jan 20 10:37:07 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 42C274F1312 for ; Wed, 20 Jan 2021 10:37:07 +0000 (UTC) (envelope-from jakob@alvermark.net) Received: from out.alvermark.net (out.alvermark.net [185.34.136.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLMQp4JFfz4WQF for ; Wed, 20 Jan 2021 10:37:06 +0000 (UTC) (envelope-from jakob@alvermark.net) Received: from c-f649235c.06-431-73746f70.bbcust.telenor.se ([92.35.73.246] helo=mail.alvermark.net) by out.alvermark.net with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91 (FreeBSD)) (envelope-from ) id 1l2ArJ-000FuV-9I; Wed, 20 Jan 2021 11:37:05 +0100 Received: from [192.168.67.27] by mail.alvermark.net with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91 (FreeBSD)) (envelope-from ) id 1l2ArI-0006Br-PG; Wed, 20 Jan 2021 11:37:04 +0100 Subject: Re: Waiting for bufdaemon To: Konstantin Belousov Cc: freebsd-current 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> From: Jakob Alvermark Message-ID: <1c4608c3-6116-c110-236c-3a70967d2edb@alvermark.net> Date: Wed, 20 Jan 2021 11:37:04 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Rspamd-Queue-Id: 4DLMQp4JFfz4WQF X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.50 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[alvermark.net:s=x]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:185.34.136.138]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[alvermark.net: no valid DMARC record]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; SPAMHAUS_ZRD(0.00)[185.34.136.138:from:127.0.2.255]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[alvermark.net:+]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[185.34.136.138:from]; ASN(0.00)[asn:34971, ipnet:185.34.136.0/23, country:IT]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-current] 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:37:07 -0000 On 1/20/21 11:18 AM, Konstantin Belousov wrote: > 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) { I have a Logitech C270 USB webcam that I use for all the online meetings now that everyone is working from home. (MS Teams, Google Meet, Slack, Zoom, whatever...). It is supported by multimedia/webcamd and has been working mostly fine. (just some rare, occasional hickups) When I started to notice the bufdaemon problems, I also noticed the webcam not behaving as before. It sometimes took me two or three tries to start the camera when joining a meeting and once it started my video would freeze sometimes, being frozen for a minute or so. Sometimes when I noticed that it frooze I would try to restart it, and again it might take a couple of tries to get it working again. With the patch it seems to work better again. Jakob