Re: [RFC] kern: simple futex for gnumach (version 11)

2014-01-10 Thread Richard Braun
On Fri, Jan 10, 2014 at 08:28:12AM +0100, Marin Ramesa wrote: > On 01/10/2014 01:59:55 AM, Richard Braun wrote: > >On Thu, Jan 09, 2014 at 09:51:51PM +0100, Marin Ramesa wrote: > >> On 01/09/2014 05:52:21 PM, Richard Braun wrote: > >> >On Thu, Jan 09, 2014 at 05:06:09PM +0100, Marin Ramesa wrote: >

Re: [RFC] kern: simple futex for gnumach (version 11)

2014-01-09 Thread Marin Ramesa
On 01/09/2014 05:36:18 PM, Diego Nieto Cid wrote: Finally, why is pfutexes an array? You are always using it's last element (that is if the ARRAY_SIZE macro worked as intended). I was actually not using it, so I didn't notice the bug while testing. Thanks for the comments, the code has been cor

Re: [RFC] kern: simple futex for gnumach (version 11)

2014-01-09 Thread Marin Ramesa
On 01/10/2014 01:59:55 AM, Richard Braun wrote: On Thu, Jan 09, 2014 at 09:51:51PM +0100, Marin Ramesa wrote: > On 01/09/2014 05:52:21 PM, Richard Braun wrote: > >On Thu, Jan 09, 2014 at 05:06:09PM +0100, Marin Ramesa wrote: > >> Shouldn't the compare be atomic. Maybe I don't understand what > >>

Re: [RFC] kern: simple futex for gnumach (version 11)

2014-01-09 Thread Richard Braun
On Thu, Jan 09, 2014 at 09:51:51PM +0100, Marin Ramesa wrote: > On 01/09/2014 05:52:21 PM, Richard Braun wrote: > >On Thu, Jan 09, 2014 at 05:06:09PM +0100, Marin Ramesa wrote: > >> Shouldn't the compare be atomic. Maybe I don't understand what > >> atomic really > >> means but the GCC manual says

Re: [RFC] kern: simple futex for gnumach (version 11)

2014-01-09 Thread Marin Ramesa
On 01/09/2014 05:52:21 PM, Richard Braun wrote: On Thu, Jan 09, 2014 at 05:06:09PM +0100, Marin Ramesa wrote: > Shouldn't the compare be atomic. Maybe I don't understand what > atomic really > means but the GCC manual says this function is. Or is it enough to > hold the lock. From the GCC manual

Re: [RFC] kern: simple futex for gnumach (version 11)

2014-01-09 Thread Richard Braun
On Thu, Jan 09, 2014 at 05:52:21PM +0100, Richard Braun wrote: > On Thu, Jan 09, 2014 at 05:06:09PM +0100, Marin Ramesa wrote: > > >> +simple_lock(&futex_shared_lock); > > >> + > > >> +thread_timeout_setup(current_threa

Re: [RFC] kern: simple futex for gnumach (version 11)

2014-01-09 Thread Richard Braun
On Thu, Jan 09, 2014 at 05:06:09PM +0100, Marin Ramesa wrote: > On 01/09/2014 03:45:35 PM, Richard Braun wrote: > >> +/* TODO Should be per-task. */ > >> +static struct futex *pfutexes; > > > >Most locks are private, so yes, do work on that too. > > I actually did not implement this because I don'

Re: [RFC] kern: simple futex for gnumach (version 11)

2014-01-09 Thread Richard Braun
On Thu, Jan 09, 2014 at 02:36:18PM -0200, Diego Nieto Cid wrote: > 2014/1/8 Marin Ramesa > > > > + > > +static unsigned long futex_init(task_t task, vm_offset_t address, > > boolean_t private_futex, struct futex *futex) > > +{ > > + unsigned long node_slot = 0; > > + > > + futex = (st

Re: [RFC] kern: simple futex for gnumach (version 11)

2014-01-09 Thread Diego Nieto Cid
Hi I don't really know about futexes so I will only comment on C language stuff. 2014/1/8 Marin Ramesa > > + > +static unsigned long futex_init(task_t task, vm_offset_t address, boolean_t > private_futex, struct futex *futex) > +{ > + unsigned long node_slot = 0; > + > + futex = (st

Re: [RFC] kern: simple futex for gnumach (version 11)

2014-01-09 Thread Marin Ramesa
On 01/09/2014 03:45:35 PM, Richard Braun wrote: > +/* TODO Should be per-task. */ > +static struct futex *pfutexes; Most locks are private, so yes, do work on that too. I actually did not implement this because I don't know how. How to make a variable visible only and private to a task? I trie

Re: [RFC] kern: simple futex for gnumach (version 11)

2014-01-09 Thread Richard Braun
On Wed, Jan 08, 2014 at 08:43:28PM +0100, Marin Ramesa wrote: > As far the code is concerned I bypassed the opacity of red-black tree > structures in two places, as I always get a segfault somewhere in the > rbtree module. If you need to do that, it's very likely you're not using it correctly. >

Re: [RFC] kern: simple futex for gnumach (version 11)

2014-01-08 Thread Richard Braun
On Wed, Jan 08, 2014 at 08:43:28PM +0100, Marin Ramesa wrote: > First threads were blocked and awakened when called from userspace. :) > > Timed waits work as expected. Private and shared futexes always block threads > when called from futex_wait(). > > This is now ready for test. What needs to

[RFC] kern: simple futex for gnumach (version 11)

2014-01-08 Thread Marin Ramesa
First threads were blocked and awakened when called from userspace. :) Timed waits work as expected. Private and shared futexes always block threads when called from futex_wait(). This is now ready for test. What needs to be tested is: 1. If sync circle actually wakes the threads when sent a wa