unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Vineet Gupta <vineet.gupta1@synopsys.com>,
	Joseph Myers <joseph@codesourcery.com>
Cc: libc-alpha@sourceware.org, linux-snps-arc@lists.infradead.org
Subject: Re: ARC vs. generic sigaction (was Re: [PATCH 08/21] ARC: Linux Syscall Interface)
Date: Thu, 20 Dec 2018 09:19:03 -0200	[thread overview]
Message-ID: <4c3af320-cf35-f914-8bc3-a4c290b8e12b@linaro.org> (raw)
In-Reply-To: <906931a6-a281-8994-718f-da203890e7e9@synopsys.com>



On 19/12/2018 20:23, Vineet Gupta wrote:
> On 12/19/18 2:00 PM, Adhemerval Zanella wrote:
>>
>>
>> One possibility is to define an arch-specific __sigset_t.h with a custom 
>> _SIGSET_NWORDS value and add an optimization on Linux sigaction.c to check
>> if both kernel_sigaction and glibc sigaction share same size and internal
>> layout to use the struct as-is for syscall instead of copy to a temporary
>> value (similar to what we used to have on getdents).  ARC would still have
>> arch-specific code and would be the only ABI to have a different sigset_t
>> though.
> 
> I don't like ARC to single out either. But as Joseph suggests could this be
> starting point for arches of future. Assuming it does, would rather see this or
> the approach Joseph alluded to earlier [1]
> 
> [1] http://lists.infradead.org/pipermail/linux-snps-arc/2018-December/005122.html
> 
>>
>> However I *hardly* think sigaction is a hotspot in real world cases, usually
>> the signal action is defined once or in a very limited number of times.  I am
>> not considering synthetic benchmarks, specially lmbench which in most cases
>> does not measure any useful metric. 
> 
> I tend to disagree. Coming from embedded linux background, I've found it immensely
> useful to compare 2 minimal systems: especially when distos, out-of-box packages,
> fancy benchmarks don't even exist.
> 
> At any rate, my disagreement with status quo is not so much of optimize for ARC,
> but rather pointless spending of electrons. When we know that there are 64 signals
> at max, which need 64-bits, why bother shuffling around 1k bits, specially when
> one is starting afresh and there's no legacy crap getting in the way.
> 
> The case of adding more signals in future is indeed theoretically possible but
> that will be an ABI change anyways.

The only advantage of using a larger sigset_t from glibc standpoint is if
kernel ever change it maximum number of supported signals it would not be
a ABI change (it would be if glibc provided sigset_t need to be extended).

My point was that this change would hardly help in performance or memory 
utilization due the signal set common utilization in exported and internal
API.  But at the same time the signal set hasn't been changed for a *long* time 
and I don't see indication that it will any time soon. So a new architecture 
might indeed assume it won't change and set its default to follow Linux user 
ABI.

