History log of /netbsd-src/lib/libpthread/arch/i386/pthread_md.h (Results 1 – 20 of 20)
Revision Date Author Comments
# 2a673dcf 25-May-2023 riastradh <riastradh@NetBSD.org>

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

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

show more ...


# d2be1428 02-Mar-2012 joerg <joerg@NetBSD.org>

Avoid getcontext() as it triggers clobbering warnings. Use inline
assembler to get the fields directly. Saves a system call as side
effect.


# 1631a780 24-Feb-2011 joerg <joerg@NetBSD.org>

Allow storing and receiving the LWP private pointer via ucontext_t
on all platforms except VAX and IA64. Add fast access via register for
AMD64, i386 and SH3 ports. Use this fast access in libpthread

Allow storing and receiving the LWP private pointer via ucontext_t
on all platforms except VAX and IA64. Add fast access via register for
AMD64, i386 and SH3 ports. Use this fast access in libpthread to replace
the stack based pthread_self(). Implement skeleton support for Alpha,
HPPA, PowerPC, SPARC and SPARC64, but leave it disabled.

Ports that support this feature provide __HAVE____LWP_GETPRIVATE_FAST in
machine/types.h and a corresponding __lwp_getprivate_fast in
machine/mcontext.h.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.

show more ...


# c5d359be 25-Jan-2011 christos <christos@NetBSD.org>

make pthread__sp unsigned long.


# a61915e9 16-May-2009 ad <ad@NetBSD.org>

Remove unused code that's confusing when using cscope/opengrok.


# 5c670ea6 29-Mar-2009 ad <ad@NetBSD.org>

- Make the threadreg code use _lwp_setprivate() instead of MD hooks.

XXX This must not be enabled by default because the LWP private mechanism
is reserved for TLS. It is provided only as a test/

- Make the threadreg code use _lwp_setprivate() instead of MD hooks.

XXX This must not be enabled by default because the LWP private mechanism
is reserved for TLS. It is provided only as a test/demo.

XXX Since ucontext_t does not contain the thread private variable, for a
short time after threads are created their thread specific data is unset.
If a signal arrives during that time we are screwed.

- No longer need pthread__osrev.

- Rearrange _lwp_ctl() calls slightly.

show more ...


# 3e1711d6 23-Jun-2008 ad <ad@NetBSD.org>

pthread__threadreg_get: mark it const.


# ce099b40 28-Apr-2008 martin <martin@NetBSD.org>

Remove clause 3 and 4 from TNF licenses


# ecdd2c29 22-Mar-2008 ad <ad@NetBSD.org>

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.


# a67e1e34 10-Feb-2008 ad <ad@NetBSD.org>

- Remove libpthread's atomic ops.
- Remove the old spinlock-based mutex and rwlock implementations.
- Use the atomic ops from libc.


# 66ac2ffa 13-Nov-2007 ad <ad@NetBSD.org>

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 nec

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.

show more ...


# d32ed989 24-Sep-2007 skrll <skrll@NetBSD.org>

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

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.

show more ...


# f4fd6b79 08-Sep-2007 ad <ad@NetBSD.org>

- Get rid of self->pt_mutexhint and use pthread__mutex_owned() instead.
- Update some comments and fix minor bugs. Minor cosmetic changes.
- Replace some spinlocks with mutexes and rwlocks.
- Change

- Get rid of self->pt_mutexhint and use pthread__mutex_owned() instead.
- Update some comments and fix minor bugs. Minor cosmetic changes.
- Replace some spinlocks with mutexes and rwlocks.
- Change the process private semaphores to use mutexes and condition
variables instead of doing the synchronization directly. Spinlocks
are no longer used by the semaphore code.

show more ...


# a6ed47a5 07-Sep-2007 ad <ad@NetBSD.org>

Add: pthread__atomic_cas_ptr, pthread__atomic_swap_ptr, pthread__membar_full
This is a stopgap until the thorpej-atomic branch is complete.


# 562d0d89 29-Mar-2006 cube <cube@NetBSD.org>

Instead of using hard-coded values for various registers, get them from the
current context. Valid values can change depending on how the kernel is
setup. i386 and amd64 happen to be setup differen

Instead of using hard-coded values for various registers, get them from the
current context. Valid values can change depending on how the kernel is
setup. i386 and amd64 happen to be setup differently.

show more ...


# 4e11af46 24-Dec-2005 perry <perry@NetBSD.org>

Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 94fc83a6 11-Feb-2004 nathanw <nathanw@NetBSD.org>

Add ucontext conversion macros for an "extra" register set.


# 54ba9fed 18-Jan-2003 christos <christos@NetBSD.org>

delint


# 9631ace5 18-Jan-2003 christos <christos@NetBSD.org>

de-lint


# c62a74e6 18-Jan-2003 thorpej <thorpej@NetBSD.org>

Merge the nathanw_sa branch.