From nobody Tue Feb 22 22:46:08 2022 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A2B3319E33F5 for ; Tue, 22 Feb 2022 22:46:43 +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 4K3Dmy6VKXz3MDF; Tue, 22 Feb 2022 22:46:42 +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 21MMkEkZ046936 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 23 Feb 2022 00:46:17 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 21MMk8xW046935; Wed, 23 Feb 2022 00:46:08 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 23 Feb 2022 00:46:08 +0200 From: Konstantin Belousov To: Alexander Motin Cc: Mike Karels , Tomoaki AOKI , "Chen, Alvin W" , freebsd-current@freebsd.org Subject: Re: [Intel AlderLake] Read&Write files to FAT32 or UFS partition cause data corrupt due to P-Core&E-Core Message-ID: References: <5fd2a34e-1135-4237-a028-d4566ff65c69@FreeBSD.org> <20220219115534.7db1b9f199c10894e4280b33@dec.sakura.ne.jp> <7A743668-B5AA-4679-9F56-9A6220CBBC14@karels.net> <59cbcfe2-cd53-69d8-65d6-7a79e656f494@FreeBSD.org> List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <59cbcfe2-cd53-69d8-65d6-7a79e656f494@FreeBSD.org> 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.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4K3Dmy6VKXz3MDF X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-0.82 / 15.00]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_HAM_LONG(-1.00)[-0.999]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all:c]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_SPAM_MEDIUM(0.40)[0.403]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.23)[-0.227]; MLMMJ_DEST(0.00)[freebsd-current]; 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]; FREEMAIL_ENVFROM(0.00)[gmail.com]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-ThisMailContainsUnwantedMimeParts: N On Sat, Feb 19, 2022 at 07:26:24PM -0500, Alexander Motin wrote: > On 19.02.2022 13:23, Konstantin Belousov wrote: > > On Sat, Feb 19, 2022 at 12:14:16PM -0500, Alexander Motin wrote: > > > On 19.02.2022 12:02, Mike Karels wrote: > > > > On 18 Feb 2022, at 20:55, Tomoaki AOKI wrote: > > > > > Just a thought, but can it be the reason with timing (e.g., rendezvous > > > > > within (i)threads, hardware controlls without using hardware timer) > > > > > problem? > > > > > > > > > > On FreeBSD, IIUC, multi processor (multi core) implementation assumes > > > > > SMP (differs only clock speed) and end up with difference of > > > > > performance at same clock speed within P-core and E-core, possibly. > > > > > > > > Another possibility is that the system is confused by having hyperthreading > > > > on the P cores but not the E cores. > > > > > > No, I've tried to disable SMT and different number of cores to make it look > > > identical and uniform for the scheduler. The only thing I could not test is > > > disabling all P cores to test only E, the motherboard does not allow that, > > > requiring at least one P core enabled. > > > > Does the kernel select MWAIT as the idle method? If you set idle to spin, > > is anything change? > > By default kernel selects ACPI, using MWAIT: > machdep.idle: acpi > dev.cpu.0.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc > > I've tried to do in loader: > set machdep.idle_mwait=0 > set machdep.idle="spin" (also tried "hlt") > , but without visible positive effects. I was only interested in spin, for hlt there is no chance if spin did not worked. Ok, the next step is to get the CPU feature reports from P- vs. E- cores. Patch below should work, with verbose boot. diff --git a/sys/x86/x86/identcpu.c b/sys/x86/x86/identcpu.c index 849f532dbf8b..9e4da4722f77 100644 --- a/sys/x86/x86/identcpu.c +++ b/sys/x86/x86/identcpu.c @@ -246,7 +246,7 @@ printcpuinfo(void) u_int regs[4], i; char *brand; - printf("CPU: "); + printf("CPU %d: ", PCPU_GET(cpuid)); #ifdef __i386__ cpu_class = cpus[cpu].cpu_class; strncpy(cpu_model, cpus[cpu].cpu_name, sizeof (cpu_model)); diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c index 3b0e25172d0d..4299eb5348e6 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -1089,7 +1089,7 @@ init_secondary_tail(void) load_es(_udatasel); load_fs(_ufssel); #endif - +printcpuinfo(); mtx_unlock_spin(&ap_boot_mtx); /* Wait until all the AP's are up. */