1. 10 6月, 2017 1 次提交
  2. 18 4月, 2017 1 次提交
  3. 03 3月, 2017 1 次提交
  4. 02 3月, 2017 1 次提交
  5. 15 12月, 2016 1 次提交
    • W
      signals: avoid unnecessary taking of sighand->siglock · c7be96af
      Waiman Long 提交于
      When running certain database workload on a high-end system with many
      CPUs, it was found that spinlock contention in the sigprocmask syscalls
      became a significant portion of the overall CPU cycles as shown below.
      
        9.30%  9.30%  905387  dataserver  /proc/kcore 0x7fff8163f4d2
        [k] _raw_spin_lock_irq
                  |
                  ---_raw_spin_lock_irq
                     |
                     |--99.34%-- __set_current_blocked
                     |          sigprocmask
                     |          sys_rt_sigprocmask
                     |          system_call_fastpath
                     |          |
                     |          |--50.63%-- __swapcontext
                     |          |          |
                     |          |          |--99.91%-- upsleepgeneric
                     |          |
                     |          |--49.36%-- __setcontext
                     |          |          ktskRun
      
      Looking further into the swapcontext function in glibc, it was found that
      the function always call sigprocmask() without checking if there are
      changes in the signal mask.
      
      A check was added to the __set_current_blocked() function to avoid taking
      the sighand->siglock spinlock if there is no change in the signal mask.
      This will prevent unneeded spinlock contention when many threads are
      trying to call sigprocmask().
      
      With this patch applied, the spinlock contention in sigprocmask() was
      gone.
      
      Link: http://lkml.kernel.org/r/1474979209-11867-1-git-send-email-Waiman.Long@hpe.comSigned-off-by: NWaiman Long <Waiman.Long@hpe.com>
      Acked-by: NOleg Nesterov <oleg@redhat.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Stas Sergeev <stsp@list.ru>
      Cc: Scott J Norton <scott.norton@hpe.com>
      Cc: Douglas Hatch <doug.hatch@hpe.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c7be96af
  6. 24 5月, 2016 1 次提交
  7. 13 5月, 2016 1 次提交
    • J
      SIGNAL: Move generic copy_siginfo() to signal.h · ca9eb49a
      James Hogan 提交于
      The generic copy_siginfo() is currently defined in
      asm-generic/siginfo.h, after including uapi/asm-generic/siginfo.h which
      defines the generic struct siginfo. However this makes it awkward for an
      architecture to use it if it has to define its own struct siginfo (e.g.
      MIPS and potentially IA64), since it means that asm-generic/siginfo.h
      can only be included after defining the arch-specific siginfo, which may
      be problematic if the arch-specific definition needs definitions from
      uapi/asm-generic/siginfo.h.
      
      It is possible to work around this by first including
      uapi/asm-generic/siginfo.h to get the constants before defining the
      arch-specific siginfo, and include asm-generic/siginfo.h after. However
      uapi headers can't be included by other uapi headers, so that first
      include has to be in an ifdef __kernel__, with the non __kernel__ case
      including the non-UAPI header instead.
      
      Instead of that mess, move the generic copy_siginfo() definition into
      linux/signal.h, which allows an arch-specific uapi/asm/siginfo.h to
      include asm-generic/siginfo.h and define the arch-specific siginfo, and
      for the generic copy_siginfo() to see that arch-specific definition.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Petr Malat <oss@malat.biz>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: Christopher Ferris <cferris@google.com>
      Cc: linux-arch@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Cc: linux-ia64@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: <stable@vger.kernel.org> # 4.0-
      Patchwork: https://patchwork.linux-mips.org/patch/12478/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      ca9eb49a
  8. 03 5月, 2016 1 次提交
    • S
      signals/sigaltstack: Implement SS_AUTODISARM flag · 2a742138
      Stas Sergeev 提交于
      This patch implements the SS_AUTODISARM flag that can be OR-ed with
      SS_ONSTACK when forming ss_flags.
      
      When this flag is set, sigaltstack will be disabled when entering
      the signal handler; more precisely, after saving sas to uc_stack.
      When leaving the signal handler, the sigaltstack is restored by
      uc_stack.
      
      When this flag is used, it is safe to switch from sighandler with
      swapcontext(). Without this flag, the subsequent signal will corrupt
      the state of the switched-away sighandler.
      
      To detect the support of this functionality, one can do:
      
        err = sigaltstack(SS_DISABLE | SS_AUTODISARM);
        if (err && errno == EINVAL)
      	unsupported();
      Signed-off-by: NStas Sergeev <stsp@list.ru>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Aleksa Sarai <cyphar@cyphar.com>
      Cc: Amanieu d'Antras <amanieu@gmail.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
      Cc: Jason Low <jason.low2@hp.com>
      Cc: Josh Triplett <josh@joshtriplett.org>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Moore <pmoore@redhat.com>
      Cc: Pavel Emelyanov <xemul@parallels.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Sasha Levin <sasha.levin@oracle.com>
      Cc: Shuah Khan <shuahkh@osg.samsung.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vladimir Davydov <vdavydov@parallels.com>
      Cc: linux-api@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Link: http://lkml.kernel.org/r/1460665206-13646-4-git-send-email-stsp@list.ruSigned-off-by: NIngo Molnar <mingo@kernel.org>
      2a742138
  9. 21 11月, 2015 1 次提交
    • R
      kernel/signal.c: unexport sigsuspend() · 9d8a7652
      Richard Weinberger 提交于
      sigsuspend() is nowhere used except in signal.c itself, so we can mark it
      static do not pollute the global namespace.
      
      But this patch is more than a boring cleanup patch, it fixes a real issue
      on UserModeLinux.  UML has a special console driver to display ttys using
      xterm, or other terminal emulators, on the host side.  Vegard reported
      that sometimes UML is unable to spawn a xterm and he's facing the
      following warning:
      
        WARNING: CPU: 0 PID: 908 at include/linux/thread_info.h:128 sigsuspend+0xab/0xc0()
      
      It turned out that this warning makes absolutely no sense as the UML
      xterm code calls sigsuspend() on the host side, at least it tries.  But
      as the kernel itself offers a sigsuspend() symbol the linker choose this
      one instead of the glibc wrapper.  Interestingly this code used to work
      since ever but always blocked signals on the wrong side.  Some recent
      kernel change made the WARN_ON() trigger and uncovered the bug.
      
      It is a wonderful example of how much works by chance on computers. :-)
      
      Fixes: 68f3f16d ("new helper: sigsuspend()")
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      Reported-by: NVegard Nossum <vegard.nossum@oracle.com>
      Tested-by: NVegard Nossum <vegard.nossum@oracle.com>
      Acked-by: NOleg Nesterov <oleg@redhat.com>
      Cc: <stable@vger.kernel.org>	[3.5+]
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      9d8a7652
  10. 14 10月, 2014 1 次提交
  11. 06 8月, 2014 2 次提交
  12. 07 6月, 2014 3 次提交
    • O
      signals: introduce kernel_sigaction() · b4e74264
      Oleg Nesterov 提交于
      Now that allow_signal() is really trivial we can unify it with
      disallow_signal().  Add the new helper, kernel_sigaction(), and
      reimplement allow_signal/disallow_signal as a trivial wrappers.
      
      This saves one EXPORT_SYMBOL() and the new helper can have more users.
      Signed-off-by: NOleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Al Viro <viro@ZenIV.linux.org.uk>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tejun Heo <tj@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b4e74264
    • O
      signals: mv {dis,}allow_signal() from sched.h/exit.c to signal.[ch] · 0341729b
      Oleg Nesterov 提交于
      Move the declaration/definition of allow_signal/disallow_signal to
      signal.h/signal.c.  The new place is more logical and allows to use the
      static helpers in signal.c (see the next changes).
      
      While at it, make them return void and remove the valid_signal() check.
      Nobody checks the returned value, and in-kernel users must not pass the
      wrong signal number.
      Signed-off-by: NOleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Al Viro <viro@ZenIV.linux.org.uk>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tejun Heo <tj@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      0341729b
    • O
      signals: kill sigfindinword() · 36fac0a2
      Oleg Nesterov 提交于
      It has no users and it doesn't look useful.  I do not know why/when it was
      introduced, I can't even find any user in the git history.
      Signed-off-by: NOleg Nesterov <oleg@redhat.com>
      Acked-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Al Viro <viro@ZenIV.linux.org.uk>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tejun Heo <tj@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      36fac0a2
  13. 02 9月, 2013 1 次提交
  14. 02 5月, 2013 1 次提交
  15. 20 3月, 2013 1 次提交
    • D
      Fix breakage in MIPS siginfo handling · 2a148698
      David Howells 提交于
      MIPS's siginfo handling has been broken since this commit:
      
      	commit 574c4866
      	Author: Al Viro <viro@zeniv.linux.org.uk>
      	Date:   Sun Nov 25 22:24:19 2012 -0500
      	consolidate kernel-side struct sigaction declarations
      
      for 64-bit BE MIPS CPUs.
      
      The UAPI variant looks like this:
      
      	struct sigaction {
      		unsigned int	sa_flags;
      		__sighandler_t	sa_handler;
      		sigset_t	sa_mask;
      	};
      
      but the core kernel's variant looks like this:
      
      	struct sigaction {
      	#ifndef __ARCH_HAS_ODD_SIGACTION
      		__sighandler_t	sa_handler;
      		unsigned long	sa_flags;
      	#else
      		unsigned long	sa_flags;
      		__sighandler_t	sa_handler;
      	#endif
      	#ifdef __ARCH_HAS_SA_RESTORER
      		__sigrestore_t sa_restorer;
      	#endif
      		sigset_t	sa_mask;
      	};
      
      The problem is that sa_flags has been changed from an unsigned int to an
      unsigned long.
      
      Fix this by making sa_flags unsigned int if __ARCH_HAS_ODD_SIGACTION is
      defined.
      
      Whilst we're at it, rename __ARCH_HAS_ODD_SIGACTION to
      __ARCH_HAS_IRIX_SIGACTION.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Cc: stable@vger.kernel.org
      Acked-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      2a148698
  16. 04 2月, 2013 7 次提交
  17. 20 12月, 2012 2 次提交
  18. 13 10月, 2012 1 次提交
  19. 02 6月, 2012 2 次提交
    • A
      new helper: signal_delivered() · efee984c
      Al Viro 提交于
      Does block_sigmask() + tracehook_signal_handler();  called when
      sigframe has been successfully built.  All architectures converted
      to it; block_sigmask() itself is gone now (merged into this one).
      
      I'm still not too happy with the signature, but that's a separate
      story (IMO we need a structure that would contain signal number +
      siginfo + k_sigaction, so that get_signal_to_deliver() would fill one,
      signal_delivered(), handle_signal() and probably setup...frame() -
      take one).
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      efee984c
    • A
      most of set_current_blocked() callers want SIGKILL/SIGSTOP removed from set · 77097ae5
      Al Viro 提交于
      Only 3 out of 63 do not.  Renamed the current variant to __set_current_blocked(),
      added set_current_blocked() that will exclude unblockable signals, switched
      open-coded instances to it.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      77097ae5
  20. 22 5月, 2012 1 次提交
  21. 11 1月, 2012 1 次提交
  22. 20 5月, 2011 1 次提交
    • S
      signal.h need a definition of struct task_struct · 1477fcc2
      Stephen Rothwell 提交于
      This fixes these build errors on powerpc:
      
        In file included from arch/powerpc/mm/fault.c:18:
        include/linux/signal.h:239: error: 'struct task_struct' declared inside parameter list
        include/linux/signal.h:239: error: its scope is only this definition or declaration, which is probably not what you want
        include/linux/signal.h:240: error: 'struct task_struct' declared inside parameter list
        ..
      
      Exposed by commit e66eed65 ("list: remove prefetching from regular
      list iterators"), which removed the include of <linux/prefetch.h> from
      <linux/list.h>.
      
      Without that, linux/signal.h no longer accidentally got the declaration
      of 'struct task_struct'.
      
      Fix by properly declaring the struct, rather than introducing any new
      header file dependency.
      Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      1477fcc2
  23. 18 5月, 2011 1 次提交
  24. 28 4月, 2011 3 次提交
    • O
      signal: rename signandsets() to sigandnsets() · 702a5073
      Oleg Nesterov 提交于
      As Tejun and Linus pointed out, "nand" is the wrong name for "x & ~y",
      it should be "andn". Rename signandsets() as suggested.
      Suggested-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NOleg Nesterov <oleg@redhat.com>
      Acked-by: NTejun Heo <tj@kernel.org>
      702a5073
    • O
      signal: introduce do_sigtimedwait() to factor out compat/native code · 943df148
      Oleg Nesterov 提交于
      Factor out the common code in sys_rt_sigtimedwait/compat_sys_rt_sigtimedwait
      to the new helper, do_sigtimedwait().
      
      Add the comment to document the extra tick we add to timespec_to_jiffies(ts),
      thanks to Linus who explained this to me.
      
      Perhaps it would be better to move compat_sys_rt_sigtimedwait() into
      signal.c under CONFIG_COMPAT, then we can make do_sigtimedwait() static.
      Signed-off-by: NOleg Nesterov <oleg@redhat.com>
      Acked-by: NTejun Heo <tj@kernel.org>
      Reviewed-by: NMatt Fleming <matt.fleming@linux.intel.com>
      943df148
    • O
      signal: sigprocmask() should do retarget_shared_pending() · e6fa16ab
      Oleg Nesterov 提交于
      In short, almost every changing of current->blocked is wrong, or at least
      can lead to the unexpected results.
      
      For example. Two threads T1 and T2, T1 sleeps in sigtimedwait/pause/etc.
      kill(tgid, SIG) can pick T2 for TIF_SIGPENDING. If T2 calls sigprocmask()
      and blocks SIG before it notices the pending signal, nobody else can handle
      this pending shared signal.
      
      I am not sure this is bug, but at least this looks strange imho. T1 should
      not sleep forever, there is a signal which should wake it up.
      
      This patch moves the code which actually changes ->blocked into the new
      helper, set_current_blocked() and changes this code to call
      retarget_shared_pending() as exit_signals() does. We should only care about
      the signals we just blocked, we use "newset & ~current->blocked" as a mask.
      
      We do not check !sigisemptyset(newblocked), retarget_shared_pending() is
      cheap unless mask & shared_pending.
      
      Note: for this particular case we could simply change sigprocmask() to
      return -EINTR if signal_pending(), but then we should change other callers
      and, more importantly, if we need this fix then set_current_blocked() will
      have more callers and some of them can't restart. See the next patch as a
      random example.
      Signed-off-by: NOleg Nesterov <oleg@redhat.com>
      Reviewed-by: NMatt Fleming <matt.fleming@linux.intel.com>
      Acked-by: NTejun Heo <tj@kernel.org>
      e6fa16ab
  25. 13 3月, 2010 1 次提交
  26. 24 9月, 2009 1 次提交
  27. 01 5月, 2009 1 次提交