Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-15 Thread Christopher Lameter
On Fri, 15 Dec 2017, Mathieu Desnoyers wrote: > Another aspect that worries me is applications using the gs segment selector > for other purposes. Suddenly reserving the gs segment selector for use by a > library like glibc may lead to incompatibilities with applications already > using it.

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-15 Thread Christopher Lameter
On Fri, 15 Dec 2017, Mathieu Desnoyers wrote: > Another aspect that worries me is applications using the gs segment selector > for other purposes. Suddenly reserving the gs segment selector for use by a > library like glibc may lead to incompatibilities with applications already > using it.

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-15 Thread Mathieu Desnoyers
- On Dec 15, 2017, at 10:05 AM, Chris Lameter c...@linux.com wrote: > On Thu, 14 Dec 2017, Peter Zijlstra wrote: > >> > But my company has extensive user space code that maintains a lot of >> > counters and does other tricks to get full performance out of the >> > hardware. Such a mechanism

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-15 Thread Mathieu Desnoyers
- On Dec 15, 2017, at 10:05 AM, Chris Lameter c...@linux.com wrote: > On Thu, 14 Dec 2017, Peter Zijlstra wrote: > >> > But my company has extensive user space code that maintains a lot of >> > counters and does other tricks to get full performance out of the >> > hardware. Such a mechanism

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-15 Thread Christopher Lameter
On Thu, 14 Dec 2017, Peter Zijlstra wrote: > > But my company has extensive user space code that maintains a lot of > > counters and does other tricks to get full performance out of the > > hardware. Such a mechanism would also be good from user space. Why keep > > the good stuff only inside the

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-15 Thread Christopher Lameter
On Thu, 14 Dec 2017, Peter Zijlstra wrote: > > But my company has extensive user space code that maintains a lot of > > counters and does other tricks to get full performance out of the > > hardware. Such a mechanism would also be good from user space. Why keep > > the good stuff only inside the

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-14 Thread Peter Zijlstra
On Thu, Dec 14, 2017 at 03:14:00PM -0600, Christopher Lameter wrote: > On Thu, 14 Dec 2017, Mathieu Desnoyers wrote: > > > If we port this concept to kernel-space (as I start to understand > > would be your wish), then a simple pointer store to the current > > task_struct would suffice. > >

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-14 Thread Peter Zijlstra
On Thu, Dec 14, 2017 at 03:14:00PM -0600, Christopher Lameter wrote: > On Thu, 14 Dec 2017, Mathieu Desnoyers wrote: > > > If we port this concept to kernel-space (as I start to understand > > would be your wish), then a simple pointer store to the current > > task_struct would suffice. > >

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-14 Thread Christopher Lameter
On Thu, 14 Dec 2017, Mathieu Desnoyers wrote: > If we port this concept to kernel-space (as I start to understand > would be your wish), then a simple pointer store to the current > task_struct would suffice. Certainly such a port would be beneficial for non x86 archs. But my company has

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-14 Thread Christopher Lameter
On Thu, 14 Dec 2017, Mathieu Desnoyers wrote: > If we port this concept to kernel-space (as I start to understand > would be your wish), then a simple pointer store to the current > task_struct would suffice. Certainly such a port would be beneficial for non x86 archs. But my company has

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-14 Thread Peter Zijlstra
On Thu, Dec 14, 2017 at 07:57:08PM +, Mathieu Desnoyers wrote: > - On Dec 14, 2017, at 2:48 PM, Peter Zijlstra pet...@infradead.org wrote: > > > On Thu, Dec 14, 2017 at 12:50:13PM -0600, Christopher Lameter wrote: > >> Ultimately I wish fast increments like done by this_cpu_inc() could be

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-14 Thread Peter Zijlstra
On Thu, Dec 14, 2017 at 07:57:08PM +, Mathieu Desnoyers wrote: > - On Dec 14, 2017, at 2:48 PM, Peter Zijlstra pet...@infradead.org wrote: > > > On Thu, Dec 14, 2017 at 12:50:13PM -0600, Christopher Lameter wrote: > >> Ultimately I wish fast increments like done by this_cpu_inc() could be

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-14 Thread Mathieu Desnoyers
- On Dec 14, 2017, at 2:48 PM, Peter Zijlstra pet...@infradead.org wrote: > On Thu, Dec 14, 2017 at 12:50:13PM -0600, Christopher Lameter wrote: >> Ultimately I wish fast increments like done by this_cpu_inc() could be >> implemented in an efficient way on non x86 platforms that do not have

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-14 Thread Mathieu Desnoyers
- On Dec 14, 2017, at 2:48 PM, Peter Zijlstra pet...@infradead.org wrote: > On Thu, Dec 14, 2017 at 12:50:13PM -0600, Christopher Lameter wrote: >> Ultimately I wish fast increments like done by this_cpu_inc() could be >> implemented in an efficient way on non x86 platforms that do not have

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-14 Thread Peter Zijlstra
On Thu, Dec 14, 2017 at 12:50:13PM -0600, Christopher Lameter wrote: > Ultimately I wish fast increments like done by this_cpu_inc() could be > implemented in an efficient way on non x86 platforms that do not have > cheap instructions like that. So the problem isn't migration; for that we could

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-14 Thread Peter Zijlstra
On Thu, Dec 14, 2017 at 12:50:13PM -0600, Christopher Lameter wrote: > Ultimately I wish fast increments like done by this_cpu_inc() could be > implemented in an efficient way on non x86 platforms that do not have > cheap instructions like that. So the problem isn't migration; for that we could

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-14 Thread Mathieu Desnoyers
- On Dec 14, 2017, at 1:50 PM, Chris Lameter c...@linux.com wrote: > On Thu, 14 Dec 2017, Mathieu Desnoyers wrote: > >> > I think the proper way to think about gs and fs on x86 is as base >> > registers. They are essentially values in registers added to the address >> > generated in an

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-14 Thread Mathieu Desnoyers
- On Dec 14, 2017, at 1:50 PM, Chris Lameter c...@linux.com wrote: > On Thu, 14 Dec 2017, Mathieu Desnoyers wrote: > >> > I think the proper way to think about gs and fs on x86 is as base >> > registers. They are essentially values in registers added to the address >> > generated in an

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-14 Thread Christopher Lameter
On Thu, 14 Dec 2017, Mathieu Desnoyers wrote: > > I think the proper way to think about gs and fs on x86 is as base > > registers. They are essentially values in registers added to the address > > generated in an instruction. As such the approach is transferable to other > > processor

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-14 Thread Christopher Lameter
On Thu, 14 Dec 2017, Mathieu Desnoyers wrote: > > I think the proper way to think about gs and fs on x86 is as base > > registers. They are essentially values in registers added to the address > > generated in an instruction. As such the approach is transferable to other > > processor

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-14 Thread Mathieu Desnoyers
- On Dec 14, 2017, at 11:44 AM, Chris Lameter c...@linux.com wrote: > On Thu, 14 Dec 2017, Mathieu Desnoyers wrote: > >> On x86, yet another possible approach would be to use the gs segment >> selector to point to user-space per-cpu data. This approach performs >> similarly to the cpu id

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-14 Thread Mathieu Desnoyers
- On Dec 14, 2017, at 11:44 AM, Chris Lameter c...@linux.com wrote: > On Thu, 14 Dec 2017, Mathieu Desnoyers wrote: > >> On x86, yet another possible approach would be to use the gs segment >> selector to point to user-space per-cpu data. This approach performs >> similarly to the cpu id

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-14 Thread Christopher Lameter
On Thu, 14 Dec 2017, Mathieu Desnoyers wrote: > On x86, yet another possible approach would be to use the gs segment > selector to point to user-space per-cpu data. This approach performs > similarly to the cpu id cache, but it has two disadvantages: it is > not portable, and it is incompatible

Re: [RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-14 Thread Christopher Lameter
On Thu, 14 Dec 2017, Mathieu Desnoyers wrote: > On x86, yet another possible approach would be to use the gs segment > selector to point to user-space per-cpu data. This approach performs > similarly to the cpu id cache, but it has two disadvantages: it is > not portable, and it is incompatible

[RFC PATCH for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-14 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 for 4.16 02/21] rseq: Introduce restartable sequences system call (v12)

2017-12-14 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