History log of /fuchsia/zircon/system/ulib/runtime/mutex.c
Revision Date Author Comments
# f3e2126c 12-Sep-2017 Roland McGrath <mcgrathr@google.com>

[zx] Magenta -> Zircon

The Great Renaming is here!

Change-Id: I3229bdeb2a3d0e40fb4db6fec8ca7d971fbffb94


# 0a258603 13-Jun-2017 George Kulakowski <kulakowski@google.com>

[ulib][runtime] Use the MX_ERR_* and MX_OK mx_status_t names

Change-Id: I54b43959017d750c278fbee5a54fd04284fead91


# 4545baa0 25-Apr-2017 Todd Eisenberger <teisenbe@google.com>

[runtime] Clean up futex_wait_abstime

This function doesn't do anything anymore, so get rid of it.

Change-Id: I1e1a370bdb854b825b3ee5f9d6b3ea2d395d9967


# 599dae4d 25-Apr-2017 Todd Eisenberger <teisenbe@google.com>

[runtime] Remove unnecessary relative time calculation

Change-Id: Ic7cb0d89cbbcffe1ef8e6ff98ebe391a9495f0f8


# bbcb4c62 03-Apr-2017 Todd Eisenberger <teisenbe@google.com>

[time] Switch callers of syscalls with timeouts to use conversion function

This is in preparation for moving syscalls to absolute deadlines rather
than relative timeouts.

Change-Id: Ic85abbf76f34fbce7899c2505be840e3d3dcf7ff


# 7cd57a3e 07-Feb-2017 Mark Seaborn <mseaborn@google.com>

[runtime] Make mxr_mutex more efficient: change from 2-state lock to 3-state

This is a standard 3-state futex-based locking algorithm. See the
comment.

This requires updating the C11 cnd_* (condvar) implementation to
match.

This change means that mxr_mutex_unlock() won't do a futex_wake()
syscall in the uncontended case (when there are no waiting threads).

Also, mxr_mutex_unlock() will now wake only one thread at a time.
Previously, it would wake all waiting threads (though that was
unnecessary, even with a 2-state lock).

This also affects the C11 mtx_* implementation, which uses mxr_mutex.

This is a modified version of e4ae71336ad8b56b53aa5cb385374610b284c6a6
with MG-487 fixed: cnd_timedwait() must do
mxr_mutex_lock_with_waiter() unconditionally to ensure that threads
waiting on the mutex will get woken later.

MG-361

Change-Id: I94733d3a26c05852d34ce5c6571511c3e3e55456


# 496fe303 01-Feb-2017 Mark Seaborn <mseaborn@google.com>

Revert "[runtime] Make mxr_mutex more efficient: change from 2-state lock to 3-state"

This reverts commit e4ae71336ad8b56b53aa5cb385374610b284c6a6.

That change introduced a bug in the interaction between the mutex
implementation and the condvar implementation
(third_party/ulib/musl/src/thread/cnd_timedwait.c) which could lead to
missed mutex_unlock wakeups. That could cause c11-condvar-test to
hang.

MG-487 #done

Change-Id: I1519733e66330da27707ebb6b8a8c111f290ca73


# e4ae7133 24-Jan-2017 Mark Seaborn <mseaborn@google.com>

[runtime] Make mxr_mutex more efficient: change from 2-state lock to 3-state

This is a standard 3-state futex-based locking algorithm. See the
comment.

This requires updating the C11 cnd_* (condvar) implementation to
match.

This change means that mxr_mutex_unlock() won't do a futex_wake()
syscall in the uncontended case (when there are no waiting threads).

Also, mxr_mutex_unlock() will now wake only one thread at a time.
Previously, it would wake all waiting threads (though that was
unnecessary, even with a 2-state lock).

This also affects the C11 mtx_* implementation, which uses mxr_mutex.

MG-361

Change-Id: I6397bc0b2d4fc6c153d5eb22238e02fc5c8b5d33


# c8404e7b 03-Jan-2017 Mark Seaborn <mseaborn@google.com>

[ulib] mtx_timedlock(): Partly fix absolute->relative timeout calculation

