On 2017-04-28 at 16:19 Barret Rhoden <[email protected]> wrote:
> The following changes since commit 41ab54b78d870d46cdbc6100e9a96dcf64b82fae:
>
> Mark 'user' as PHONY in the top-level Makefile (2017-04-25 15:27:41 -0400)
>
> are available in the git repository at:
>
> [email protected]:brho/akaros.git uth
>
> for you to fetch changes up to 1f6e281e8bb5343138f7b21b4d63a2b092cda283:
>
> pthreads: Remove sched_policy and sched_priority (2017-04-28 16:00:53 -0400)
Turns out there was a bug in the malloc locks and a couple other minor
things. Here's the diff. Regardless, I'll merge shortly.
Barret
diff --git
a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/malloc-machine.h
b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/malloc-machine.h
index 8a085b6eb58e..be8060e523ee 100644
---
a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/malloc-machine.h
+++
b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/malloc-machine.h
@@ -28,7 +28,7 @@ typedef struct spin_pdr_lock mutex_t;
/* These macros expect to take a pointer to the object */
#define mutex_init(m) spin_pdr_init(m)
#define mutex_lock(m) spin_pdr_lock(m)
-#define mutex_trylock(m) spin_pdr_trylock(m)
+#define mutex_trylock(m) ({ spin_pdr_trylock(m) ? 0 : EBUSY; })
#define mutex_unlock(m) spin_pdr_unlock(m)
#define MUTEX_INITIALIZER SPINPDR_INITIALIZER
diff --git a/user/parlib/include/parlib/stdio.h
b/user/parlib/include/parlib/stdio.h
index 3ab2319aa4e9..572b47330e5a 100644
--- a/user/parlib/include/parlib/stdio.h
+++ b/user/parlib/include/parlib/stdio.h
@@ -73,8 +73,9 @@ do {
\
__vc_ctx_fprintf(stdout, __VA_ARGS__);
\
} while (0)
-#define I_AM_HERE printf("PID %d, vcore %d is in %s() at %s:%d\n",
\
- getpid(), vcore_id(), __FUNCTION__, __FILE__,
\
- __LINE__)
+#define I_AM_HERE __vc_ctx_fprintf(stderr,
\
+ "PID %d, vcore %d is in %s() at %s:%d\n",
\
+ getpid(), vcore_id(), __FUNCTION__,
\
+ __FILE__, __LINE__)
__END_DECLS
diff --git a/user/parlib/include/parlib/uthread.h
b/user/parlib/include/parlib/uthread.h
index 7b970a1ccb8b..3f2e42c32123 100644
--- a/user/parlib/include/parlib/uthread.h
+++ b/user/parlib/include/parlib/uthread.h
@@ -78,8 +78,9 @@ extern __thread struct uthread *current_uthread;
* either use the uthread->sync_next field, or add its own field to its thread
* structure.
*
- * If we need to increase the size, we'll run into issues with OpenMP locks and
- * sem_t (see semaphore.c). */
+ * If we need to increase the size, then do a full rebuild (with a make clean)
+ * of the toolchain. libgomp and probably c++ threads care about the size of
+ * objects that contain uth_sync_t. */
typedef struct __uth_sync_opaque {
uint8_t foo[sizeof(uintptr_t) *
2];
} __attribute__ ((aligned(sizeof(uintptr_t)))) uth_sync_t;
diff --git a/user/pthread/semaphore.c b/user/pthread/semaphore.c
index dd953877ae77..96ee4cf059ea 100644
--- a/user/pthread/semaphore.c
+++ b/user/pthread/semaphore.c
@@ -6,16 +6,6 @@
int sem_init(sem_t *__sem, int __pshared, unsigned int __value)
{
- /* sem_t is currently omp_lock_t in gcc/libgomp. (set in
- * gcc-4.9.2/libgomp/config/posix/omp-lock.h). The size must be 32
bytes -
- * not less than! Also, simply aligning is too much, since the
- * omp_lock_t is embedded in other structs who have similar
requirements.
- *
- * If we ever change omp_lock_t to be a pthread_mutex_t, we'll probably
have
- * similar problems there. We might be able to use a spin_pdr_lock,
though
- * it's not clear if an OMP lock should be a mutex or a spinlock. */
- parlib_static_assert(sizeof(sem_t) == 32);
-
if (__pshared == TRUE) {
printf("__pshared functionality of sem_init is not yet
implemented!");
return -1;
--
You received this message because you are subscribed to the Google Groups
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.