Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-11 Thread Andy Lutomirski
On Aug 11, 2016 12:01 AM, "Mathieu Desnoyers" wrote: > > - On Aug 10, 2016, at 4:09 PM, Andy Lutomirski l...@amacapital.net wrote: > > > On Wed, Aug 10, 2016 at 1:06 PM, Mathieu Desnoyers > > wrote: > > > > >>> u64 is a

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-11 Thread Andy Lutomirski
On Aug 11, 2016 12:01 AM, "Mathieu Desnoyers" wrote: > > - On Aug 10, 2016, at 4:09 PM, Andy Lutomirski l...@amacapital.net wrote: > > > On Wed, Aug 10, 2016 at 1:06 PM, Mathieu Desnoyers > > wrote: > > > > >>> u64 is a perfectly valid, if odd, userspace pointer on all > >>> architecures

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Boqun Feng
On Wed, Aug 10, 2016 at 05:33:44PM +, Mathieu Desnoyers wrote: > - On Aug 9, 2016, at 12:13 PM, Boqun Feng boqun.f...@gmail.com wrote: > > > > > > > However, I'm thinking maybe we can use some tricks to avoid unnecessary > > aborts-on-preemption. > > > > First of all, I notice we

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Boqun Feng
On Wed, Aug 10, 2016 at 05:33:44PM +, Mathieu Desnoyers wrote: > - On Aug 9, 2016, at 12:13 PM, Boqun Feng boqun.f...@gmail.com wrote: > > > > > > > However, I'm thinking maybe we can use some tricks to avoid unnecessary > > aborts-on-preemption. > > > > First of all, I notice we

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Mathieu Desnoyers
- On Aug 10, 2016, at 4:09 PM, Andy Lutomirski l...@amacapital.net wrote: > On Wed, Aug 10, 2016 at 1:06 PM, Mathieu Desnoyers > wrote: >>> u64 is a perfectly valid, if odd, userspace pointer on all >>> architecures that I know of, and it's certainly a

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Mathieu Desnoyers
- On Aug 10, 2016, at 4:09 PM, Andy Lutomirski l...@amacapital.net wrote: > On Wed, Aug 10, 2016 at 1:06 PM, Mathieu Desnoyers > wrote: >>> u64 is a perfectly valid, if odd, userspace pointer on all >>> architecures that I know of, and it's certainly a valid userspace >>> pointer on x86

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Mathieu Desnoyers
- On Aug 10, 2016, at 4:43 AM, Peter Zijlstra pet...@infradead.org wrote: > On Tue, Aug 09, 2016 at 08:06:40PM +, Mathieu Desnoyers wrote: >> > Also, I think it would be good to have a comment explaining why this is >> > split in two structures? Don't you rely on the address

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Mathieu Desnoyers
- On Aug 10, 2016, at 4:43 AM, Peter Zijlstra pet...@infradead.org wrote: > On Tue, Aug 09, 2016 at 08:06:40PM +, Mathieu Desnoyers wrote: >> > Also, I think it would be good to have a comment explaining why this is >> > split in two structures? Don't you rely on the address

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Mathieu Desnoyers
- On Aug 9, 2016, at 12:13 PM, Boqun Feng boqun.f...@gmail.com wrote: > > However, I'm thinking maybe we can use some tricks to avoid unnecessary > aborts-on-preemption. > > First of all, I notice we haven't make any constraint on what kind of > memory objects could be "protected" by rseq

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Mathieu Desnoyers
- On Aug 9, 2016, at 12:13 PM, Boqun Feng boqun.f...@gmail.com wrote: > > However, I'm thinking maybe we can use some tricks to avoid unnecessary > aborts-on-preemption. > > First of all, I notice we haven't make any constraint on what kind of > memory objects could be "protected" by rseq

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Christoph Lameter
On Wed, 10 Aug 2016, Mathieu Desnoyers wrote: > - preemption of kernel code (for atomicity wrt other threads). This would > replace preempt_disable()/preempt_enable() critical sections touching > per-cpu data shared with other threads. We would have to do the > event_counter > increment

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Christoph Lameter
On Wed, 10 Aug 2016, Mathieu Desnoyers wrote: > - preemption of kernel code (for atomicity wrt other threads). This would > replace preempt_disable()/preempt_enable() critical sections touching > per-cpu data shared with other threads. We would have to do the > event_counter > increment

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Andy Lutomirski
On Wed, Aug 10, 2016 at 1:06 PM, Mathieu Desnoyers wrote: > - On Aug 10, 2016, at 3:16 PM, Andy Lutomirski l...@amacapital.net wrote: > >> On Wed, Aug 10, 2016 at 12:04 PM, Mathieu Desnoyers >> wrote: >>> - On Aug 10, 2016,

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Andy Lutomirski
On Wed, Aug 10, 2016 at 1:06 PM, Mathieu Desnoyers wrote: > - On Aug 10, 2016, at 3:16 PM, Andy Lutomirski l...@amacapital.net wrote: > >> On Wed, Aug 10, 2016 at 12:04 PM, Mathieu Desnoyers >> wrote: >>> - On Aug 10, 2016, at 4:10 AM, Andy Lutomirski l...@amacapital.net >>> wrote: >>>

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Peter Zijlstra
On Tue, Aug 09, 2016 at 08:06:40PM +, Mathieu Desnoyers wrote: > > Also, do we want a comment somewhere that explains why overflow isn't a > > problem? > > I can add a comment about rseq_increment_event_counter stating: > > * Overflow of the event counter is not a problem in practice. It >

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Peter Zijlstra
On Tue, Aug 09, 2016 at 08:06:40PM +, Mathieu Desnoyers wrote: > > Also, do we want a comment somewhere that explains why overflow isn't a > > problem? > > I can add a comment about rseq_increment_event_counter stating: > > * Overflow of the event counter is not a problem in practice. It >

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Mathieu Desnoyers
- On Aug 10, 2016, at 3:16 PM, Andy Lutomirski l...@amacapital.net wrote: > On Wed, Aug 10, 2016 at 12:04 PM, Mathieu Desnoyers > wrote: >> - On Aug 10, 2016, at 4:10 AM, Andy Lutomirski l...@amacapital.net wrote: >> >>> On Tue, Aug 9, 2016 at 1:06 PM,

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Mathieu Desnoyers
- On Aug 10, 2016, at 3:16 PM, Andy Lutomirski l...@amacapital.net wrote: > On Wed, Aug 10, 2016 at 12:04 PM, Mathieu Desnoyers > wrote: >> - On Aug 10, 2016, at 4:10 AM, Andy Lutomirski l...@amacapital.net wrote: >> >>> On Tue, Aug 9, 2016 at 1:06 PM, Mathieu Desnoyers >>> wrote: >> >>

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Peter Zijlstra
On Tue, Aug 09, 2016 at 10:41:47PM +, Mathieu Desnoyers wrote: > #ifdef __LP64__ > > static bool rseq_update_cpu_id_event_counter(struct task_struct *t) > { > union rseq_cpu_event u; > > u.e.cpu_id = raw_smp_processor_id(); > u.e.event_counter =

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Peter Zijlstra
On Tue, Aug 09, 2016 at 10:41:47PM +, Mathieu Desnoyers wrote: > #ifdef __LP64__ > > static bool rseq_update_cpu_id_event_counter(struct task_struct *t) > { > union rseq_cpu_event u; > > u.e.cpu_id = raw_smp_processor_id(); > u.e.event_counter =

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Mathieu Desnoyers
- On Aug 3, 2016, at 2:29 PM, Chris Lameter c...@linux.com wrote: > On Tue, 26 Jul 2016, Mathieu Desnoyers wrote: > >> > What problem does this solve? >> >> It allows user-space to perform update operations on per-cpu data without >> requiring heavy-weight atomic operations. > > > This is

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Mathieu Desnoyers
- On Aug 3, 2016, at 2:29 PM, Chris Lameter c...@linux.com wrote: > On Tue, 26 Jul 2016, Mathieu Desnoyers wrote: > >> > What problem does this solve? >> >> It allows user-space to perform update operations on per-cpu data without >> requiring heavy-weight atomic operations. > > > This is

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Peter Zijlstra
On Tue, Aug 09, 2016 at 08:06:40PM +, Mathieu Desnoyers wrote: > On Aug 3, 2016, at 9:19 AM, Peter Zijlstra pet...@infradead.org wrote: > >> +++ b/kernel/sched/core.c > >> @@ -2664,6 +2664,7 @@ prepare_task_switch(struct rq *rq, struct task_struct > >> *prev, > >> { > >>

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Peter Zijlstra
On Tue, Aug 09, 2016 at 08:06:40PM +, Mathieu Desnoyers wrote: > On Aug 3, 2016, at 9:19 AM, Peter Zijlstra pet...@infradead.org wrote: > >> +++ b/kernel/sched/core.c > >> @@ -2664,6 +2664,7 @@ prepare_task_switch(struct rq *rq, struct task_struct > >> *prev, > >> { > >>

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Mathieu Desnoyers
- On Aug 10, 2016, at 4:01 AM, Andy Lutomirski l...@amacapital.net wrote: > On Tue, Aug 9, 2016 at 9:13 AM, Boqun Feng wrote: > >> However, I'm thinking maybe we can use some tricks to avoid unnecessary >> aborts-on-preemption. >> >> First of all, I notice we

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Mathieu Desnoyers
- On Aug 10, 2016, at 4:01 AM, Andy Lutomirski l...@amacapital.net wrote: > On Tue, Aug 9, 2016 at 9:13 AM, Boqun Feng wrote: > >> However, I'm thinking maybe we can use some tricks to avoid unnecessary >> aborts-on-preemption. >> >> First of all, I notice we haven't make any constraint

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Andy Lutomirski
On Wed, Aug 3, 2016 at 10:03 PM, Andy Lutomirski wrote: > On Wed, Aug 3, 2016 at 9:27 PM, Boqun Feng wrote: >> On Wed, Aug 03, 2016 at 09:37:57AM -0700, Andy Lutomirski wrote: >>> On Wed, Aug 3, 2016 at 5:27 AM, Peter Zijlstra

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Andy Lutomirski
On Wed, Aug 3, 2016 at 10:03 PM, Andy Lutomirski wrote: > On Wed, Aug 3, 2016 at 9:27 PM, Boqun Feng wrote: >> On Wed, Aug 03, 2016 at 09:37:57AM -0700, Andy Lutomirski wrote: >>> On Wed, Aug 3, 2016 at 5:27 AM, Peter Zijlstra wrote: >>> > On Tue, Jul 26, 2016 at 03:02:19AM +, Mathieu

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Andy Lutomirski
On Wed, Aug 10, 2016 at 12:04 PM, Mathieu Desnoyers wrote: > - On Aug 10, 2016, at 4:10 AM, Andy Lutomirski l...@amacapital.net wrote: > >> On Tue, Aug 9, 2016 at 1:06 PM, Mathieu Desnoyers >> wrote: > > > >>> Actually, we want

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Andy Lutomirski
On Wed, Aug 10, 2016 at 12:04 PM, Mathieu Desnoyers wrote: > - On Aug 10, 2016, at 4:10 AM, Andy Lutomirski l...@amacapital.net wrote: > >> On Tue, Aug 9, 2016 at 1:06 PM, Mathieu Desnoyers >> wrote: > > > >>> Actually, we want copy_from_user() there. This executes upon >>> resume to

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Peter Zijlstra
On Wed, Aug 10, 2016 at 01:57:05PM +, Mathieu Desnoyers wrote: > > We could equally well have chosen a single structure and picked the > > post_commit_ip field to trigger things from, no? > > > > The only down side seems to be that we must then impose ordering (but UP > > ordering, so that's

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Peter Zijlstra
On Wed, Aug 10, 2016 at 01:57:05PM +, Mathieu Desnoyers wrote: > > We could equally well have chosen a single structure and picked the > > post_commit_ip field to trigger things from, no? > > > > The only down side seems to be that we must then impose ordering (but UP > > ordering, so that's

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Peter Zijlstra
On Wed, Aug 10, 2016 at 01:26:04PM +, Mathieu Desnoyers wrote: > static bool rseq_update_cpu_id_event_counter(struct task_struct *t) > { > union rseq_cpu_event u; > > u.e.cpu_id = raw_smp_processor_id(); > u.e.event_counter = ++t->rseq_event_counter; > if

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Peter Zijlstra
On Wed, Aug 10, 2016 at 01:26:04PM +, Mathieu Desnoyers wrote: > static bool rseq_update_cpu_id_event_counter(struct task_struct *t) > { > union rseq_cpu_event u; > > u.e.cpu_id = raw_smp_processor_id(); > u.e.event_counter = ++t->rseq_event_counter; > if

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Andy Lutomirski
On Tue, Aug 9, 2016 at 1:06 PM, Mathieu Desnoyers wrote: > - On Aug 3, 2016, at 9:19 AM, Peter Zijlstra pet...@infradead.org wrote: > >> >>> +#endif >>> /* CPU-specific state of this task */ >>> struct thread_struct thread; >>> /* >>> @@ -3387,4

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Andy Lutomirski
On Tue, Aug 9, 2016 at 1:06 PM, Mathieu Desnoyers wrote: > - On Aug 3, 2016, at 9:19 AM, Peter Zijlstra pet...@infradead.org wrote: > >> >>> +#endif >>> /* CPU-specific state of this task */ >>> struct thread_struct thread; >>> /* >>> @@ -3387,4 +3392,67 @@ void

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Andy Lutomirski
On Tue, Aug 9, 2016 at 9:13 AM, Boqun Feng wrote: > On Wed, Aug 03, 2016 at 10:03:32PM -0700, Andy Lutomirski wrote: >> On Wed, Aug 3, 2016 at 9:27 PM, Boqun Feng wrote: >> > On Wed, Aug 03, 2016 at 09:37:57AM -0700, Andy Lutomirski wrote: >> >> On

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Andy Lutomirski
On Tue, Aug 9, 2016 at 9:13 AM, Boqun Feng wrote: > On Wed, Aug 03, 2016 at 10:03:32PM -0700, Andy Lutomirski wrote: >> On Wed, Aug 3, 2016 at 9:27 PM, Boqun Feng wrote: >> > On Wed, Aug 03, 2016 at 09:37:57AM -0700, Andy Lutomirski wrote: >> >> On Wed, Aug 3, 2016 at 5:27 AM, Peter Zijlstra

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Mathieu Desnoyers
- On Aug 10, 2016, at 4:10 AM, Andy Lutomirski l...@amacapital.net wrote: > On Tue, Aug 9, 2016 at 1:06 PM, Mathieu Desnoyers > wrote: >> Actually, we want copy_from_user() there. This executes upon >> resume to user-space, so we can take a page fault is

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Mathieu Desnoyers
- On Aug 10, 2016, at 4:10 AM, Andy Lutomirski l...@amacapital.net wrote: > On Tue, Aug 9, 2016 at 1:06 PM, Mathieu Desnoyers > wrote: >> Actually, we want copy_from_user() there. This executes upon >> resume to user-space, so we can take a page fault is needed, so >> no "inatomic"

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Mathieu Desnoyers
- On Aug 10, 2016, at 3:50 AM, Peter Zijlstra pet...@infradead.org wrote: > On Tue, Aug 09, 2016 at 10:41:47PM +, Mathieu Desnoyers wrote: >> #ifdef __LP64__ >> >> static bool rseq_update_cpu_id_event_counter(struct task_struct *t) >> { >> union rseq_cpu_event u; >> >>

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Mathieu Desnoyers
- On Aug 10, 2016, at 9:33 AM, Peter Zijlstra pet...@infradead.org wrote: > On Wed, Aug 10, 2016 at 01:26:04PM +, Mathieu Desnoyers wrote: > >> static bool rseq_update_cpu_id_event_counter(struct task_struct *t) >> { >> union rseq_cpu_event u; >> >> u.e.cpu_id =

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Mathieu Desnoyers
- On Aug 10, 2016, at 3:50 AM, Peter Zijlstra pet...@infradead.org wrote: > On Tue, Aug 09, 2016 at 10:41:47PM +, Mathieu Desnoyers wrote: >> #ifdef __LP64__ >> >> static bool rseq_update_cpu_id_event_counter(struct task_struct *t) >> { >> union rseq_cpu_event u; >> >>

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Mathieu Desnoyers
- On Aug 10, 2016, at 9:33 AM, Peter Zijlstra pet...@infradead.org wrote: > On Wed, Aug 10, 2016 at 01:26:04PM +, Mathieu Desnoyers wrote: > >> static bool rseq_update_cpu_id_event_counter(struct task_struct *t) >> { >> union rseq_cpu_event u; >> >> u.e.cpu_id =

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Mathieu Desnoyers
- On Aug 10, 2016, at 10:28 AM, Peter Zijlstra pet...@infradead.org wrote: > On Wed, Aug 10, 2016 at 01:57:05PM +, Mathieu Desnoyers wrote: > >> > We could equally well have chosen a single structure and picked the >> > post_commit_ip field to trigger things from, no? >> > >> > The only

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-10 Thread Mathieu Desnoyers
- On Aug 10, 2016, at 10:28 AM, Peter Zijlstra pet...@infradead.org wrote: > On Wed, Aug 10, 2016 at 01:57:05PM +, Mathieu Desnoyers wrote: > >> > We could equally well have chosen a single structure and picked the >> > post_commit_ip field to trigger things from, no? >> > >> > The only

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-09 Thread Mathieu Desnoyers
- On Aug 9, 2016, at 5:33 PM, Peter Zijlstra pet...@infradead.org wrote: > On Tue, Aug 09, 2016 at 08:06:40PM +, Mathieu Desnoyers wrote: >> >> +static int rseq_increment_event_counter(struct task_struct *t) >> >> +{ >> >> + if (__put_user(++t->rseq_event_counter, >> >> +

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-09 Thread Mathieu Desnoyers
- On Aug 9, 2016, at 5:33 PM, Peter Zijlstra pet...@infradead.org wrote: > On Tue, Aug 09, 2016 at 08:06:40PM +, Mathieu Desnoyers wrote: >> >> +static int rseq_increment_event_counter(struct task_struct *t) >> >> +{ >> >> + if (__put_user(++t->rseq_event_counter, >> >> +

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-09 Thread Peter Zijlstra
On Tue, Aug 09, 2016 at 08:06:40PM +, Mathieu Desnoyers wrote: > >> +static int rseq_increment_event_counter(struct task_struct *t) > >> +{ > >> + if (__put_user(++t->rseq_event_counter, > >> + >rseq->u.e.event_counter)) > >> + return -1; > >> + return 0; > >> +} >

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-09 Thread Peter Zijlstra
On Tue, Aug 09, 2016 at 08:06:40PM +, Mathieu Desnoyers wrote: > >> +static int rseq_increment_event_counter(struct task_struct *t) > >> +{ > >> + if (__put_user(++t->rseq_event_counter, > >> + >rseq->u.e.event_counter)) > >> + return -1; > >> + return 0; > >> +} >

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-09 Thread Mathieu Desnoyers
- On Aug 3, 2016, at 9:19 AM, Peter Zijlstra pet...@infradead.org wrote: > On Thu, Jul 21, 2016 at 05:14:16PM -0400, Mathieu Desnoyers wrote: [...] > >> diff --git a/include/linux/sched.h b/include/linux/sched.h >> index 253538f..5c4b900 100644 >> --- a/include/linux/sched.h >> +++

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-09 Thread Mathieu Desnoyers
- On Aug 3, 2016, at 9:19 AM, Peter Zijlstra pet...@infradead.org wrote: > On Thu, Jul 21, 2016 at 05:14:16PM -0400, Mathieu Desnoyers wrote: [...] > >> diff --git a/include/linux/sched.h b/include/linux/sched.h >> index 253538f..5c4b900 100644 >> --- a/include/linux/sched.h >> +++

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-09 Thread Boqun Feng
On Wed, Aug 03, 2016 at 10:03:32PM -0700, Andy Lutomirski wrote: > On Wed, Aug 3, 2016 at 9:27 PM, Boqun Feng wrote: > > On Wed, Aug 03, 2016 at 09:37:57AM -0700, Andy Lutomirski wrote: > >> On Wed, Aug 3, 2016 at 5:27 AM, Peter Zijlstra > >> wrote: >

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-09 Thread Boqun Feng
On Wed, Aug 03, 2016 at 10:03:32PM -0700, Andy Lutomirski wrote: > On Wed, Aug 3, 2016 at 9:27 PM, Boqun Feng wrote: > > On Wed, Aug 03, 2016 at 09:37:57AM -0700, Andy Lutomirski wrote: > >> On Wed, Aug 3, 2016 at 5:27 AM, Peter Zijlstra > >> wrote: > >> > On Tue, Jul 26, 2016 at 03:02:19AM

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-09 Thread Mathieu Desnoyers
- On Aug 7, 2016, at 7:35 PM, Boqun Feng boqun.f...@gmail.com wrote: > On Sun, Aug 07, 2016 at 03:36:24PM +, Mathieu Desnoyers wrote: >> - On Aug 3, 2016, at 11:45 AM, Boqun Feng boqun.f...@gmail.com wrote: >> >> > On Wed, Aug 03, 2016 at 03:19:40PM +0200, Peter Zijlstra wrote: >> >>

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-09 Thread Mathieu Desnoyers
- On Aug 7, 2016, at 7:35 PM, Boqun Feng boqun.f...@gmail.com wrote: > On Sun, Aug 07, 2016 at 03:36:24PM +, Mathieu Desnoyers wrote: >> - On Aug 3, 2016, at 11:45 AM, Boqun Feng boqun.f...@gmail.com wrote: >> >> > On Wed, Aug 03, 2016 at 03:19:40PM +0200, Peter Zijlstra wrote: >> >>

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-07 Thread Boqun Feng
On Sun, Aug 07, 2016 at 03:36:24PM +, Mathieu Desnoyers wrote: > - On Aug 3, 2016, at 11:45 AM, Boqun Feng boqun.f...@gmail.com wrote: > > > On Wed, Aug 03, 2016 at 03:19:40PM +0200, Peter Zijlstra wrote: > >> On Thu, Jul 21, 2016 at 05:14:16PM -0400, Mathieu Desnoyers wrote: > >> > diff

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-07 Thread Boqun Feng
On Sun, Aug 07, 2016 at 03:36:24PM +, Mathieu Desnoyers wrote: > - On Aug 3, 2016, at 11:45 AM, Boqun Feng boqun.f...@gmail.com wrote: > > > On Wed, Aug 03, 2016 at 03:19:40PM +0200, Peter Zijlstra wrote: > >> On Thu, Jul 21, 2016 at 05:14:16PM -0400, Mathieu Desnoyers wrote: > >> > diff

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-07 Thread Mathieu Desnoyers
- On Aug 3, 2016, at 11:45 AM, Boqun Feng boqun.f...@gmail.com wrote: > On Wed, Aug 03, 2016 at 03:19:40PM +0200, Peter Zijlstra wrote: >> On Thu, Jul 21, 2016 at 05:14:16PM -0400, Mathieu Desnoyers wrote: >> > diff --git a/MAINTAINERS b/MAINTAINERS >> > index 1209323..daef027 100644 >> > ---

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-07 Thread Mathieu Desnoyers
- On Aug 3, 2016, at 11:45 AM, Boqun Feng boqun.f...@gmail.com wrote: > On Wed, Aug 03, 2016 at 03:19:40PM +0200, Peter Zijlstra wrote: >> On Thu, Jul 21, 2016 at 05:14:16PM -0400, Mathieu Desnoyers wrote: >> > diff --git a/MAINTAINERS b/MAINTAINERS >> > index 1209323..daef027 100644 >> > ---

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-03 Thread Andy Lutomirski
On Wed, Aug 3, 2016 at 9:27 PM, Boqun Feng wrote: > On Wed, Aug 03, 2016 at 09:37:57AM -0700, Andy Lutomirski wrote: >> On Wed, Aug 3, 2016 at 5:27 AM, Peter Zijlstra wrote: >> > On Tue, Jul 26, 2016 at 03:02:19AM +, Mathieu Desnoyers wrote: >> >>

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-03 Thread Andy Lutomirski
On Wed, Aug 3, 2016 at 9:27 PM, Boqun Feng wrote: > On Wed, Aug 03, 2016 at 09:37:57AM -0700, Andy Lutomirski wrote: >> On Wed, Aug 3, 2016 at 5:27 AM, Peter Zijlstra wrote: >> > On Tue, Jul 26, 2016 at 03:02:19AM +, Mathieu Desnoyers wrote: >> >> We really care about preemption here. Every

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-03 Thread Andy Lutomirski
On Aug 3, 2016 11:31 AM, "Christoph Lameter" wrote: > > On Wed, 3 Aug 2016, Andy Lutomirski wrote: > > > > Well, a CMPXCHG without LOCK prefix isn't all that expensive on x86. > > > > > > It is however on PPC and possibly other architectures, so in name of > > > simplicity

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-03 Thread Andy Lutomirski
On Aug 3, 2016 11:31 AM, "Christoph Lameter" wrote: > > On Wed, 3 Aug 2016, Andy Lutomirski wrote: > > > > Well, a CMPXCHG without LOCK prefix isn't all that expensive on x86. > > > > > > It is however on PPC and possibly other architectures, so in name of > > > simplicity supporting only the one

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-03 Thread Boqun Feng
On Wed, Aug 03, 2016 at 09:37:57AM -0700, Andy Lutomirski wrote: > On Wed, Aug 3, 2016 at 5:27 AM, Peter Zijlstra wrote: > > On Tue, Jul 26, 2016 at 03:02:19AM +, Mathieu Desnoyers wrote: > >> We really care about preemption here. Every migration implies a > >>

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-03 Thread Boqun Feng
On Wed, Aug 03, 2016 at 09:37:57AM -0700, Andy Lutomirski wrote: > On Wed, Aug 3, 2016 at 5:27 AM, Peter Zijlstra wrote: > > On Tue, Jul 26, 2016 at 03:02:19AM +, Mathieu Desnoyers wrote: > >> We really care about preemption here. Every migration implies a > >> preemption from a user-space

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-03 Thread Christoph Lameter
On Wed, 3 Aug 2016, Andy Lutomirski wrote: > > Well, a CMPXCHG without LOCK prefix isn't all that expensive on x86. > > > > It is however on PPC and possibly other architectures, so in name of > > simplicity supporting only the one variant makes sense. > > > > I wouldn't want to depend on

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-03 Thread Christoph Lameter
On Wed, 3 Aug 2016, Andy Lutomirski wrote: > > Well, a CMPXCHG without LOCK prefix isn't all that expensive on x86. > > > > It is however on PPC and possibly other architectures, so in name of > > simplicity supporting only the one variant makes sense. > > > > I wouldn't want to depend on

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-03 Thread Christoph Lameter
On Tue, 26 Jul 2016, Mathieu Desnoyers wrote: > > What problem does this solve? > > It allows user-space to perform update operations on per-cpu data without > requiring heavy-weight atomic operations. This is great but seems to indicate that such a facility would be better for kernel code

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-03 Thread Christoph Lameter
On Tue, 26 Jul 2016, Mathieu Desnoyers wrote: > > What problem does this solve? > > It allows user-space to perform update operations on per-cpu data without > requiring heavy-weight atomic operations. This is great but seems to indicate that such a facility would be better for kernel code

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-03 Thread Andy Lutomirski
On Wed, Aug 3, 2016 at 5:27 AM, Peter Zijlstra wrote: > On Tue, Jul 26, 2016 at 03:02:19AM +, Mathieu Desnoyers wrote: >> We really care about preemption here. Every migration implies a >> preemption from a user-space perspective. If we would only care >> about keeping

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-03 Thread Andy Lutomirski
On Wed, Aug 3, 2016 at 5:27 AM, Peter Zijlstra wrote: > On Tue, Jul 26, 2016 at 03:02:19AM +, Mathieu Desnoyers wrote: >> We really care about preemption here. Every migration implies a >> preemption from a user-space perspective. If we would only care >> about keeping the CPU id up-to-date,

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-03 Thread Boqun Feng
On Wed, Aug 03, 2016 at 03:19:40PM +0200, Peter Zijlstra wrote: > On Thu, Jul 21, 2016 at 05:14:16PM -0400, Mathieu Desnoyers wrote: > > diff --git a/MAINTAINERS b/MAINTAINERS > > index 1209323..daef027 100644 > > --- a/MAINTAINERS > > +++ b/MAINTAINERS > > @@ -5085,6 +5085,13 @@ M: Joe Perches

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-03 Thread Boqun Feng
On Wed, Aug 03, 2016 at 03:19:40PM +0200, Peter Zijlstra wrote: > On Thu, Jul 21, 2016 at 05:14:16PM -0400, Mathieu Desnoyers wrote: > > diff --git a/MAINTAINERS b/MAINTAINERS > > index 1209323..daef027 100644 > > --- a/MAINTAINERS > > +++ b/MAINTAINERS > > @@ -5085,6 +5085,13 @@ M: Joe Perches

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-03 Thread Paul E. McKenney
On Wed, Aug 03, 2016 at 03:19:40PM +0200, Peter Zijlstra wrote: > On Thu, Jul 21, 2016 at 05:14:16PM -0400, Mathieu Desnoyers wrote: > > diff --git a/MAINTAINERS b/MAINTAINERS > > index 1209323..daef027 100644 > > --- a/MAINTAINERS > > +++ b/MAINTAINERS > > @@ -5085,6 +5085,13 @@ M: Joe Perches

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-03 Thread Paul E. McKenney
On Wed, Aug 03, 2016 at 03:19:40PM +0200, Peter Zijlstra wrote: > On Thu, Jul 21, 2016 at 05:14:16PM -0400, Mathieu Desnoyers wrote: > > diff --git a/MAINTAINERS b/MAINTAINERS > > index 1209323..daef027 100644 > > --- a/MAINTAINERS > > +++ b/MAINTAINERS > > @@ -5085,6 +5085,13 @@ M: Joe Perches

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-03 Thread Peter Zijlstra
On Thu, Jul 21, 2016 at 05:14:16PM -0400, Mathieu Desnoyers wrote: > diff --git a/MAINTAINERS b/MAINTAINERS > index 1209323..daef027 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -5085,6 +5085,13 @@ M: Joe Perches > S: Maintained > F: scripts/get_maintainer.pl >

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-03 Thread Peter Zijlstra
On Thu, Jul 21, 2016 at 05:14:16PM -0400, Mathieu Desnoyers wrote: > diff --git a/MAINTAINERS b/MAINTAINERS > index 1209323..daef027 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -5085,6 +5085,13 @@ M: Joe Perches > S: Maintained > F: scripts/get_maintainer.pl > > +RESTARTABLE

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-03 Thread Peter Zijlstra
On Tue, Jul 26, 2016 at 03:02:19AM +, Mathieu Desnoyers wrote: > We really care about preemption here. Every migration implies a > preemption from a user-space perspective. If we would only care > about keeping the CPU id up-to-date, hooking into migration would be > enough. But since we want

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-08-03 Thread Peter Zijlstra
On Tue, Jul 26, 2016 at 03:02:19AM +, Mathieu Desnoyers wrote: > We really care about preemption here. Every migration implies a > preemption from a user-space perspective. If we would only care > about keeping the CPU id up-to-date, hooking into migration would be > enough. But since we want

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-07-27 Thread Mathieu Desnoyers
- On Jul 27, 2016, at 11:03 AM, Boqun Feng boqun.f...@gmail.com wrote: > Hi Mathieu, > > On Thu, Jul 21, 2016 at 05:14:16PM -0400, Mathieu Desnoyers wrote: >> Expose a new system call allowing each thread to register one userspace >> memory area to be used as an ABI between kernel and

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-07-27 Thread Mathieu Desnoyers
- On Jul 27, 2016, at 11:03 AM, Boqun Feng boqun.f...@gmail.com wrote: > Hi Mathieu, > > On Thu, Jul 21, 2016 at 05:14:16PM -0400, Mathieu Desnoyers wrote: >> Expose a new system call allowing each thread to register one userspace >> memory area to be used as an ABI between kernel and

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-07-27 Thread Boqun Feng
Hi Mathieu, On Thu, Jul 21, 2016 at 05:14:16PM -0400, Mathieu Desnoyers wrote: > Expose a new system call allowing each thread to register one userspace > memory area to be used as an ABI between kernel and user-space for two > purposes: user-space restartable sequences and quick access to read

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-07-27 Thread Boqun Feng
Hi Mathieu, On Thu, Jul 21, 2016 at 05:14:16PM -0400, Mathieu Desnoyers wrote: > Expose a new system call allowing each thread to register one userspace > memory area to be used as an ABI between kernel and user-space for two > purposes: user-space restartable sequences and quick access to read

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-07-25 Thread Mathieu Desnoyers
- On Jul 25, 2016, at 7:02 PM, Andy Lutomirski l...@amacapital.net wrote: > On Thu, Jul 21, 2016 at 2:14 PM, Mathieu Desnoyers > wrote: >> Man page associated: >> >> RSEQ(2)Linux Programmer's Manual RSEQ(2) >> >> NAME >>

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-07-25 Thread Mathieu Desnoyers
- On Jul 25, 2016, at 7:02 PM, Andy Lutomirski l...@amacapital.net wrote: > On Thu, Jul 21, 2016 at 2:14 PM, Mathieu Desnoyers > wrote: >> Man page associated: >> >> RSEQ(2)Linux Programmer's Manual RSEQ(2) >> >> NAME >>rseq - Restartable sequences and

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-07-25 Thread Andy Lutomirski
On Thu, Jul 21, 2016 at 2:14 PM, Mathieu Desnoyers wrote: > Man page associated: > > RSEQ(2)Linux Programmer's Manual RSEQ(2) > > NAME >rseq - Restartable sequences and cpu number cache > > SYNOPSIS >#include > >

Re: [RFC PATCH v7 1/7] Restartable sequences system call

2016-07-25 Thread Andy Lutomirski
On Thu, Jul 21, 2016 at 2:14 PM, Mathieu Desnoyers wrote: > Man page associated: > > RSEQ(2)Linux Programmer's Manual RSEQ(2) > > NAME >rseq - Restartable sequences and cpu number cache > > SYNOPSIS >#include > >int rseq(struct rseq * rseq,

[RFC PATCH v7 1/7] Restartable sequences system call

2016-07-21 Thread Mathieu Desnoyers
Expose a new system call allowing each thread to register one userspace memory area to be used as an ABI between kernel and user-space for two purposes: user-space restartable sequences and quick access to read the current CPU number value from user-space. * Restartable sequences (per-cpu

[RFC PATCH v7 1/7] Restartable sequences system call

2016-07-21 Thread Mathieu Desnoyers
Expose a new system call allowing each thread to register one userspace memory area to be used as an ABI between kernel and user-space for two purposes: user-space restartable sequences and quick access to read the current CPU number value from user-space. * Restartable sequences (per-cpu