1. 24 Mar, 2017 1 commit
    • Jason A. Donenfeld's avatar
      padata: avoid race in reordering · de5540d0
      Jason A. Donenfeld authored
      Under extremely heavy uses of padata, crashes occur, and with list
      debugging turned on, this happens instead:
      [87487.298728] WARNING: CPU: 1 PID: 882 at lib/list_debug.c:33
      [87487.301868] list_add corruption. prev->next should be next
      (ffffb17abfc043d0), but was ffff8dba70872c80. (prev=ffff8dba70872b00).
      [87487.339011]  [<ffffffff9a53d075>] dump_stack+0x68/0xa3
      [87487.342198]  [<ffffffff99e119a1>] ? console_unlock+0x281/0x6d0
      [87487.345364]  [<ffffffff99d6b91f>] __warn+0xff/0x140
      [87487.348513]  [<ffffffff99d6b9aa>] warn_slowpath_fmt+0x4a/0x50
      [87487.351659]  [<ffffffff9a58b5de>] __list_add+0xae/0x130
      [87487.354772]  [<ffffffff9add5094>] ? _raw_spin_lock+0x64/0x70
      [87487.357915]  [<ffffffff99eefd66>] padata_reorder+0x1e6/0x420
      [87487.361084]  [<ffffffff99ef0055>] padata_do_serial+0xa5/0x120
      padata_reorder calls list_add_tail with the list to which its adding
      locked, which seems correct:
      list_add_tail(&padata->list, &squeue->serial.list);
      This therefore leaves only place where such inconsistency could occur:
      if padata->list is added at the same time on two different threads.
      This pdata pointer comes from the function call to
      padata_get_next(pd), which has in it the following block:
      next_queue = per_cpu_ptr(pd->pqueue, cpu);
      padata = NULL;
      reorder = &next_queue->reorder;
      if (!list_empty(&reorder->list)) {
             padata = list_entry(reorder->list.next,
                                 struct padata_priv, list);
             goto out;
      return padata;
      I strongly suspect that the problem here is that two threads can race
      on reorder list. Even though the deletion is locked, call to
      list_entry is not locked, which means it's feasible that two threads
      pick up the same padata object and subsequently call list_add_tail on
      them at the same time. The fix is thus be hoist that lock outside of
      that block.
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Acked-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
  2. 25 Oct, 2016 1 commit
  3. 19 Sep, 2016 1 commit
  4. 20 May, 2016 2 commits
    • Arnd Bergmann's avatar
      kernel/padata.c: hide unused functions · 19d795b6
      Arnd Bergmann authored
      A recent cleanup removed some exported functions that were not used
      anywhere, which in turn exposed the fact that some other functions in
      the same file are only used in some configurations.
      We now get a warning about them when CONFIG_HOTPLUG_CPU is disabled:
        kernel/padata.c:670:12: error: '__padata_remove_cpu' defined but not used [-Werror=unused-function]
         static int __padata_remove_cpu(struct padata_instance *pinst, int cpu)
        kernel/padata.c:650:12: error: '__padata_add_cpu' defined but not used [-Werror=unused-function]
         static int __padata_add_cpu(struct padata_instance *pinst, int cpu)
      This rearranges the code so the __padata_remove_cpu/__padata_add_cpu
      functions are within the #ifdef that protects the code that calls them.
      [akpm@linux-foundation.org: coding-style fixes]
      Fixes: 4ba6d78c671e ("kernel/padata.c: removed unused code")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Richard Cochran <rcochran@linutronix.de>
      Cc: Steffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Richard Cochran's avatar
      kernel/padata.c: removed unused code · 815613da
      Richard Cochran authored
      By accident I stumbled across code that has never been used.  This
      driver has EXPORT_SYMBOL functions, and the only user of the code is
      pcrypt.c, but this only uses a subset of the exported symbols.
      According to 'git log -G', the functions, padata_set_cpumasks,
      padata_add_cpu, and padata_remove_cpu have never been used since they
      were first introduced.  This patch removes the unused code.
      On one 64 bit build, with CRYPTO_PCRYPT built in, the text is more than
      4k smaller.
        kbuild_hp> size $KBUILD_OUTPUT/vmlinux
            text    data     bss      dec hex    filename
        10566658 4678360 1122304 16367322 f9beda vmlinux
        10561984 4678360 1122304 16362648 f9ac98 vmlinux
      On another config, 32 bit, the saving is about 0.5k bytes.
        kbuild_hp-x86> size $KBUILD_OUTPUT/vmlinux
        6012005 2409513 2785280 11206798 ab008e vmlinux
        6011491 2409513 2785280 11206284 aafe8c vmlinux
      Signed-off-by: default avatarRichard Cochran <rcochran@linutronix.de>
      Cc: Steffen Klassert <steffen.klassert@secunet.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: "David S. Miller" <davem@davemloft.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  5. 14 Feb, 2015 1 commit
  6. 05 Dec, 2013 1 commit
  7. 30 Oct, 2013 1 commit
  8. 29 Aug, 2013 2 commits
  9. 06 Dec, 2012 1 commit
  10. 29 Mar, 2012 3 commits
  11. 14 Mar, 2012 2 commits
  12. 31 Oct, 2011 1 commit
    • Paul Gortmaker's avatar
      kernel: Map most files to use export.h instead of module.h · 9984de1a
      Paul Gortmaker authored
      The changed files were only including linux/module.h for the
      EXPORT_SYMBOL infrastructure, and nothing else.  Revector them
      onto the isolated export header for faster compile times.
      Nothing to see here but a whole lot of instances of:
        -#include <linux/module.h>
        +#include <linux/export.h>
      This commit is only changing the kernel dir; next targets
      will probably be mm, fs, the arch dirs, etc.
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
  13. 31 Mar, 2011 1 commit
  14. 31 Jul, 2010 4 commits
  15. 26 Jul, 2010 3 commits
  16. 19 Jul, 2010 2 commits
    • Dan Kruchinin's avatar
      padata: Added sysfs primitives to padata subsystem · 5e017dc3
      Dan Kruchinin authored
      Added sysfs primitives to padata subsystem. Now API user may
      embedded kobject each padata instance contains into any sysfs
      hierarchy. For now padata sysfs interface provides only
      two objects:
          serial_cpumask   [RW] - cpumask for serial workers
          parallel_cpumask [RW] - cpumask for parallel workers
      Signed-off-by: default avatarDan Kruchinin <dkruchinin@acm.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    • Dan Kruchinin's avatar
      padata: Make two separate cpumasks · e15bacbe
      Dan Kruchinin authored
      The aim of this patch is to make two separate cpumasks
      for padata parallel and serial workers respectively.
      It allows user to make more thin and sophisticated configurations
      of padata framework. For example user may bind parallel and serial workers to non-intersecting
      CPU groups to gain better performance. Also each padata instance has notifiers chain for its
      cpumasks now. If either parallel or serial or both masks were changed all
      interested subsystems will get notification about that. It's especially useful
      if padata user uses algorithm for callback CPU selection according to serial cpumask.
      Signed-off-by: default avatarDan Kruchinin <dkruchinin@acm.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
  17. 14 Jul, 2010 5 commits
  18. 03 Jun, 2010 1 commit
  19. 27 May, 2010 1 commit
  20. 19 May, 2010 4 commits
  21. 03 May, 2010 2 commits