#
73bb5aea |
|
11-Apr-2024 |
Elyes Haouas <ehaouas@noos.fr> |
atomic: Fix typo Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/885
|
#
95ee2897 |
|
16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: two-line .h pattern Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
|
#
4d846d26 |
|
10-May-2023 |
Warner Losh <imp@FreeBSD.org> |
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
|
#
08f16287 |
|
13-Jun-2022 |
Brooks Davis <brooks@FreeBSD.org> |
amd64: -m32 support for machine/atomic.h Install the i386 atomic.h under /usr/include/i386 on amd64 and include when targeting i386. Reviewed by: jhb, imp
|
#
3d6f4411 |
|
12-Apr-2022 |
John Baldwin <jhb@FreeBSD.org> |
Remove checks for <sys/cdefs.h> being included. These files no longer depend on the macros required when these checks were added. PR: 263102 (exp-run) Reviewed by: brooks, imp, emaste Differential Revision: https://reviews.freebsd.org/D34804
|
#
56f5947a |
|
12-Apr-2022 |
John Baldwin <jhb@FreeBSD.org> |
Remove checks for __GNUCLIKE_ASM assuming it is always true. All supported compilers (modern versions of GCC and clang) support this. Many places didn't have an #else so would just silently do the wrong thing. Ancient versions of icc (the original motivation for this) are no longer a compiler FreeBSD supports. PR: 263102 (exp-run) Reviewed by: brooks, imp Differential Revision: https://reviews.freebsd.org/D34797
|
#
9596b349 |
|
03-Feb-2022 |
Konstantin Belousov <kib@FreeBSD.org> |
x86 atomic.h: remove obsoleted comment Modules no longer call kernel functions for atomic ops, and since the previous commit, we always use lock prefix. Submitted by: Elliott Mitchell <ehem+freebsd@m5p.com> Reviewed by: jhb, markj MFC after: 1 week Differential revision: https://reviews.freebsd.org/D34153
|
#
9c0b759b |
|
03-Feb-2022 |
Konstantin Belousov <kib@FreeBSD.org> |
x86 atomics: use lock prefix unconditionally Atomics have significant other use besides providing in-system primitives for safe memory updates. They are used for implementing communication with out of system software or hardware following some protocols. For instance, even UP kernel might require a protocol using atomics to communicate with the software-emulated device on SMP hypervisor. Or real hardware might need atomic accesses as part of the proper management protocol. Another point is that UP configurations on x86 are extinct, so slight performance hit by unconditionally use proper atomics is not important. It is compensated by less code clutter, which in fact improves the UP/i386 lifetime expectations. Requested by: Elliott Mitchell <ehem+freebsd@m5p.com> Reviewed by: Elliott Mitchell, imp, jhb, markj, royger Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D34153
|
#
cbf999e7 |
|
03-Feb-2022 |
Konstantin Belousov <kib@FreeBSD.org> |
x86 atomic.h: cleanup comments for preprocessor directives Reviewed by: Elliott Mitchell, imp, jhb, markj, royger Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D34153
|
#
a90d053b |
|
19-Jul-2021 |
Mark Johnston <markj@FreeBSD.org> |
Simplify kernel sanitizer interceptors KASAN and KCSAN implement interceptors for various primitive operations that are not instrumented by the compiler. KMSAN requires them as well. Rather than adding new cases for each sanitizer which requires interceptors, implement the following protocol: - When interceptor definitions are required, define SAN_NEEDS_INTERCEPTORS and SANITIZER_INTERCEPTOR_PREFIX. - In headers that declare functions which need to be intercepted by a sanitizer runtime, use SANITIZER_INTERCEPTOR_PREFIX to provide declarations. - When SAN_RUNTIME is defined, do not redefine the names of intercepted functions. This is typically the case in files which implement sanitizer runtimes but is also needed in, for example, files which define ifunc selectors for intercepted operations. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
|
#
3ead6023 |
|
22-Mar-2021 |
Mark Johnston <markj@FreeBSD.org> |
Generalize bus_space(9) and atomic(9) sanitizer interceptors Make it easy to define interceptors for new sanitizer runtimes, rather than assuming KCSAN. Lay a bit of groundwork for KASAN and KMSAN. When a sanitizer is compiled in, atomic(9) and bus_space(9) definitions in atomic_san.h are used by default instead of the inline implementations in the platform's atomic.h. These definitions are implemented in the sanitizer runtime, which includes machine/{atomic,bus}.h with SAN_RUNTIME defined to pull in the actual implementations. No functional change intended. MFC after: 1 month Sponsored by: The FreeBSD Foundation
|
#
435c7cfb |
|
07-Mar-2021 |
Mark Johnston <markj@FreeBSD.org> |
Rename _cscan_atomic.h and _cscan_bus.h to atomic_san.h and bus_san.h Other kernel sanitizers (KMSAN, KASAN) require interceptors as well, so put these in a more generic place as a step towards importing the other sanitizers. No functional change intended. MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29103
|
#
ca0ec73c |
|
25-Mar-2020 |
Conrad Meyer <cem@FreeBSD.org> |
Expand generic subword atomic primitives The goal of this change is to make the atomic_load_acq_{8,16}, atomic_testandset{,_acq}_long, and atomic_testandclear_long primitives available in MI-namespace. The second goal is to get this draft out of my local tree, as anything that requires a full tinderbox is a big burden out of tree. MD specifics can be refined individually afterwards. The generic implementations may not be ideal for your architecture; feel free to implement better versions. If no subword_atomic definitions are needed, the include can be removed from your arch's machine/atomic.h. Generic definitions are guarded by defined macros of the same name. To avoid picking up conflicting generic definitions, some macro defines are added to various MD machine/atomic.h to register an existing implementation. Include _atomic_subword.h in arm and arm64 machine/atomic.h. For some odd reason, KCSAN only generates some versions of primitives. Generate the _acq variants of atomic_load.*_8, atomic_load.*_16, and atomic_testandset.*_long. There are other questionably disabled primitives, but I didn't run into them, so I left them alone. KCSAN is only built for amd64 in tinderbox for now. Add atomic_subword implementations of atomic_load_acq_{8,16} implemented using masking and atomic_load_acq_32. Add generic atomic_subword implementations of atomic_testandset_long(), atomic_testandclear_long(), and atomic_testandset_acq_long(), using atomic_fcmpset_long() and atomic_fcmpset_acq_long(). On x86, add atomic_testandset_acq_long as an alias for atomic_testandset_long. Reviewed by: kevans, rlibby (previous versions both) Differential Revision: https://reviews.freebsd.org/D22963
|
#
6d1a70dd |
|
28-Feb-2020 |
Ryan Libby <rlibby@FreeBSD.org> |
amd64 atomic.h: minor codegen optimization in flag access Previously the pattern to extract status flags from inline assembly blocks was to use setcc in the block to write the flag to a register. This was suboptimal in a few ways: - It would lead to code like: sete %cl; test %cl; jne, i.e. a flag would just be loaded into a register and then reloaded to a flag. - The setcc would force the block to use an additional register. - If the client code didn't care for the flag value then the setcc would be entirely pointless but could not be eliminated by the optimizer. A more modern inline asm construct (since gcc 6 and clang 9) allows for "flag output operands", where a C variable can be written directly from a flag. The optimizer can then use this to produce direct code where the flag does not take a trip through a register. In practice this makes each affected operation sequence shorter by five bytes of instructions. It's unlikely this has a measurable performance impact. Reviewed by: kib, markj, mjg Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D23869
|
#
849aef49 |
|
21-Nov-2019 |
Andrew Turner <andrew@FreeBSD.org> |
Port the NetBSD KCSAN runtime to FreeBSD. Update the NetBSD Kernel Concurrency Sanitizer (KCSAN) runtime to work in the FreeBSD kernel. It is a useful tool for finding data races between threads executing on different CPUs. This can be enabled by enabling KCSAN in the kernel config, or by using the GENERIC-KCSAN amd64 kernel. It works on amd64 and arm64, however the later needs a compiler change to allow -fsanitize=thread that KCSAN uses. Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22315
|
#
a7a7f5b4 |
|
06-Jul-2018 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Make sure kernel modules built by default are portable between UP and SMP systems by extending defined(SMP) to include defined(KLD_MODULE). This is a regression issue after r335873 . Discussed with: mmacy@ Sponsored by: Mellanox Technologies
|
#
79ba9195 |
|
03-Jul-2018 |
John Baldwin <jhb@FreeBSD.org> |
Use 'e' instead of 'i' constraints with 64-bit atomic operations on amd64. The ADD, AND, OR, and SUB instructions take at most a 32-bit sign-extended immediate operand. 64-bit constants that do not fit into that constraint need to be loaded into a register. The 'i' constraint tells the compiler it can pass any integer constant to the assembler, whereas the 'e' constrain only permits constants that fit into a 32-bit sign-extended value. This fixes using atomic_add/clear/set/subtract_long/64 with constants that do not fit into a 32-bit sign-extended immediate. Reported by: several folks Tested by: Pete Wright <pete@nomadlogic.org> MFC after: 2 weeks
|
#
f4b36404 |
|
02-Jul-2018 |
Matt Macy <mmacy@FreeBSD.org> |
inline atomics and allow tied modules to inline locks - inline atomics in modules on i386 and amd64 (they were always inline on other arches) - allow modules to opt in to inlining locks by specifying MODULE_TIED=1 in the makefile Reviewed by: kib Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D16079
|
#
30d4f9e8 |
|
19-Dec-2017 |
Konstantin Belousov <kib@FreeBSD.org> |
Add atomic_load(9) and atomic_store(9) operations. They provide relaxed-ordered atomic access semantic. Due to the FreeBSD memory model, the operations are syntaxical wrappers around the volatile accesses. The volatile qualifier is used to ensure that the access not optimized out and in turn depends on the volatile semantic as implemented by supported compilers. The motivation for adding the operation is to help people coming from other systems or knowing the C11/C++ standards where atomics have special type and require use of the special access operations. It is still the case that FreeBSD requires plain load and stores of aligned integer types to be atomic. Suggested by: jhb Reviewed by: alc, jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D13534
|
#
c49761dd |
|
27-Nov-2017 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
sys/amd64: further adoption of SPDX licensing ID tags. Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts.
|
#
83c9dea1 |
|
17-Apr-2017 |
Gleb Smirnoff <glebius@FreeBSD.org> |
- Remove 'struct vmmeter' from 'struct pcpu', leaving only global vmmeter in place. To do per-cpu stats, convert all fields that previously were maintained in the vmmeters that sit in pcpus to counter(9). - Since some vmmeter stats may be touched at very early stages of boot, before we have set up UMA and we can do counter_u64_alloc(), provide an early counter mechanism: o Leave one spare uint64_t in struct pcpu, named pc_early_dummy_counter. o Point counter(9) fields of vmmeter to pcpu[0].pc_early_dummy_counter, so that at early stages of boot, before counters are allocated we already point to a counter that can be safely written to. o For sparc64 that required a whole dummy pcpu[MAXCPU] array. Further related changes: - Don't include vmmeter.h into pcpu.h. - vm.stats.vm.v_swappgsout and vm.stats.vm.v_swappgsin changed to 64-bit, to match kernel representation. - struct vmmeter hidden under _KERNEL, and only vmstat(1) is an exclusion. This is based on benno@'s 4-year old patch: https://lists.freebsd.org/pipermail/freebsd-arch/2013-July/014471.html Reviewed by: kib, gallatin, marius, lidl Differential Revision: https://reviews.freebsd.org/D10156
|
#
3d673254 |
|
22-Mar-2017 |
Mark Johnston <markj@FreeBSD.org> |
Add support for 8- and 16-bit atomic_(f)cmpset to x86. Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D10068
|
#
f7c61770 |
|
03-Jan-2017 |
Mateusz Guzik <mjg@FreeBSD.org> |
amd64: add atomic_fcmpset Reviewed by: kib, jhb
|
#
dfdc9a05 |
|
16-May-2016 |
Sepherosa Ziehau <sephe@FreeBSD.org> |
atomic: Add testandclear on i386/amd64 Reviewed by: kib Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6381
|
#
c1ecb7e1 |
|
21-Jan-2016 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Add missing atomic wrapper macro. Reviewed by: alfred @ Sponsored by: Mellanox Technologies MFC after: 1 week
|
#
0b6476ec |
|
30-Jul-2015 |
Konstantin Belousov <kib@FreeBSD.org> |
Improve comments. Submitted by: bde MFC after: 2 weeks
|
#
1d1ec02c |
|
28-Jul-2015 |
Konstantin Belousov <kib@FreeBSD.org> |
Remove full barrier from the amd64 atomic_load_acq_*(). Strong ordering semantic of x86 CPUs makes only the compiler barrier neccessary to give the acquire behaviour. Existing implementation ensured sequentially consistent semantic for load_acq, making much stronger guarantee than required by standard's definition of the load acquire. Consumers which depend on the barrier are believed to be identified and already fixed to use proper operations. Noted by: alc (long time ago) Reviewed by: alc, bde Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
|
#
d8b56c8e |
|
24-Jul-2015 |
Alan Cox <alc@FreeBSD.org> |
Add a comment discussing the appropriate use of the atomic_*() functions with acquire and release semantics versus the *mb() functions on amd64 processors. Reviewed by: bde (an earlier version), kib Sponsored by: EMC / Isilon Storage Division
|
#
8954a9a4 |
|
08-Jul-2015 |
Konstantin Belousov <kib@FreeBSD.org> |
Add the atomic_thread_fence() family of functions with intent to provide a semantic defined by the C11 fences with corresponding memory_order. atomic_thread_fence_acq() gives r | r, w, where r and w are read and write accesses, and | denotes the fence itself. atomic_thread_fence_rel() is r, w | w. atomic_thread_fence_acq_rel() is the combination of the acquire and release in single operation. Note that reads after the acq+rel fence could be made visible before writes preceeding the fence. atomic_thread_fence_seq_cst() orders all accesses before/after the fence, and the fence itself is globally ordered against other sequentially consistent atomic operations. Reviewed by: alc Discussed with: bde Sponsored by: The FreeBSD Foundation MFC after: 3 weeks
|
#
3ac3c0f2 |
|
29-Jun-2015 |
Konstantin Belousov <kib@FreeBSD.org> |
Add a comment about too strong semantic of atomic_load_acq() on x86. Submitted by: bde MFC after: 2 weeks
|
#
7626d062 |
|
27-Jun-2015 |
Konstantin Belousov <kib@FreeBSD.org> |
Remove unneeded data dependency, currently imposed by atomic_load_acq(9), on it source, for x86. Right now, atomic_load_acq() on x86 is sequentially consistent with other atomics, code ensures this by doing store/load barrier by performing locked nop on the source. Provide separate primitive __storeload_barrier(), which is implemented as the locked nop done on a cpu-private variable, and put __storeload_barrier() before load, to keep seq_cst semantic but avoid introducing false dependency on the no-modification of the source for its later use. Note that seq_cst property of x86 atomic_load_acq() is not documented and not carried by atomics implementations on other architectures, although some kernel code relies on the behaviour. This commit does not intend to change this. Reviewed by: alc Discussed with: bde Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
|
#
d36eb3f1 |
|
21-Aug-2013 |
Jung-uk Kim <jkim@FreeBSD.org> |
Remove empty lines before return statements for style consistency.
|
#
8a1ee2d3 |
|
21-Aug-2013 |
Jung-uk Kim <jkim@FreeBSD.org> |
Implement atomic_swap() and atomic_testandset(). Reviewed by: arch, bde, jilles, kib
|
#
da255e4c |
|
21-Aug-2013 |
Jung-uk Kim <jkim@FreeBSD.org> |
- Remove the "a" constraint from main output operand for atomic_cmpset(). - Use "+" modifier for the "expect" because it is also an output (unused).
|
#
fe94be3d |
|
21-Aug-2013 |
Jung-uk Kim <jkim@FreeBSD.org> |
Use '+' modifier for a memory operand that is both an input and an output. It was actually done in r86301 but reverted in r150182 because GCC 3.x was not able to handle it for a memory operand. Apparently, this problem was fixed in GCC 4.1+ and several contrib sources already rely on this feature.
|
#
c1c84ce1 |
|
21-Aug-2013 |
Jung-uk Kim <jkim@FreeBSD.org> |
Remove bogus labels. No functional change.
|
#
ee93d117 |
|
21-Aug-2013 |
Jung-uk Kim <jkim@FreeBSD.org> |
Use consistent style. No functional change.
|
#
3a473025 |
|
09-Oct-2012 |
Attilio Rao <attilio@FreeBSD.org> |
Add an unified macro to deny ability from the compiler to reorder instruction loads/stores at its will. The macro __compiler_membar() is currently supported for both gcc and clang, but kernel compilation will fail otherwise. Reviewed by: bde, kib Discussed with: dim, theraven MFC after: 2 weeks
|
#
fa9f322d |
|
02-Jun-2012 |
Konstantin Belousov <kib@FreeBSD.org> |
Use plain store for atomic_store_rel on x86, instead of implicitly locked xchg instruction. IA32 memory model guarantees that store has release semantic, since stores cannot pass loads or stores. Reviewed by: bde, jhb Tested by: pho MFC after: 2 weeks
|
#
7222d2fb |
|
18-Dec-2010 |
Konstantin Belousov <kib@FreeBSD.org> |
Inform a compiler which asm statements in the x86 implementation of atomics change eflags. Reviewed by: jhb MFC after: 2 weeks
|
#
a7d5f7eb |
|
19-Oct-2010 |
Jamie Gritton <jamie@FreeBSD.org> |
A new jail(8) with a configuration file, to replace the work currently done by /etc/rc.d/jail.
|
#
065b12a7 |
|
20-May-2010 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Rename an argument from "exp" to "expect" since the former makes FlexeLint uneasy, in case anybody think it might be exp(3) in libm. This also makes it consistent with other archs.
|
#
4dc32a73 |
|
12-Oct-2009 |
Attilio Rao <attilio@FreeBSD.org> |
MFC r197803, r197824, r197910: Per their definition, atomic instructions used in conjuction with memory barriers should also ensure that the compiler doesn't reorder paths where they are used. GCC, however, does that aggressively, even in presence of volatile operands. The most reliable way GCC offers for avoid instructions reordering is clobbering "memory". Not all our memory barriers, right now, clobber memory for GCC-like compilers. Fix these cases. Approved by: re (kib)
|
#
8448afce |
|
09-Oct-2009 |
Attilio Rao <attilio@FreeBSD.org> |
atomic_cmpset_barr_* was added in order to cope with compilers willing to specify their own version of atomic_cmpset_* which could have been different than the membar version. Right now, however, FreeBSD is bound mostly to GCC-like compilers and it is desired to add new support and compat shim mostly when there is a real necessity, in order to avoid too much compatibility bloats. In this optic, bring back atomic_cmpset_{acq, rel}_* to be the same as atomic_cmpset_* and unwind the atomic_cmpset_barr_* introduction. Requested by: jhb Reviewed by: jhb Tested by: Giovanni Trematerra <giovanni dot trematerra at gmail dot com>
|
#
d9492a44 |
|
06-Oct-2009 |
Attilio Rao <attilio@FreeBSD.org> |
- All the functions in atomic.h needs to be in "physical" form (like not defined through macros or similar) in order to be later compiled in the kernel and offer this way the support for modules (and compatibility among the UP case and SMP case). Fix this for the newly introduced atomic_cmpset_barr_* cases by defining and specifying a template. Note that the new DEFINE_CMPSET_GEN() template save more typing on amd64 than the current code. [1] - Fix the style for memory barriers on amd64. [1] Reported by: Paul B. Mahol <onemda at gmail dot com>
|
#
86d2e48c |
|
06-Oct-2009 |
Attilio Rao <attilio@FreeBSD.org> |
Per their definition, atomic instructions used in conjuction with memory barriers should also ensure that the compiler doesn't reorder paths where they are used. GCC, however, does that aggressively, even in presence of volatile operands. The most reliable way GCC offers for avoid instructions reordering is clobbering "memory" even if that is theoretically an heavy-weight operation, flushing the content of all the registers and forcing reload of them (We could rely, however, on gcc DTRT by just understanding the purpose as this is a well-known pattern for many modern operating-systems). Not all our memory barriers, right now, clobber memory for GCC-like compilers. The most notable cases are IA32 and amd64 where the memory barrier are treacted the same as normal atomic instructions. Fix this by offering the possibility to implement atomic instructions with memory barriers separately from the normal version and implement the GCC-like specific one using memory clobbering. Thanks to Chris Lattner (@apple) for his discussion on llvm specifics. Reported by: jhb Reviewed by: jhb Tested by: rdivacky, Giovanni Trematerra <giovanni dot trematerra at gmail dot com>
|
#
db7f0b97 |
|
21-Nov-2008 |
Kip Macy <kmacy@FreeBSD.org> |
- bump __FreeBSD version to reflect added buf_ring, memory barriers, and ifnet functions - add memory barriers to <machine/atomic.h> - update drivers to only conditionally define their own - add lockless producer / consumer ring buffer - remove ring buffer implementation from cxgb and update its callers - add if_transmit(struct ifnet *ifp, struct mbuf *m) to ifnet to allow drivers to efficiently manage multiple hardware queues (i.e. not serialize all packets through one ifq) - expose if_qflush to allow drivers to flush any driver managed queues This work was supported by Bitgravity Inc. and Chelsio Inc.
|
#
d7f03759 |
|
19-Oct-2008 |
Ulf Lilleengen <lulf@FreeBSD.org> |
- Import the HEAD csup code which is the basis for the cvsmode work.
|
#
6eb4157f |
|
16-Mar-2008 |
Pawel Jakub Dawidek <pjd@FreeBSD.org> |
Implement atomic_fetchadd_long() for all architectures and document it. Reviewed by: attilio, jhb, jeff, kris (as a part of the uidinfo_waitfree.patch)
|
#
f28e1c8f |
|
29-Dec-2006 |
Bruce Evans <bde@FreeBSD.org> |
Fixed some style bugs (mainly assorted errors in comments, and inconsistent spelling of `result').
|
#
6c296ffa |
|
29-Dec-2006 |
Bruce Evans <bde@FreeBSD.org> |
Fixed some style bugs (whitespace only).
|
#
7e4277e5 |
|
29-Dec-2006 |
Bruce Evans <bde@FreeBSD.org> |
Try harder to garbage-collect the "LOCORE" (really asm) version of MPLOCKED. The cleaning in rev.1.25 was supposed to have been undone by rev.1.26, but 1.26 could never have actually affected asm files since atomic.h is full of C declarations so including it in asm files would just give syntax errors. The asm MPLOCKED is even less needed than when misplaced definitions of it were first removed, and is now unused in any asm file in the src tree except in anachronismns in sys/i386/i386/support.s.
|
#
276c702d |
|
28-Dec-2006 |
Bruce Evans <bde@FreeBSD.org> |
Removed gratuitous cosmetic differences with the i386 version. This mainly involves removing all __CC_SUPPORTS___INLINE__ ifdefs. These ifdefs are even less needed for amd64 than for i386, but the i386 atomic.h never had them. The ifdefs here were just an optimization of obsolescent compatibility cruft (__inline) for a null set of compilers. I think null sets of compilers should only be supported in cases where this is more than an optimization, doesn't require extensive ifdefs, and only involves not-so-obsolescent compatibility cruft (plain inline here).
|
#
26ab2d1d |
|
27-Dec-2006 |
Bruce Evans <bde@FreeBSD.org> |
Avoid an instruction in atomic_cmpset_{int_long)() in most cases. These functions are used a lot for mutexes, so this reduces the text size of an average kernel by about 0.75%. This wasn't intended to be a significant optimization, but it somehow increased the maximum number of packets per second that can be transmitted by my bge hardware from 320000 to 460000 (this benchmark is CPU-bound and remarkably sensitive to changes in the text section). Details: we would prefer to leave the result of the cmpxchg in %al, but cannot tell gcc that it is there, so we have to convert it to an integer register. We converted to %al, then to %[re]ax, but the latter step is usually wasted since gcc usually only wants the condition code and can recover it from %al just as easily as from %[re]ax. Let gcc promote %al in the few cases where this is needed. Nearby style fixes; - let gcc manage the load of `res', and don't abuse `res' for a copy of `exp' - don't echo `res's name in comments - consistently spell the condition code as 'e' after comparison for equality - don't hard-code %al anywhere except in constraints - for the version that doesn't use cmpxchg, there is no requirement to use %al anywhere, so don't hard-code it in the constraints either. Style non-fix: - for the versions that use cmpxchg, keep using "a" (was %[re]ax, now %al) for the main output operand, although this is not required. The input and output operands that use the "a" constraint are now decoupled, and this makes things clearer except for the reason that the output register is hard-coded. It is now just a hack to tell gcc that the input "a" has been clobbered without increasing the number of operands.
|
#
3c2bc2bf |
|
27-Sep-2005 |
John Baldwin <jhb@FreeBSD.org> |
Add a new atomic_fetchadd() primitive that atomically adds a value to a variable and returns the previous value of the variable. Tested on: i386, alpha, sparc64, arm (cognet) Reviewed by: arch@ Submitted by: cognet (arm) MFC after: 1 week
|
#
80d52f16 |
|
15-Sep-2005 |
John Baldwin <jhb@FreeBSD.org> |
Stop using the '+' constraint modifier with inline assembly. The '+' constraint is actually only allowed for register operands. Instead, use separate input and output memory constraints. Education from: alc Reviewed by: alc Tested on: i386, alpha MFC after: 1 week
|
#
5d2f4de5 |
|
18-Aug-2005 |
John Baldwin <jhb@FreeBSD.org> |
Add aliases for atomic operations on 64-bit integers just like other 64-bit platforms. MFC after: 1 week
|
#
9e76f9ad |
|
21-Jul-2005 |
Peter Wemm <peter@FreeBSD.org> |
Like on i386, bypass lock prefix for atomic ops on !SMP kernels.
|
#
122eceef |
|
15-Jul-2005 |
John Baldwin <jhb@FreeBSD.org> |
Convert the atomic_ptr() operations over to operating on uintptr_t variables rather than void * variables. This makes it easier and simpler to get asm constraints and volatile keywords correct. MFC after: 3 days Tested on: i386, alpha, sparc64 Compiled on: ia64, powerpc, amd64 Kernel toolchain busted on: arm
|
#
48281036 |
|
08-Jul-2005 |
John Baldwin <jhb@FreeBSD.org> |
Some cleanups and tweaks to some of the atomic.h files in preparation for further changes and fixes in the future: - Use aliases via macros rather than duplicated inlines wherever possible. - Move all the aliases to the bottom of these files and the inline functions to the top. - Add various comments. - On alpha, drop atomic_{load_acq,store_rel}_{8,char,16,short}(). - On i386 and amd64, don't duplicate the extern declarations for functions in the two non-inline cases (KLD_MODULE and compiler doesn't do inlines), instead, consolidate those two cases. - Some whitespace fixes. Approved by: re (scottl)
|
#
a5f50ef9 |
|
02-Mar-2005 |
Joerg Wunsch <joerg@FreeBSD.org> |
netchild's mega-patch to isolate compiler dependencies into a central place. This moves the dependency on GCC's and other compiler's features into the central sys/cdefs.h file, while the individual source files can then refer to #ifdef __COMPILER_FEATURE_FOO where they by now used to refer to #if __GNUC__ > 3.1415 && __BARC__ <= 42. By now, GCC and ICC (the Intel compiler) have been actively tested on IA32 platforms by netchild. Extension to other compilers is supposed to be possible, of course. Submitted by: netchild Reviewed by: various developers on arch@, some time ago
|
#
cda07865 |
|
20-Nov-2003 |
Peter Wemm <peter@FreeBSD.org> |
Cosmetic and/or trivial sync up with i386. Approved by: re (rwatson)
|
#
0d2a2989 |
|
17-Nov-2003 |
Peter Wemm <peter@FreeBSD.org> |
Initial landing of SMP support for FreeBSD/amd64. - This is heavily derived from John Baldwin's apic/pci cleanup on i386. - I have completely rewritten or drastically cleaned up some other parts. (in particular, bootstrap) - This is still a WIP. It seems that there are some highly bogus bioses on nVidia nForce3-150 boards. I can't stress how broken these boards are. I have a workaround in mind, but right now the Asus SK8N is broken. The Gigabyte K8NPro (nVidia based) is also mind-numbingly hosed. - Most of my testing has been with SCHED_ULE. SCHED_4BSD works. - the apic and acpi components are 'standard'. - If you have an nVidia nForce3-150 board, you are stuck with 'device atpic' in addition, because they somehow managed to forget to connect the 8254 timer to the apic, even though its in the same silicon! ARGH! This directly violates the ACPI spec.
|
#
afa88623 |
|
30-Apr-2003 |
Peter Wemm <peter@FreeBSD.org> |
Commit MD parts of a loosely functional AMD64 port. This is based on a heavily stripped down FreeBSD/i386 (brutally stripped down actually) to attempt to get a stable base to start from. There is a lot missing still. Worth noting: - The kernel runs at 1GB in order to cheat with the pmap code. pmap uses a variation of the PAE code in order to avoid having to worry about 4 levels of page tables yet. - It boots in 64 bit "long mode" with a tiny trampoline embedded in the i386 loader. This simplifies locore.s greatly. - There are still quite a few fragments of i386-specific code that have not been translated yet, and some that I cheated and wrote dumb C versions of (bcopy etc). - It has both int 0x80 for syscalls (but using registers for argument passing, as is native on the amd64 ABI), and the 'syscall' instruction for syscalls. int 0x80 preserves all registers, 'syscall' does not. - I have tried to minimize looking at the NetBSD code, except in a couple of places (eg: to find which register they use to replace the trashed %rcx register in the syscall instruction). As a result, there is not a lot of similarity. I did look at NetBSD a few times while debugging to get some ideas about what I might have done wrong in my first attempt.
|
#
77e83412 |
|
14-Oct-2002 |
Jim Pirzyk <pirzyk@FreeBSD.org> |
Add a knob to turn on and off the CMPXCHG instruction on > i386 IA32 systems. This is most beneficial for vmware client os installs. Reviewed by: jmallet, iedowse, tlambert2@mindspring.com MFC After: never, -STABLE does not currently use this instruction
|
#
4c5aee92 |
|
18-Jul-2002 |
Mark Murray <markm@FreeBSD.org> |
Beautify. This has the side effect of improving portability and making lint work cleaner. Inspired to do this by: jhb
|
#
8306a37b |
|
17-Jul-2002 |
Mark Murray <markm@FreeBSD.org> |
Clean up the syntax WRT semicolons at the end of function-like-macros, and protect GCCisms from non-GNU compilers and lint.
|
#
71acb247 |
|
27-Feb-2002 |
Bosko Milekic <bmilekic@FreeBSD.org> |
Make MPLOCKED work again in asm files and stringify it explicitly where necessary. Reviewed by: jake
|
#
d2f22d70 |
|
10-Feb-2002 |
Bruce Evans <bde@FreeBSD.org> |
Garbage-collect the "LOCORE" version of MPLOCKED.
|
#
e4e991e1 |
|
18-Dec-2001 |
John Baldwin <jhb@FreeBSD.org> |
Allow the ATOMIC_ASM() macro to pass in the constraints on the V parameter since the char versions need to use either ax, bx, cx, or dx. Submitted by: Peter Jeremy (mostly) Recommended by: bde
|
#
d9009094 |
|
12-Nov-2001 |
John Baldwin <jhb@FreeBSD.org> |
Use newer constraints for atomic_cmpset(). Requested by: bde
|
#
20a2016a |
|
12-Nov-2001 |
John Baldwin <jhb@FreeBSD.org> |
Use newer constraints for inline assembly for an operand that is both an input and an output by using the '+' modifier rather than listing the operand in both the input and output sections. Reviwed by: bde
|
#
2a89a48f |
|
08-Oct-2001 |
John Baldwin <jhb@FreeBSD.org> |
Allow atomic ops to be somewhat safely used in userland. We always use lock prefixes in the userland case so that the binaries will work on both SMP and UP systems.
|
#
d888fc4e |
|
11-Feb-2001 |
Mark Murray <markm@FreeBSD.org> |
RIP <machine/lock.h>. Some things needed bits of <i386/include/lock.h> - cy.c now has its own (only) copy of the COM_(UN)LOCK() macros, and IMASK_(UN)LOCK() has been moved to <i386/include/apic.h> (AKA <machine/apic.h>). Reviewed by: jhb
|
#
324fffae |
|
16-Jan-2001 |
John Baldwin <jhb@FreeBSD.org> |
- Sort of lie and say that %eax is an output only and not an input for the non-386 atomic_load_acq(). %eax is an input since its value is used in the cmpxchg instruction, but we don't care what value it is, so setting it to a specific value is just wasteful. Thus, it is being used without being initialized as the warning stated, but it is ok for it to be used because its value isn't important. Thus, we are only sort of lying when we say it is an output only operand. - Add "cc" to the clobber list for atomic_load_acq() since the cmpxchgl changes ZF.
|
#
8a6b1c8f |
|
15-Jan-2001 |
John Baldwin <jhb@FreeBSD.org> |
- Fix atomic_load_* and atomic_store_* to generate functions for atomic.c that modules can call. - Remove the old gcc <= 2.8 versions of the atomic ops. - Resort the order of some things in the file so that there is only one #ifdef for KLD_MODULE, and so that all WANT_FUNCTIONS stuff is moved to the bottom of the file. - Remove ATOMIC_ACQ_REL() and just use explicit macros instead.
|
#
9d979d89 |
|
14-Jan-2001 |
John Baldwin <jhb@FreeBSD.org> |
Fix the atomic_load_acq() and atomic_store_rel() functions to properly implement memory fences for the 486+. The 386 still uses versions w/o memory fences as all operations on the 386 are not program ordered. The 386 versions are not MP safe.
|
#
55d79ad0 |
|
27-Oct-2000 |
John Baldwin <jhb@FreeBSD.org> |
The x86 atomic operations are already locked, so they do not need an additional locked instruction to guarantee a write barrier for the acquire variants. Approved by: dfr Pointy hat to: jhb
|
#
ee8f2f37 |
|
25-Oct-2000 |
John Baldwin <jhb@FreeBSD.org> |
- Add atomic_cmpset_{acq_,rel_,}_long - Add in atomic operations for 8-bit, 16-bit, and 32-bit integers
|
#
ccbdd9ee |
|
20-Oct-2000 |
John Baldwin <jhb@FreeBSD.org> |
- Expand the set of atomic operations to optionally include memory barriers in most of the atomic operations. Now for these operations, you can use the normal atomic operation, you can use the operation with a read barrier, or you can use the operation with a write barrier. The function names follow the same semantics used in the ia64 instruction set. An atomic operation with a read barrier has the extra suffix 'acq', due to it having "acquire" semantics. An atomic operation with a write barrier has the extra suffix 'rel'. These suffixes are inserted between the name of the operation to perform and the typename. For example, the atomic_add_int() function now has 3 variants: - atomic_add_int() - this is the same as the previous function - atomic_add_acq_int() - this function combines the add operation with a read memory barrier - atomic_add_rel_int() - this function combines the add operation with a write memory barrier - Add 'ptr' to the list of types that we can perform atomic operations on. This allows one to do atomic operations on uintptr_t's. This is useful in the mutex code, for example, because the actual mutex lock is a pointer. - Add two new operations for doing loads and stores with memory barriers. The new load operations use a read barrier before the load, and the new store operations use a write barrier after the load. For example, atomic_load_acq_int() will atomically load an integer as well as enforcing a read barrier.
|
#
b4645202 |
|
05-Oct-2000 |
John Baldwin <jhb@FreeBSD.org> |
Add atomic_readandclear_int and atomic_readandclear_long.
|
#
819e370c |
|
06-Sep-2000 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Introduce atomic_cmpset_int() and atomic_cmpset_long() from SMPng a few hours earlier than the rest. The next DEVFS commit needs these functions. Alpha versions by: dfr i386 versions by: jakeb Approved by: SMPng
|
#
25f01030 |
|
09-May-2000 |
David E. O'Brien <obrien@FreeBSD.org> |
When using _asm{} in GCC, one must specify the operand's size if one specifies the instruction's operation size. GCC will default to 32-bit operands reguardless of the prototype (ie, formal parameters' type) of an inline function.
|
#
693612eb |
|
04-Oct-1999 |
Peter Wemm <peter@FreeBSD.org> |
Use the rev 1.1.2.1 code from RELENG_3 for atomic operations rather than the non-atomic C macros.
|
#
b8710473 |
|
04-Oct-1999 |
Peter Wemm <peter@FreeBSD.org> |
Typo: s/__GNUC_MINOR_/__GNUC_MINOR__/ (__GNUC_MINOR__ on egcs in -current is "91" and is going to be "95" soon)
|
#
181d2137 |
|
03-Oct-1999 |
Eivind Eklund <eivind@FreeBSD.org> |
Allow compilation with older versions of GCC, in order to make it possible to bootstrap and work with -current from older versions of FreeBSD.
|
#
c3aac50f |
|
27-Aug-1999 |
Peter Wemm <peter@FreeBSD.org> |
$Id$ -> $FreeBSD$
|
#
08c40841 |
|
17-Aug-1999 |
Alan Cox <alc@FreeBSD.org> |
Create callable (non-inline) versions of the atomic_OP_TYPE functions that are linked into the kernel. The KLD compilation options are changed to call these functions, rather than in-lining the atomic operations. This approach makes atomic operations from KLDs significantly faster on UP systems (though somewhat slower on SMP systems). PR: i386/13111 Submitted by: peter.jeremy@alcatel.com.au
|
#
03e3bc8e |
|
23-Jul-1999 |
Alan Cox <alc@FreeBSD.org> |
atomic.h: Change "void *" to "volatile TYPE *", improving type safety and eliminating some warnings (e.g., mp_machdep.c rev 1.106). cpufunc.h: Eliminate setbits. As defined, it's not precisely correct; and it's redundant. (Use atomic_set_int instead.) ipl_funcs.c: Use atomic_set_int instead of setbits. systm.h: Include atomic.h. Reviewed by: bde
|
#
47b8bc92 |
|
13-Jul-1999 |
Alan Cox <alc@FreeBSD.org> |
Commit the correct patch, i.e., the one that actually corresponds to the rev 1.2 log entry.
|
#
e58bb1c4 |
|
12-Jul-1999 |
Alan Cox <alc@FreeBSD.org> |
Changed the implementation of the primitives to guarantee atomicity with respect to interrupts on UP systems. (The upgrade from gcc 2.7.x to egcs 1.1.2 produced at least one non-atomic code sequence in swap_pager_getpages.) In addition, the primitives are now SMP-safe, but only on SMPs. (For portability between SMPs and UPs, modules are compiled with the SMP-safe versions.) Submitted by: dillon and myself Reviewed by: bde
|
#
069e9bc1 |
|
24-Aug-1998 |
Doug Rabson <dfr@FreeBSD.org> |
Change various syscalls to use size_t arguments instead of u_int. Add some overflow checks to read/write (from bde). Change all modifications to vm_page::flags, vm_page::busy, vm_object::flags and vm_object::paging_in_progress to use operations which are not interruptable. Reviewed by: Bruce Evans <bde@zeta.org.au>
|