Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-11 Thread Palmer Dabbelt
On Tue, 11 Jul 2017 06:55:28 PDT (-0700), h...@infradead.org wrote: > On Tue, Jul 11, 2017 at 02:22:15PM +0100, Will Deacon wrote: >> The problem is that by supporting these hypothetical designs that can't do >> atomics, you hurt sensible designs that *can* do the atomics because you >> force them

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-11 Thread Palmer Dabbelt
On Tue, 11 Jul 2017 06:55:28 PDT (-0700), h...@infradead.org wrote: > On Tue, Jul 11, 2017 at 02:22:15PM +0100, Will Deacon wrote: >> The problem is that by supporting these hypothetical designs that can't do >> atomics, you hurt sensible designs that *can* do the atomics because you >> force them

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-11 Thread Palmer Dabbelt
On Tue, 11 Jul 2017 06:22:15 PDT (-0700), will.dea...@arm.com wrote: > On Mon, Jul 10, 2017 at 01:00:29PM -0700, Palmer Dabbelt wrote: >> On Thu, 06 Jul 2017 08:45:13 PDT (-0700), will.dea...@arm.com wrote: >> > On Thu, Jul 06, 2017 at 08:34:27AM -0700, Christoph Hellwig wrote: >> >> On Thu, Jul

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-11 Thread Palmer Dabbelt
On Tue, 11 Jul 2017 06:22:15 PDT (-0700), will.dea...@arm.com wrote: > On Mon, Jul 10, 2017 at 01:00:29PM -0700, Palmer Dabbelt wrote: >> On Thu, 06 Jul 2017 08:45:13 PDT (-0700), will.dea...@arm.com wrote: >> > On Thu, Jul 06, 2017 at 08:34:27AM -0700, Christoph Hellwig wrote: >> >> On Thu, Jul

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-11 Thread Christoph Hellwig
On Tue, Jul 11, 2017 at 02:22:15PM +0100, Will Deacon wrote: > The problem is that by supporting these hypothetical designs that can't do > atomics, you hurt sensible designs that *can* do the atomics because you > force them to take an additional indirection that could otherwise be > avoided.

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-11 Thread Christoph Hellwig
On Tue, Jul 11, 2017 at 02:22:15PM +0100, Will Deacon wrote: > The problem is that by supporting these hypothetical designs that can't do > atomics, you hurt sensible designs that *can* do the atomics because you > force them to take an additional indirection that could otherwise be > avoided.

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-11 Thread Will Deacon
On Mon, Jul 10, 2017 at 01:00:29PM -0700, Palmer Dabbelt wrote: > On Thu, 06 Jul 2017 08:45:13 PDT (-0700), will.dea...@arm.com wrote: > > On Thu, Jul 06, 2017 at 08:34:27AM -0700, Christoph Hellwig wrote: > >> On Thu, Jul 06, 2017 at 09:55:03AM +0100, Will Deacon wrote: > >> > Agreed on the

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-11 Thread Will Deacon
On Mon, Jul 10, 2017 at 01:00:29PM -0700, Palmer Dabbelt wrote: > On Thu, 06 Jul 2017 08:45:13 PDT (-0700), will.dea...@arm.com wrote: > > On Thu, Jul 06, 2017 at 08:34:27AM -0700, Christoph Hellwig wrote: > >> On Thu, Jul 06, 2017 at 09:55:03AM +0100, Will Deacon wrote: > >> > Agreed on the

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-10 Thread Palmer Dabbelt
On Mon, 10 Jul 2017 13:00:29 PDT (-0700), Palmer Dabbelt wrote: > On Thu, 06 Jul 2017 08:45:13 PDT (-0700), will.dea...@arm.com wrote: >> On Thu, Jul 06, 2017 at 08:34:27AM -0700, Christoph Hellwig wrote: >>> On Thu, Jul 06, 2017 at 09:55:03AM +0100, Will Deacon wrote: >>> > Agreed on the

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-10 Thread Palmer Dabbelt
On Mon, 10 Jul 2017 13:00:29 PDT (-0700), Palmer Dabbelt wrote: > On Thu, 06 Jul 2017 08:45:13 PDT (-0700), will.dea...@arm.com wrote: >> On Thu, Jul 06, 2017 at 08:34:27AM -0700, Christoph Hellwig wrote: >>> On Thu, Jul 06, 2017 at 09:55:03AM +0100, Will Deacon wrote: >>> > Agreed on the

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-06 Thread Will Deacon
On Thu, Jul 06, 2017 at 08:34:27AM -0700, Christoph Hellwig wrote: > On Thu, Jul 06, 2017 at 09:55:03AM +0100, Will Deacon wrote: > > Agreed on the indirection; it feels like this is something that should be in > > the vDSO, which could use the cmpxchg instruction if it's available, or > >

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-06 Thread Will Deacon
On Thu, Jul 06, 2017 at 08:34:27AM -0700, Christoph Hellwig wrote: > On Thu, Jul 06, 2017 at 09:55:03AM +0100, Will Deacon wrote: > > Agreed on the indirection; it feels like this is something that should be in > > the vDSO, which could use the cmpxchg instruction if it's available, or > >

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-06 Thread Christoph Hellwig
On Thu, Jul 06, 2017 at 09:55:03AM +0100, Will Deacon wrote: > Agreed on the indirection; it feels like this is something that should be in > the vDSO, which could use the cmpxchg instruction if it's available, or > otherwise just uses plain loads and stores. Even that seems like a lot of

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-06 Thread Christoph Hellwig
On Thu, Jul 06, 2017 at 09:55:03AM +0100, Will Deacon wrote: > Agreed on the indirection; it feels like this is something that should be in > the vDSO, which could use the cmpxchg instruction if it's available, or > otherwise just uses plain loads and stores. Even that seems like a lot of

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-06 Thread Dave P Martin
On Wed, Jul 05, 2017 at 09:49:36AM -0700, Palmer Dabbelt wrote: > On Mon, 03 Jul 2017 16:06:39 PDT (-0700), james.ho...@imgtec.com wrote: > > On Thu, Jun 29, 2017 at 02:42:38PM -0700, Palmer Dabbelt wrote: > >> On Wed, 28 Jun 2017 15:42:37 PDT (-0700), james.ho...@imgtec.com wrote: > >> > On Wed,

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-06 Thread Dave P Martin
On Wed, Jul 05, 2017 at 09:49:36AM -0700, Palmer Dabbelt wrote: > On Mon, 03 Jul 2017 16:06:39 PDT (-0700), james.ho...@imgtec.com wrote: > > On Thu, Jun 29, 2017 at 02:42:38PM -0700, Palmer Dabbelt wrote: > >> On Wed, 28 Jun 2017 15:42:37 PDT (-0700), james.ho...@imgtec.com wrote: > >> > On Wed,

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-06 Thread Will Deacon
On Wed, Jul 05, 2017 at 07:01:41PM -0700, Christoph Hellwig wrote: > I'm a bit concerned about these cmpxchg syscalls, and I'd like to > understand if my concerns are justified. > > For a new instruction set that starts out in the 201x years we really > should have cmpxchg as a mandatory

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-06 Thread Will Deacon
On Wed, Jul 05, 2017 at 07:01:41PM -0700, Christoph Hellwig wrote: > I'm a bit concerned about these cmpxchg syscalls, and I'd like to > understand if my concerns are justified. > > For a new instruction set that starts out in the 201x years we really > should have cmpxchg as a mandatory

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-05 Thread Christoph Hellwig
I'm a bit concerned about these cmpxchg syscalls, and I'd like to understand if my concerns are justified. For a new instruction set that starts out in the 201x years we really should have cmpxchg as a mandatory instruction - if not in the CPU it should be in the Linux ABI so that we don't have

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-05 Thread Christoph Hellwig
I'm a bit concerned about these cmpxchg syscalls, and I'd like to understand if my concerns are justified. For a new instruction set that starts out in the 201x years we really should have cmpxchg as a mandatory instruction - if not in the CPU it should be in the Linux ABI so that we don't have

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-05 Thread Palmer Dabbelt
On Mon, 03 Jul 2017 16:06:39 PDT (-0700), james.ho...@imgtec.com wrote: > On Thu, Jun 29, 2017 at 02:42:38PM -0700, Palmer Dabbelt wrote: >> On Wed, 28 Jun 2017 15:42:37 PDT (-0700), james.ho...@imgtec.com wrote: >> > On Wed, Jun 28, 2017 at 11:55:37AM -0700, Palmer Dabbelt wrote: >> >> diff --git

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-05 Thread Palmer Dabbelt
On Mon, 03 Jul 2017 16:06:39 PDT (-0700), james.ho...@imgtec.com wrote: > On Thu, Jun 29, 2017 at 02:42:38PM -0700, Palmer Dabbelt wrote: >> On Wed, 28 Jun 2017 15:42:37 PDT (-0700), james.ho...@imgtec.com wrote: >> > On Wed, Jun 28, 2017 at 11:55:37AM -0700, Palmer Dabbelt wrote: >> >> diff --git

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-05 Thread James Hogan
On Tue, Jul 04, 2017 at 12:51:01PM -0700, Palmer Dabbelt wrote: > diff --git a/arch/riscv/kernel/ptrace.c b/arch/riscv/kernel/ptrace.c > new file mode 100644 > index ..2720d5e97354 > --- /dev/null > +++ b/arch/riscv/kernel/ptrace.c > @@ -0,0 +1,138 @@ > +/* Put registers back to task.

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-05 Thread James Hogan
On Tue, Jul 04, 2017 at 12:51:01PM -0700, Palmer Dabbelt wrote: > diff --git a/arch/riscv/kernel/ptrace.c b/arch/riscv/kernel/ptrace.c > new file mode 100644 > index ..2720d5e97354 > --- /dev/null > +++ b/arch/riscv/kernel/ptrace.c > @@ -0,0 +1,138 @@ > +/* Put registers back to task.

[PATCH 8/9] RISC-V: User-facing API

2017-07-04 Thread Palmer Dabbelt
This patch contains code that is in some way visible to the user: including via system calls, the VDSO, module loading and signal handling. It also contains some generic code that is ABI visible. Signed-off-by: Palmer Dabbelt --- arch/riscv/include/asm/elf.h |

[PATCH 8/9] RISC-V: User-facing API

2017-07-04 Thread Palmer Dabbelt
This patch contains code that is in some way visible to the user: including via system calls, the VDSO, module loading and signal handling. It also contains some generic code that is ABI visible. Signed-off-by: Palmer Dabbelt --- arch/riscv/include/asm/elf.h | 3 +-

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-03 Thread James Hogan
On Thu, Jun 29, 2017 at 02:42:38PM -0700, Palmer Dabbelt wrote: > On Wed, 28 Jun 2017 15:42:37 PDT (-0700), james.ho...@imgtec.com wrote: > > On Wed, Jun 28, 2017 at 11:55:37AM -0700, Palmer Dabbelt wrote: > >> diff --git a/arch/riscv/include/uapi/asm/ucontext.h > >>

Re: [PATCH 8/9] RISC-V: User-facing API

2017-07-03 Thread James Hogan
On Thu, Jun 29, 2017 at 02:42:38PM -0700, Palmer Dabbelt wrote: > On Wed, 28 Jun 2017 15:42:37 PDT (-0700), james.ho...@imgtec.com wrote: > > On Wed, Jun 28, 2017 at 11:55:37AM -0700, Palmer Dabbelt wrote: > >> diff --git a/arch/riscv/include/uapi/asm/ucontext.h > >>

Re: [PATCH 8/9] RISC-V: User-facing API

2017-06-29 Thread Palmer Dabbelt
On Wed, 28 Jun 2017 15:42:37 PDT (-0700), james.ho...@imgtec.com wrote: > Hi Palmer, > > On Wed, Jun 28, 2017 at 11:55:37AM -0700, Palmer Dabbelt wrote: >> diff --git a/arch/riscv/include/asm/syscalls.h >> b/arch/riscv/include/asm/syscalls.h >> new file mode 100644 >> index

Re: [PATCH 8/9] RISC-V: User-facing API

2017-06-29 Thread Palmer Dabbelt
On Wed, 28 Jun 2017 15:42:37 PDT (-0700), james.ho...@imgtec.com wrote: > Hi Palmer, > > On Wed, Jun 28, 2017 at 11:55:37AM -0700, Palmer Dabbelt wrote: >> diff --git a/arch/riscv/include/asm/syscalls.h >> b/arch/riscv/include/asm/syscalls.h >> new file mode 100644 >> index

Re: [PATCH 8/9] RISC-V: User-facing API

2017-06-29 Thread Palmer Dabbelt
On Wed, 28 Jun 2017 14:49:44 PDT (-0700), t...@linutronix.de wrote: > On Wed, 28 Jun 2017, Palmer Dabbelt wrote: >> + >> +SYSCALL_DEFINE3(sysriscv_cmpxchg32, unsigned long, arg1, unsigned long, >> arg2, >> +unsigned long, arg3) >> +{ >> +unsigned long flags; >> +unsigned long

Re: [PATCH 8/9] RISC-V: User-facing API

2017-06-29 Thread Palmer Dabbelt
On Wed, 28 Jun 2017 14:49:44 PDT (-0700), t...@linutronix.de wrote: > On Wed, 28 Jun 2017, Palmer Dabbelt wrote: >> + >> +SYSCALL_DEFINE3(sysriscv_cmpxchg32, unsigned long, arg1, unsigned long, >> arg2, >> +unsigned long, arg3) >> +{ >> +unsigned long flags; >> +unsigned long

Re: [PATCH 8/9] RISC-V: User-facing API

2017-06-28 Thread James Hogan
Hi Palmer, On Wed, Jun 28, 2017 at 11:55:37AM -0700, Palmer Dabbelt wrote: > diff --git a/arch/riscv/include/asm/syscalls.h > b/arch/riscv/include/asm/syscalls.h > new file mode 100644 > index ..d85267c4f7ea > --- /dev/null > +++ b/arch/riscv/include/asm/syscalls.h > @@ -0,0 +1,25 @@

Re: [PATCH 8/9] RISC-V: User-facing API

2017-06-28 Thread James Hogan
Hi Palmer, On Wed, Jun 28, 2017 at 11:55:37AM -0700, Palmer Dabbelt wrote: > diff --git a/arch/riscv/include/asm/syscalls.h > b/arch/riscv/include/asm/syscalls.h > new file mode 100644 > index ..d85267c4f7ea > --- /dev/null > +++ b/arch/riscv/include/asm/syscalls.h > @@ -0,0 +1,25 @@

Re: [PATCH 8/9] RISC-V: User-facing API

2017-06-28 Thread Thomas Gleixner
On Wed, 28 Jun 2017, Thomas Gleixner wrote: > On Wed, 28 Jun 2017, Palmer Dabbelt wrote: > > + err = __get_user(prev, ptr); > > Sigh. Type safety is overrated, right? But the comment above your __get_user() implementation says: + * @ptr must have pointer-to-simple-variable type, and the

Re: [PATCH 8/9] RISC-V: User-facing API

2017-06-28 Thread Thomas Gleixner
On Wed, 28 Jun 2017, Thomas Gleixner wrote: > On Wed, 28 Jun 2017, Palmer Dabbelt wrote: > > + err = __get_user(prev, ptr); > > Sigh. Type safety is overrated, right? But the comment above your __get_user() implementation says: + * @ptr must have pointer-to-simple-variable type, and the

Re: [PATCH 8/9] RISC-V: User-facing API

2017-06-28 Thread Thomas Gleixner
On Wed, 28 Jun 2017, Palmer Dabbelt wrote: > + > +SYSCALL_DEFINE3(sysriscv_cmpxchg32, unsigned long, arg1, unsigned long, arg2, > + unsigned long, arg3) > +{ > + unsigned long flags; > + unsigned long prev; > + unsigned int *ptr; > + unsigned int err; > + > + ptr =

Re: [PATCH 8/9] RISC-V: User-facing API

2017-06-28 Thread Thomas Gleixner
On Wed, 28 Jun 2017, Palmer Dabbelt wrote: > + > +SYSCALL_DEFINE3(sysriscv_cmpxchg32, unsigned long, arg1, unsigned long, arg2, > + unsigned long, arg3) > +{ > + unsigned long flags; > + unsigned long prev; > + unsigned int *ptr; > + unsigned int err; > + > + ptr =

[PATCH 8/9] RISC-V: User-facing API

2017-06-28 Thread Palmer Dabbelt
This patch contains code that is in some way visible to the user: including via system calls, the VDSO, module loading and signal handling. It also contains some generic code that is ABI visible. Signed-off-by: Palmer Dabbelt --- arch/riscv/include/asm/mmu.h |

[PATCH 8/9] RISC-V: User-facing API

2017-06-28 Thread Palmer Dabbelt
This patch contains code that is in some way visible to the user: including via system calls, the VDSO, module loading and signal handling. It also contains some generic code that is ABI visible. Signed-off-by: Palmer Dabbelt --- arch/riscv/include/asm/mmu.h | 26 +++