Re: powerpc Linux scv support and scv system call ABI proposal

2020-02-19 Thread Nicholas Piggin
Tulio Magno Quites Machado Filho's on January 30, 2020 1:51 am: > Nicholas Piggin writes: > >> Adhemerval Zanella's on January 29, 2020 3:26 am: >>> >>> We already had to push a similar hack where glibc used to abort transactions >>> prior syscalls to avoid some side-effects on kernel (commit 56

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-31 Thread Segher Boessenkool
Hi! On Fri, Jan 31, 2020 at 08:30:45AM -0300, Adhemerval Zanella wrote: > On 30/01/2020 18:41, Segher Boessenkool wrote: > > On Thu, Jan 30, 2020 at 02:04:51PM -0300, Adhemerval Zanella wrote: > >> be value propagated over > >> functions calls and over different scopes, which I take from your > >

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-31 Thread Adhemerval Zanella
On 30/01/2020 18:41, Segher Boessenkool wrote: > Hi! > > On Thu, Jan 30, 2020 at 02:04:51PM -0300, Adhemerval Zanella wrote: >> On 30/01/2020 10:50, Segher Boessenkool wrote: >>> On Thu, Jan 30, 2020 at 01:03:53PM +0100, Florian Weimer wrote: > This is why that *is* the only supported use.

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-30 Thread Segher Boessenkool
Hi! On Thu, Jan 30, 2020 at 02:04:51PM -0300, Adhemerval Zanella wrote: > On 30/01/2020 10:50, Segher Boessenkool wrote: > > On Thu, Jan 30, 2020 at 01:03:53PM +0100, Florian Weimer wrote: > >>> This is why that *is* the only supported use. The documentation could > >>> use a touch-up, I think.

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-30 Thread Adhemerval Zanella
On 30/01/2020 10:50, Segher Boessenkool wrote: > Hi again, > > On Thu, Jan 30, 2020 at 01:03:53PM +0100, Florian Weimer wrote: >>> This is why that *is* the only supported use. The documentation could >>> use a touch-up, I think. Unless we still have problems here? >> >> I really don't know.

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-30 Thread Segher Boessenkool
Hi again, On Thu, Jan 30, 2020 at 01:03:53PM +0100, Florian Weimer wrote: > > This is why that *is* the only supported use. The documentation could > > use a touch-up, I think. Unless we still have problems here? > > I really don't know. GCC still has *some* support for the old behavior, > tho

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-30 Thread Florian Weimer
* Segher Boessenkool: >> I *assumed* that I would still get >> the value of r0 (the register) from the associated extended asm in this >> expression, even if it may now be a different register. Your comment >> made me think that this is undefined. > > Please show full(er) examples, I think we are

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-30 Thread Segher Boessenkool
On Thu, Jan 30, 2020 at 11:42:51AM +0100, Florian Weimer wrote: > * Segher Boessenkool: > > No, that *is* supported: as input to or output from an asm, a local > > register asm variable *is* guaranteed to live in the specified register. > > This is the *only* supported use. Other uses may sometime

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-30 Thread Florian Weimer
* Segher Boessenkool: > On Wed, Jan 29, 2020 at 06:02:34PM +0100, Florian Weimer wrote: >> * Segher Boessenkool: >> >> > On Wed, Jan 29, 2020 at 05:19:19PM +0100, Florian Weimer wrote: >> >> * Segher Boessenkool: >> >> >> But GCC doesn't expose them as integers to C code, so you can't do much >>

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-29 Thread Segher Boessenkool
On Wed, Jan 29, 2020 at 06:02:34PM +0100, Florian Weimer wrote: > * Segher Boessenkool: > > > On Wed, Jan 29, 2020 at 05:19:19PM +0100, Florian Weimer wrote: > >> * Segher Boessenkool: > >> >> But GCC doesn't expose them as integers to C code, so you can't do much > >> >> without them. > >> > > >>

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-29 Thread Florian Weimer
* Segher Boessenkool: > On Wed, Jan 29, 2020 at 05:19:19PM +0100, Florian Weimer wrote: >> * Segher Boessenkool: >> >> But GCC doesn't expose them as integers to C code, so you can't do much >> >> without them. >> > >> > Sure, it doesn't expose any other registers directly, either. >> >> I can us

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-29 Thread Segher Boessenkool
On Wed, Jan 29, 2020 at 05:19:19PM +0100, Florian Weimer wrote: > * Segher Boessenkool: > >> But GCC doesn't expose them as integers to C code, so you can't do much > >> without them. > > > > Sure, it doesn't expose any other registers directly, either. > > I can use r0 & 1 with a register variabl

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-29 Thread Florian Weimer
* Segher Boessenkool: > On Tue, Jan 28, 2020 at 05:04:49PM +0100, Florian Weimer wrote: >> * Segher Boessenkool: >> >> >> > I don't think we can save LR in a regular register around the system >> >> > call, explicitly in the inline asm statement, because we still have to >> >> > generate proper u

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-29 Thread Tulio Magno Quites Machado Filho
Nicholas Piggin writes: > Adhemerval Zanella's on January 29, 2020 3:26 am: >> >> We already had to push a similar hack where glibc used to abort transactions >> prior syscalls to avoid some side-effects on kernel (commit 56cf2763819d2f). >> It was eventually removed from syscall handling by f04

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-29 Thread Segher Boessenkool
On Wed, Jan 29, 2020 at 02:58:44PM +1000, Nicholas Piggin wrote: > Adhemerval Zanella's on January 29, 2020 3:26 am: > > __asm__ __volatile__\ > > ("sc\n\t" \ > >"bns+ 1f\n\t"

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-28 Thread Nicholas Piggin
Adhemerval Zanella's on January 29, 2020 3:26 am: > > > On 28/01/2020 11:05, Nicholas Piggin wrote: >> Florian Weimer's on January 28, 2020 11:09 pm: >>> * Nicholas Piggin: >>> * Proposal is for PPC_FEATURE2_SCV to indicate 'scv 0' support, all other vectors will return -ENOSYS, and t

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-28 Thread Nicholas Piggin
Florian Weimer's on January 29, 2020 1:58 am: > * Nicholas Piggin: > >> That gets the LR save/restore right when we're also using r0. > > Yes, I agree it looks good. Nice. > >>> But the kernel uses the -errno convention internally, so I think it >>> would make sense to pass this to userspace an

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-28 Thread Joseph Myers
On Tue, 28 Jan 2020, Florian Weimer wrote: > I don't think we can save LR in a regular register around the system > call, explicitly in the inline asm statement, because we still have to > generate proper unwinding information using CFI directives, something > that you cannot do from within the as

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-28 Thread Segher Boessenkool
On Tue, Jan 28, 2020 at 05:04:49PM +0100, Florian Weimer wrote: > * Segher Boessenkool: > > >> > I don't think we can save LR in a regular register around the system > >> > call, explicitly in the inline asm statement, because we still have to > >> > generate proper unwinding information using CFI

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-28 Thread Adhemerval Zanella
On 28/01/2020 11:05, Nicholas Piggin wrote: > Florian Weimer's on January 28, 2020 11:09 pm: >> * Nicholas Piggin: >> >>> * Proposal is for PPC_FEATURE2_SCV to indicate 'scv 0' support, all other >>> vectors will return -ENOSYS, and the decision for how to add support for >>> a new vector de

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-28 Thread Florian Weimer
* Segher Boessenkool: >> > I don't think we can save LR in a regular register around the system >> > call, explicitly in the inline asm statement, because we still have to >> > generate proper unwinding information using CFI directives, something >> > that you cannot do from within the asm stateme

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-28 Thread Florian Weimer
* Nicholas Piggin: > That gets the LR save/restore right when we're also using r0. Yes, I agree it looks good. Nice. >> But the kernel uses the -errno convention internally, so I think it >> would make sense to pass this to userspace and not convert back and >> forth. This would align with wha

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-28 Thread Segher Boessenkool
On Wed, Jan 29, 2020 at 12:05:40AM +1000, Nicholas Piggin wrote: > Florian Weimer's on January 28, 2020 11:09 pm: > > But I don't think we are so lucky for the inline system calls. GCC > > recognizes an "lr" clobber with inline asm (even though it is not > > documented), but it generates rather st

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-28 Thread Nicholas Piggin
Florian Weimer's on January 28, 2020 11:09 pm: > * Nicholas Piggin: > >> * Proposal is for PPC_FEATURE2_SCV to indicate 'scv 0' support, all other >> vectors will return -ENOSYS, and the decision for how to add support for >> a new vector deferred until we see the next user. > > Seems reasona

Re: powerpc Linux scv support and scv system call ABI proposal

2020-01-28 Thread Florian Weimer
* Nicholas Piggin: > * Proposal is for PPC_FEATURE2_SCV to indicate 'scv 0' support, all other > vectors will return -ENOSYS, and the decision for how to add support for > a new vector deferred until we see the next user. Seems reasonable. We don't have to decide this today. > * Proposal is

powerpc Linux scv support and scv system call ABI proposal

2020-01-28 Thread Nicholas Piggin
I would like to enable support for the scv instruction to provide the Linux system calls. This requires two things to be defined, firstly how to advertise support for scv and how to allocate and advertise support for individual scv vectors. Secondly, how to define a Linux system call ABI with this