When a timedlock() operation is implemented using an
absolute-to-relative timeout calculation, this calculation must be
redone every time we do a futex_wait(). This is because when our
futex_wait() call returns, the mutex could have been claimed by
another thread, so that we'll have to wait again. If our timeout was
for 10 seconds, we don't want our second futex_wait to be for the full
10 seconds.

So, move the calculation into timedlock()'s loop.

Also rename mxr_mutex_timedlock() to add a "__" prefix, to indicate
that it shouldn't be used except by mtx_timedlock(). (timedlock()
operations aren't used very much anyway, and mxr_mutex_* is currently
only used to implement mtx_*.)

This change will also make it easier to convert this mutex
implementation to use a more efficient 3-state mutex instead of a
2-state mutex.

MG-361

Change-Id: I8d30b83be05f3f11a923ab59fa149375f3909632


# 480ed69e 08-Sep-2016 Yvonne Yip <yky@google.com>

remove "garbage bin" error codes

Change-Id: Ic0866221523031612a7fd1097be654229911fc0d


# a3d7e591 01-Sep-2016 Roland McGrath <mcgrathr@google.com>

[ulib][magenta][runtime][musl] Give system calls _mx_* names, use them in musl

The mx_* name space is not kosher for the standard C library to use
for its own purpose. A conforming standard C program can define its
own functions called mx_* and this must not break the C library.

Give all the system call entry points in the vDSO names starting
with _mx_, with the old mx_ names as aliases. Use only the _mx_
names in runtime and musl.

Change-Id: Id01b57b87c0bb91733e9492159401ff019943822


# f2e57140 20-Aug-2016 Roland McGrath <mcgrathr@google.com>

[ulib][uapp] Use C11 atomics

Use C11 <stdatomic.h> instead of homegrown <system/atomic.h>.

Change-Id: Ibc6a4f6d1a1dae7b781e2a8d186a2dc4a56de0fd


# 66a201f1 16-Aug-2016 Brian Swetland <swetland@frotz.net>

[system] align license and license banners with Fuchsia

This adjusts the Magenta userspace code to match the prevailing
license in Fuchsia (three-clause BSD), using the same banner
and license text.

Change-Id: I6b6d79435c5dbaa32027888874849e4f47aaa7be


# 876c2135 14-Jul-2016 George Kulakowski <kulakowski@google.com>

[runtime] Use the atomic.h names in mutex

These atomic_ calls map to the same thing they are replacing, and the
issue we had with the exchange variants (the reason these were rewritten
to the raw __atomic_ versions) is long since cleaned up.

Change-Id: I2e3593dd587142fb334290da4f3d7307fc210a8a


# a732ad03 12-Jul-2016 Roland McGrath <mcgrathr@google.com>

[magenta][runtime] Make libmagenta and libruntime freestanding

libruntime should have no dependencies on anything but libmagenta.
The -ffreestanding switch tells the compiler not to generate calls
to standard libc functions (like memcpy or memset). The source code
must avoid explicit dependencies on libc functions too.

Change-Id: I83e259e37084a093ed72dc0ee0f539350f0a48f3


# 937bde71 11-Jul-2016 Brian Swetland <swetland@google.com>

[syscalls][api] rename _magenta_*() to mx_*()

The _magenta_ prefix is pretty unwieldy.
This change simplifies that a bit.

This was done mechanically, and boots, runs, and passes tests
on qemu arm64, amd64, and NUC.

Change-Id: I8eb07db6ed6f4b8cac96344cc4ad65ce3f85f917


# 2b5ff5e1 06-Jul-2016 George Kulakowski <kulakowski@google.com>

[ulib] Introduce header-only ulib/system

Change-Id: Iaa08b2149294bab157e95f480fe8f8c0765eae2e


# 86e0d295 23-Jun-2016 George Kulakowski <kulakowski@google.com>

[runtime] Fix the atomic cmpxchg in mxr_mutex_trylock

Change-Id: I8190bdd78b78563b007c9d054086335eafd27023


# 4ebbc5b1 15-Jun-2016 Brian Swetland <swetland@google.com>

[system] clang-format all of userspace

Change-Id: I6bb6a9187a4af83ca5c0656f05d89aa3a09fa5fa


# 53b9e1c8 15-Jun-2016 The Fuchsia Authors <authors@fuchsia.local>

[magenta] Initial commit