NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

PR/57199 CVS commit: src



The following reply was made to PR kern/57199; it has been noted by GNATS.

From: "Taylor R Campbell" <riastradh%netbsd.org@localhost>
To: gnats-bugs%gnats.NetBSD.org@localhost
Cc: 
Subject: PR/57199 CVS commit: src
Date: Tue, 16 Jul 2024 22:44:38 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Tue Jul 16 22:44:38 UTC 2024
 
 Modified Files:
 	src/common/lib/libc/arch/i386/atomic: atomic.S
 	src/common/lib/libc/arch/x86_64/atomic: atomic.S
 	src/sys/arch/amd64/amd64: cpufunc.S
 	src/sys/arch/i386/i386: cpufunc.S
 	src/sys/arch/xen/include: hypervisor.h xenring.h
 
 Log Message:
 xen: Don't hotpatch away LOCK prefix in xen_mb, even on UP boots.
 
 Both xen_mb and membar_sync are designed to provide store-before-load
 ordering, but xen_mb has to provide it in synchronizing guest with
 hypervisor, while membar_sync only has to provide it in synchronizing
 one (guest) CPU with another (guest) CPU.
 
 It is safe to hotpatch away the LOCK prefix in membar_sync on a
 uniprocessor boot because membar_sync is only designed to coordinate
 between normal memory on multiple CPUs, and is never necessary when
 there's only one CPU involved.
 
 But xen_mb is used to coordinate between the guest and the `device'
 implemented by a hypervisor, which might be running on another
 _physical_ CPU even if the NetBSD guest only sees one `CPU', i.e.,
 one _virtual_ CPU.  So even on `uniprocessor' boots, xen_mb must
 still issue an instruction with store-before-load ordering on
 multiprocessor systems, such as a LOCK ADD (or MFENCE, but MFENCE is
 costlier for no benefit here).
 
 No need to change xen_wmb (release ordering, load/store-before-store)
 or xen_rmb (acquire ordering, load-before-load/store) because every
 x86 store is a store-release and every x86 load is a load-acquire,
 even on multiprocessor systems, so there's no hotpatching involved
 anyway.
 
 PR kern/57199
 
 
 To generate a diff of this commit:
 cvs rdiff -u -r1.36 -r1.37 src/common/lib/libc/arch/i386/atomic/atomic.S
 cvs rdiff -u -r1.29 -r1.30 src/common/lib/libc/arch/x86_64/atomic/atomic.S
 cvs rdiff -u -r1.67 -r1.68 src/sys/arch/amd64/amd64/cpufunc.S
 cvs rdiff -u -r1.51 -r1.52 src/sys/arch/i386/i386/cpufunc.S
 cvs rdiff -u -r1.59 -r1.60 src/sys/arch/xen/include/hypervisor.h
 cvs rdiff -u -r1.7 -r1.8 src/sys/arch/xen/include/xenring.h
 
 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.
 


Home | Main Index | Thread Index | Old Index