> 
>> Even for other sigset_t usage case I still
>> think an arch-specific definition should not make much difference:
>>
>>   1. setcontext: it would incur just in larger ucontext_t (kernel get/set
>>      mask is done using kernel expected size).  Also, taking in consideration
>>      these interfaces were removed from POSIX.1-2008, the inherent performance
>>      issues (signal set/restore will most likely dominate the overhead), and
>>      some implementation issues (BZ#18135 for instance), I would say to not
>>      bother to optimize it.
>>
>>   2. pselect, ppoll, epoll_pwait, posix_spawn (posix_spawnattr_t), sig*: 
>>      for functions that accept sigset as an argument it would incur in just
>>      larger memory utilization without much performance overhead. Again,
>>      runtime for these calls would be mostly dominate by syscall overhead
>>      or kernel wait-time for events.
>>
>>   3. raise, etc: for function that might allocate a sigset_t internally it
>>      will similar to 2.
> 
> I agree that that in libc, pretty much anything will be dominated by syscall
> overhead, but still...
> 
> 
>> Now, if ARC intention is just to follow generic glibc linux ABI definitions,
>> it could just define its sigaction as (not tested):
> 
> Indeed the ABI is etched in stone and I have a very similar code now, with slight
> difference.
> 
>> * sysdeps/unix/sysv/linux/arc/sigaction.c
>>
>> ---
>> #define SA_RESTORER 0x04000000
>> #include <kernel_sigaction.h>
>>
>> extern void restore_rt (void) asm ("__restore_rt") attribute_hidden;
>>
>> #define SET_SA_RESTORER(kact, act)                      \
>>   (kact)->sa_flags = (act)->sa_flags | SA_RESTORER;     \
>>   (kact)->sa_restorer = &__default_rt_sa_restorer
> 
> +#define SET_SA_RESTORER(kact, act)				\
> + ({								\
> +   if (!((kact)->sa_flags & SA_RESTORER))			\
> +     {								\
> +       (kact)->sa_restorer = __default_rt_sa_restorer;		\
> +       (kact)->sa_flags |= SA_RESTORER;			\
> +     }								\
> +   else							\
> +     (kact)->sa_restorer = (act)->sa_restorer;			\
> + })

What is so special about ARC sa_restorer that an application should provide
an specialized one? Can't it follow other abi where they issue __NR_sigreturn
for !SA_SIGINFO or __NR_rt_sigreturn otherwise?

As for other architecture I do think we should hide the sa_restorer usage
from application.

> 
>>
>> #define RESET_SA_RESTORER(act, kact)                    \
>>   (act)->sa_restorer = (kact)->sa_restorer
>>
>> static void __default_rt_sa_restorer(void)
>> {
>>   INTERNAL_SYSCALL_DECL (err);
>>   INTERNAL_SYSCALL_CALL (__NR_rt_sigreturn, err);
>> }
>>
>> #include <sysdeps/unix/sysv/linux/sigaction.c>
> 
> 

  reply	other threads:[~2018-12-20 11:19 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-18 21:04 [PATCH 00/21] glibc port to ARC processors Vineet Gupta
2018-12-18 21:04 ` [PATCH 01/21] longlong.h: sync from gcc to fix ARC inline asm constraints Vineet Gupta
2018-12-18 22:56   ` Joseph Myers
2018-12-18 23:11     ` Vineet Gupta
2018-12-21 18:46   ` Joseph Myers
2018-12-21 19:07     ` Vineet Gupta
2018-12-18 21:04 ` [PATCH 02/21] ARC: add definitions to elf/elf.h Vineet Gupta
2018-12-18 21:04 ` [PATCH 03/21] ARC: ABI Implementation Vineet Gupta
2018-12-18 23:09   ` Joseph Myers
2018-12-19  2:00     ` Vineet Gupta
2018-12-19 17:40       ` Joseph Myers
2018-12-19 20:20         ` Vineet Gupta
2018-12-19 20:37           ` Joseph Myers
2019-01-28 23:03     ` ARC binutils init/fini (was Re: [PATCH 03/21] ARC: ABI Implementation) Vineet Gupta
2019-01-28 23:13       ` Joseph Myers
2019-01-28 23:42         ` Vineet Gupta
2018-12-18 21:04 ` [PATCH 04/21] ARC: startup and dynamic linking code Vineet Gupta
2018-12-18 23:24   ` Joseph Myers
2018-12-19  0:52     ` Vineet Gupta
2018-12-18 21:04 ` [PATCH 05/21] ARC: Thread Local Storage support Vineet Gupta
2018-12-18 21:04 ` [PATCH 06/21] ARC: Atomics and Locking primitives Vineet Gupta
2018-12-18 23:15   ` Joseph Myers
2019-01-15  0:40     ` Vineet Gupta
2018-12-18 21:04 ` [PATCH 07/21] ARC: math soft float support Vineet Gupta
2018-12-18 23:23   ` Joseph Myers
2018-12-19  0:01     ` Joseph Myers
2018-12-20 21:35       ` Vineet Gupta
2018-12-21  1:08     ` Vineet Gupta
2018-12-21  1:19       ` Joseph Myers
2018-12-18 21:04 ` [PATCH 08/21] ARC: Linux Syscall Interface Vineet Gupta
2018-12-18 23:30   ` Joseph Myers
2018-12-19  2:39     ` Vineet Gupta
2018-12-19 17:58       ` ARC vs. generic sigaction (was Re: [PATCH 08/21] ARC: Linux Syscall Interface) Vineet Gupta
2018-12-19 18:07         ` Joseph Myers
2018-12-19 22:00         ` Adhemerval Zanella
2018-12-19 22:23           ` Vineet Gupta
2018-12-20 11:19             ` Adhemerval Zanella [this message]
2018-12-20 12:06               ` Arnd Bergmann
2018-12-20 19:25                 ` Vineet Gupta
2018-12-20 12:40               ` Florian Weimer
2018-12-20 18:48                 ` Vineet Gupta
2019-01-03 13:10                   ` Florian Weimer
2018-12-20 19:23               ` Vineet Gupta
2018-12-20 20:06                 ` Adhemerval Zanella
2018-12-20 20:46                   ` Vineet Gupta
2018-12-21 12:05                     ` Adhemerval Zanella
2019-01-09 21:49                       ` Vineet Gupta
2018-12-18 21:04 ` [PATCH 09/21] ARC: Linux ABI Vineet Gupta
2018-12-18 23:38   ` Joseph Myers
2018-12-19 19:57     ` Vineet Gupta
2018-12-19 20:36       ` Joseph Myers
2018-12-21 23:06         ` Vineet Gupta
2018-12-18 21:04 ` [PATCH 10/21] ARC: Linux Startup and Dynamic Loading Vineet Gupta
2018-12-18 23:49   ` Joseph Myers
2018-12-19 20:26     ` Vineet Gupta
2018-12-18 21:04 ` [PATCH 11/21] ARC: ABI lists Vineet Gupta
2018-12-18 22:31   ` Andreas Schwab
2018-12-18 22:32     ` Vineet Gupta
2018-12-18 21:04 ` [PATCH 12/21] ARC: Update syscall-names.list for ARC specific syscalls Vineet Gupta
2018-12-18 21:26   ` Florian Weimer
2018-12-18 21:29     ` Vineet Gupta
2018-12-19  8:16       ` Florian Weimer
2018-12-18 21:04 ` [PATCH 13/21] ARC: Build Infrastructure Vineet Gupta
2018-12-18 23:44   ` Joseph Myers
2018-12-19 21:58     ` Vineet Gupta
2018-12-19 22:17       ` Joseph Myers
2018-12-20 23:21         ` Vineet Gupta
2018-12-20 23:24           ` Joseph Myers
2019-01-29 23:36             ` Vineet Gupta
2018-12-18 21:04 ` [PATCH 14/21] ARC: Enable __start as entry point vs. canonical _start Vineet Gupta
2018-12-18 21:28   ` Florian Weimer
2018-12-18 21:31     ` Vineet Gupta
2018-12-18 22:59       ` Joseph Myers
2018-12-18 23:08         ` Vineet Gupta
2018-12-19 20:36     ` Vineet Gupta
2018-12-18 21:04 ` [PATCH 15/21] ARC: testsuite fix: elf/check-initfini Vineet Gupta
2018-12-18 21:04 ` [PATCH 16/21] ARC: testsuite fix: sysvipc/* Vineet Gupta
2018-12-19 22:10   ` Adhemerval Zanella
2018-12-18 21:04 ` [PATCH 17/21] ARC: testsuite fix: stdlib/tst-makecontext Vineet Gupta
2018-12-18 22:36   ` Andreas Schwab
2019-01-21 22:32     ` Vineet Gupta
2018-12-18 21:04 ` [PATCH 18/21] ARC: testsuite fix: GD TLS issue Vineet Gupta
2018-12-18 21:04 ` [PATCH 19/21] ARC: fix several unwining and cancelation tests Vineet Gupta
2018-12-18 21:04 ` [PATCH 20/21] build-many-glibcs.py: Enable ARC builds Vineet Gupta
2018-12-18 21:04 ` [PATCH 21/21] NEWS: mention ARC port Vineet Gupta
2018-12-18 23:45   ` Joseph Myers
2018-12-19 18:30     ` Vineet Gupta
2018-12-18 22:52 ` [PATCH 00/21] glibc port to ARC processors Joseph Myers
2018-12-18 23:07   ` Vineet Gupta
2018-12-18 23:52     ` Joseph Myers
2018-12-21  1:55       ` Vineet Gupta
2018-12-21 14:32         ` Joseph Myers
2018-12-21 17:36           ` Vineet Gupta
2018-12-18 23:11 ` Joseph Myers
2018-12-19 23:45   ` Vineet Gupta
2018-12-20  0:14     ` Joseph Myers
2018-12-20  0:51       ` Vineet Gupta
2018-12-20 21:22 ` test related questions (was Re: [PATCH 00/21] glibc port to ARC processors) Vineet Gupta
2018-12-20 21:59   ` Joseph Myers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4c3af320-cf35-f914-8bc3-a4c290b8e12b@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=vineet.gupta1@synopsys.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).