This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] s390: optimize syscall function



On 12/06/2017 10:55, Martin Schwidefsky wrote:
> On Mon, 12 Jun 2017 09:04:36 -0300
> Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
> 
>> On 12/06/2017 02:49, Martin Schwidefsky wrote:
>>> On Fri,  9 Jun 2017 13:29:07 +0200
>>> Christian Borntraeger <borntraeger@de.ibm.com> wrote:
>>>   
>>>> Since kernel 2.6.0 all Linux version accept the system call number
>>>> in register 1 for svc 0. There is no need to have special handling
>>>> that uses EX for system calls < 256. This will simplify and speed
>>>> up that code.
>>>>
>>>> A microbenchmark doing "syscall(__NR_getpid);" in a loops gets faster
>>>> by ~12%.
>>>>
>>>>         * sysdeps/unix/sysv/linux/s390/s390-64/syscall.S: Simplify
>>>>         code by always using SVC 0 instead of EX.
>>>>         * sysdeps/unix/sysv/linux/s390/s390-64/syscall.S: Likewise.
>>>>
>>>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>>>> ---
>>>>  sysdeps/unix/sysv/linux/s390/s390-32/syscall.S |   12 +++---------
>>>>  sysdeps/unix/sysv/linux/s390/s390-64/syscall.S |   12 +++---------
>>>>  2 files changed, 6 insertions(+), 18 deletions(-)  
>>>
>>> NAK. E.g. this from glibc:
>>>
>>> sysdeps/unix/sysv/linux/s390/s390-64:
>>>
>>> ENTRY (syscall)
>>> 	...
>>>         basr   %r8,0
>>> 0:      clg    %r1,4f-0b(%r8)      /* svc number < 256? */
>>>         jl     2f
>>> 1:      svc    0
>>>         j      3f
>>> 2:      ex     %r1,1b-0b(%r8)      /* lsb of R1 is subsituted as SVC number */
>>> 3:      lg     %r15,0(%r15)        /* load back chain */
>>>         cfi_adjust_cfa_offset (-160)
>>>         lmg     %r6,15,48(%r15)    /* Load registers.  */
>>> 	...
>>>
>>> And there are old version of glibc where NR_syscalls was < 256 that
>>> exclusively used the SVC instruction with the system call number
>>> encoded in the instruction itself.
>>>   
>>
>> I am not following the NAK, is the 'svc' way not really allowed for current
>> minimum kernel supported for s390 (3.2) or is the 'svc' method not really the 
>> fastest one for such syscalls?
> 
> I claim lack of coffee after the long weekend ..
> 
> Yes, with version 3.2 as the minimum kernel level for using a glibc with
> the prosed patch everything should be fine. The support for system calls
> larger than 256 has been added with 2.5.68.

Thanks, since it should be ok we can also cleanup the {INLINE,INTERNAL}_SYSCALL
macros in s390x sysdep.h as well.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]