History log of /src/lib/libpthread/arch/x86_64/pthread_md.h |
Revision | | Date | Author | Comments |
1.13 |
| 25-May-2023 |
riastradh | libpthread: New pthread__smt_wait to put CPU in low power for spin.
This is now distinct from pthread__smt_pause, which is for spin lock backoff with no paired wakeup.
On Arm, there is a single-bit event register per CPU, and there are two instructions to manage it:
- wfe, wait for event -- if event register is clear, enter low power mode and wait until event register is set; then exit low power mode and clear event register
- sev, signal event -- sets event register on all CPUs (other circumstances like interrupts also set the event register and cause wfe to wake)
These can be used to reduce the power consumption of spinning for a lock, but only if they are actually paired -- if there's no sev, wfe might hang indefinitely. Currently only pthread_spin(3) actually pairs them; the other lock primitives (internal lock, mutex, rwlock) do not -- they have spin lock backoff loops, but no corresponding wakeup to cancel a wfe.
It may be worthwhile to teach the other lock primitives to pair wfe/sev, but that requires some performance measurement to verify it's actually worthwhile. So for now, we just make sure not to use wfe when there's no sev, and keep everything else the same -- this should fix severe performance degredation in libpthread on Arm without hurting anything else.
No change in the generated code on amd64 and i386. No change in the generated code for pthread_spin.c on arm and aarch64 -- changes only the generated code for pthread_lock.c, pthread_mutex.c, and pthread_rwlock.c, as intended.
PR port-arm/57437
XXX pullup-10
|
1.12 |
| 25-Jan-2011 |
christos | branches: 1.12.36; 1.12.46; 1.12.54; make pthread__sp unsigned long.
|
1.11 |
| 16-May-2009 |
ad | branches: 1.11.2; Remove unused code that's confusing when using cscope/opengrok.
|
1.10 |
| 28-Apr-2008 |
martin | branches: 1.10.8; Remove clause 3 and 4 from TNF licenses
|
1.9 |
| 22-Mar-2008 |
ad | branches: 1.9.2; Cheat and add inlines for _atomic_cas_ptr() to work around gcc emitting unneeded PIC stuff in mutex_lock() and mutex_unlock(), when a thread register is used.
|
1.8 |
| 10-Feb-2008 |
ad | - Remove libpthread's atomic ops. - Remove the old spinlock-based mutex and rwlock implementations. - Use the atomic ops from libc.
|
1.7 |
| 13-Nov-2007 |
ad | Mutexes:
- Play scrooge again and chop more cycles off acquire/release. - Spin while the lock holder is running on another CPU (adaptive mutexes). - Do non-atomic release.
Threadreg:
- Add the necessary hooks to use a thread register. - Add the code for i386, using %gs. - Leave i386 code disabled until xen and COMPAT_NETBSD32 have the changes.
|
1.6 |
| 24-Sep-2007 |
skrll | Resurrect the function pointers for lock operations and allow each architecture to provide asm versions of the RAS operations.
We do this because relying on the compiler to get the RAS right is not sensible. (It gets alpha wrong and hppa is suboptimal)
Provide asm RAS ops for hppa.
(A slightly different version) reviewed by Andrew Doran.
|
1.5 |
| 07-Sep-2007 |
ad | Add: pthread__atomic_cas_ptr, pthread__atomic_swap_ptr, pthread__membar_full This is a stopgap until the thorpej-atomic branch is complete.
|
1.4 |
| 24-Dec-2005 |
perry | branches: 1.4.8; 1.4.12; Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
|
1.3 |
| 26-Jul-2003 |
salo | netbsd.org->NetBSD.org
|
1.2 |
| 17-Apr-2003 |
fvdl | Catch up with changed struct reg (same as gregs in mcontext now).
|
1.1 |
| 30-Jan-2003 |
fvdl | libpthread support for x86_64.
|
1.4.12.3 |
| 23-Mar-2008 |
matt | sync with HEAD
|
1.4.12.2 |
| 09-Jan-2008 |
matt | sync with HEAD
|
1.4.12.1 |
| 06-Nov-2007 |
matt | sync with HEAD
|
1.4.8.1 |
| 10-Sep-2007 |
skrll | Sync with HEAD.
|
1.9.2.1 |
| 18-May-2008 |
yamt | sync with head.
|
1.10.8.2 |
| 28-Apr-2008 |
martin | Remove clause 3 and 4 from TNF licenses
|
1.10.8.1 |
| 28-Apr-2008 |
martin | file pthread_md.h was added on branch christos-time_t on 2008-04-28 20:23:03 +0000
|
1.11.2.1 |
| 08-Feb-2011 |
bouyer | Sync with HEAD
|
1.12.54.1 |
| 01-Aug-2023 |
martin | Pull up following revision(s) (requested by riastradh in ticket #296):
lib/libpthread/arch/x86_64/pthread_md.h: revision 1.13 lib/libpthread/pthread_int.h: revision 1.110 lib/libpthread/pthread_int.h: revision 1.111 lib/libpthread/arch/i386/pthread_md.h: revision 1.21 lib/libpthread/arch/arm/pthread_md.h: revision 1.12 lib/libpthread/arch/arm/pthread_md.h: revision 1.13 lib/libpthread/pthread_spin.c: revision 1.11 lib/libpthread/arch/aarch64/pthread_md.h: revision 1.2
libpthread: Use __nothing, not /* nothing */, for empty macros.
No functional change intended -- just safer to do it this way in case the macros are used in if branches or comma expressions.
PR port-arm/57437 (pthread__smt_pause/wake issue)
libpthread: New pthread__smt_wait to put CPU in low power for spin.
This is now distinct from pthread__smt_pause, which is for spin lock backoff with no paired wakeup.
On Arm, there is a single-bit event register per CPU, and there are two instructions to manage it: - wfe, wait for event -- if event register is clear, enter low power mode and wait until event register is set; then exit low power mode and clear event register - sev, signal event -- sets event register on all CPUs (other circumstances like interrupts also set the event register and cause wfe to wake)
These can be used to reduce the power consumption of spinning for a lock, but only if they are actually paired -- if there's no sev, wfe might hang indefinitely. Currently only pthread_spin(3) actually pairs them; the other lock primitives (internal lock, mutex, rwlock) do not -- they have spin lock backoff loops, but no corresponding wakeup to cancel a wfe.
It may be worthwhile to teach the other lock primitives to pair wfe/sev, but that requires some performance measurement to verify it's actually worthwhile. So for now, we just make sure not to use wfe when there's no sev, and keep everything else the same -- this should fix severe performance degredation in libpthread on Arm without hurting anything else.
No change in the generated code on amd64 and i386. No change in the generated code for pthread_spin.c on arm and aarch64 -- changes only the generated code for pthread_lock.c, pthread_mutex.c, and pthread_rwlock.c, as intended.
PR port-arm/57437
|
1.12.46.1 |
| 04-Aug-2023 |
martin | Pull up following revision(s) (requested by riastradh in ticket #1700):
lib/libpthread/arch/x86_64/pthread_md.h: revision 1.13 lib/libpthread/pthread_int.h: revision 1.110 lib/libpthread/pthread_int.h: revision 1.111 lib/libpthread/arch/i386/pthread_md.h: revision 1.21 lib/libpthread/arch/arm/pthread_md.h: revision 1.12 lib/libpthread/arch/arm/pthread_md.h: revision 1.13 lib/libpthread/pthread_spin.c: revision 1.11 lib/libpthread/arch/aarch64/pthread_md.h: revision 1.2
libpthread: Use __nothing, not /* nothing */, for empty macros.
No functional change intended -- just safer to do it this way in case the macros are used in if branches or comma expressions. PR port-arm/57437 (pthread__smt_pause/wake issue)
libpthread: New pthread__smt_wait to put CPU in low power for spin.
This is now distinct from pthread__smt_pause, which is for spin lock backoff with no paired wakeup.
On Arm, there is a single-bit event register per CPU, and there are two instructions to manage it: - wfe, wait for event -- if event register is clear, enter low power mode and wait until event register is set; then exit low power mode and clear event register - sev, signal event -- sets event register on all CPUs (other circumstances like interrupts also set the event register and cause wfe to wake)
These can be used to reduce the power consumption of spinning for a lock, but only if they are actually paired -- if there's no sev, wfe might hang indefinitely. Currently only pthread_spin(3) actually pairs them; the other lock primitives (internal lock, mutex, rwlock) do not -- they have spin lock backoff loops, but no corresponding wakeup to cancel a wfe.
It may be worthwhile to teach the other lock primitives to pair wfe/sev, but that requires some performance measurement to verify it's actually worthwhile. So for now, we just make sure not to use wfe when there's no sev, and keep everything else the same -- this should fix severe performance degredation in libpthread on Arm without hurting anything else.
No change in the generated code on amd64 and i386. No change in the generated code for pthread_spin.c on arm and aarch64 -- changes only the generated code for pthread_lock.c, pthread_mutex.c, and pthread_rwlock.c, as intended. PR port-arm/57437
|
1.12.36.1 |
| 04-Aug-2023 |
martin | Pull up following revision(s) (requested by riastradh in ticket #1878):
lib/libpthread/arch/x86_64/pthread_md.h: revision 1.13 lib/libpthread/pthread_int.h: revision 1.110 lib/libpthread/pthread_int.h: revision 1.111 lib/libpthread/arch/i386/pthread_md.h: revision 1.21 lib/libpthread/arch/arm/pthread_md.h: revision 1.12 lib/libpthread/arch/arm/pthread_md.h: revision 1.13 lib/libpthread/pthread_spin.c: revision 1.11 lib/libpthread/arch/aarch64/pthread_md.h: revision 1.2
libpthread: Use __nothing, not /* nothing */, for empty macros.
No functional change intended -- just safer to do it this way in case the macros are used in if branches or comma expressions. PR port-arm/57437 (pthread__smt_pause/wake issue)
libpthread: New pthread__smt_wait to put CPU in low power for spin.
This is now distinct from pthread__smt_pause, which is for spin lock backoff with no paired wakeup.
On Arm, there is a single-bit event register per CPU, and there are two instructions to manage it: - wfe, wait for event -- if event register is clear, enter low power mode and wait until event register is set; then exit low power mode and clear event register - sev, signal event -- sets event register on all CPUs (other circumstances like interrupts also set the event register and cause wfe to wake)
These can be used to reduce the power consumption of spinning for a lock, but only if they are actually paired -- if there's no sev, wfe might hang indefinitely. Currently only pthread_spin(3) actually pairs them; the other lock primitives (internal lock, mutex, rwlock) do not -- they have spin lock backoff loops, but no corresponding wakeup to cancel a wfe.
It may be worthwhile to teach the other lock primitives to pair wfe/sev, but that requires some performance measurement to verify it's actually worthwhile. So for now, we just make sure not to use wfe when there's no sev, and keep everything else the same -- this should fix severe performance degredation in libpthread on Arm without hurting anything else.
No change in the generated code on amd64 and i386. No change in the generated code for pthread_spin.c on arm and aarch64 -- changes only the generated code for pthread_lock.c, pthread_mutex.c, and pthread_rwlock.c, as intended. PR port-arm/57437
|