1. 14 6月, 2013 3 次提交
    • T
      percpu-refcount: implement percpu_tryget() along with percpu_ref_kill_and_confirm() · dbece3a0
      Tejun Heo 提交于
      Implement percpu_tryget() which stops giving out references once the
      percpu_ref is visible as killed.  Because the refcnt is per-cpu,
      different CPUs will start to see a refcnt as killed at different
      points in time and tryget() may continue to succeed on subset of cpus
      for a while after percpu_ref_kill() returns.
      
      For use cases where it's necessary to know when all CPUs start to see
      the refcnt as dead, percpu_ref_kill_and_confirm() is added.  The new
      function takes an extra argument @confirm_kill which is invoked when
      the refcnt is guaranteed to be viewed as killed on all CPUs.
      
      While this isn't the prettiest interface, it doesn't force synchronous
      wait and is much safer than requiring the caller to do its own
      call_rcu().
      
      v2: Patch description rephrased to emphasize that tryget() may
          continue to succeed on some CPUs after kill() returns as suggested
          by Kent.
      
      v3: Function comment in percpu_ref_kill_and_confirm() updated warning
          people to not depend on the implied RCU grace period from the
          confirm callback as it's an implementation detail.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Slightly-Grumpily-Acked-by: NKent Overstreet <koverstreet@google.com>
      dbece3a0
    • T
      percpu-refcount: implement percpu_ref_cancel_init() · bc497bd3
      Tejun Heo 提交于
      Normally, percpu_ref_init() initializes and percpu_ref_kill()
      initiates destruction which completes asynchronously.  The
      asynchronous destruction can be problematic in init failure path where
      the caller wants to destroy half-constructed object - distinguishing
      half-constructed objects from the usual release method can be painful
      for complex objects.
      
      This patch implements percpu_ref_cancel_init() which synchronously
      destroys the percpu_ref without invoking release.  To avoid
      unintentional misuses, the function requires the ref to have finished
      percpu_ref_init() but never used and triggers WARN otherwise.
      
      v2: Explain the weird name and usage restriction in the function
          comment.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NKent Overstreet <koverstreet@google.com>
      bc497bd3
    • T
      percpu-refcount: add __must_check to percpu_ref_init() and don't use... · acac7883
      Tejun Heo 提交于
      percpu-refcount: add __must_check to percpu_ref_init() and don't use ACCESS_ONCE() in percpu_ref_kill_rcu()
      
      Two small changes.
      
      * Unlike most init functions, percpu_ref_init() allocates memory and
        may fail.  Let's mark it with __must_check in case the caller
        forgets.
      
      * percpu_ref_kill_rcu() is unnecessarily using ACCESS_ONCE() to
        dereference @ref->pcpu_count, which can be misleading.  The pointer
        is guaranteed to be valid and visible and can't change underneath
        the function.  Drop ACCESS_ONCE().
      Signed-off-by: NTejun Heo <tj@kernel.org>
      acac7883
  2. 13 6月, 2013 2 次提交
  3. 04 6月, 2013 4 次提交
    • K
      percpu-refcount: Don't use silly cmpxchg() · c1ae6e9b
      Kent Overstreet 提交于
      The cmpxchg() was just to ensure the debug check didn't race, which was
      a bit excessive. The caller is supposed to do the appropriate
      synchronization, which means percpu_ref_kill() can just do a simple
      store.
      Signed-off-by: NKent Overstreet <koverstreet@google.com>
      Signed-off-by: NTejun Heo <tj@kernel.org>
      c1ae6e9b
    • K
      percpu: implement generic percpu refcounting · 215e262f
      Kent Overstreet 提交于
      This implements a refcount with similar semantics to
      atomic_get()/atomic_dec_and_test() - but percpu.
      
      It also implements two stage shutdown, as we need it to tear down the
      percpu counts.  Before dropping the initial refcount, you must call
      percpu_ref_kill(); this puts the refcount in "shutting down mode" and
      switches back to a single atomic refcount with the appropriate
      barriers (synchronize_rcu()).
      
      It's also legal to call percpu_ref_kill() multiple times - it only
      returns true once, so callers don't have to reimplement shutdown
      synchronization.
      
      [akpm@linux-foundation.org: fix build]
      [akpm@linux-foundation.org: coding-style tweak]
      Signed-off-by: NKent Overstreet <koverstreet@google.com>
      Cc: Zach Brown <zab@redhat.com>
      Cc: Felipe Balbi <balbi@ti.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Mark Fasheh <mfasheh@suse.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Asai Thambi S P <asamymuthupa@micron.com>
      Cc: Selvan Mani <smani@micron.com>
      Cc: Sam Bradshaw <sbradshaw@micron.com>
      Cc: Jeff Moyer <jmoyer@redhat.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Benjamin LaHaise <bcrl@kvack.org>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Christoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Reviewed-by: N"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: NTejun Heo <tj@kernel.org>
      215e262f
    • L
      Merge tag 'regulator-v3.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator · 042dd60c
      Linus Torvalds 提交于
      Pull regulator fixes from Mark Brown:
       "A few small fixes for v3.10, documentation things in the core and a
        few driver bugs."
      
      * tag 'regulator-v3.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
        regulator: palmas: Fix "enable_reg" to point to the correct reg for SMPS10
        regulator: palmas: Fix incorrect condition
        regulator: core: Correct spelling mistake in comment
        regulator: dbx500: Make local symbol static
        regulator: Fix kernel-doc generation warnings.
      042dd60c
    • L
      Merge tag 'jfs-3.10-rc5' of git://github.com/kleikamp/linux-shaggy · 0ab60871
      Linus Torvalds 提交于
      Pull jfs bugfixes from David Kleikamp:
       "A couple jfs bug fixes for 3.10-rc5"
      
      * tag 'jfs-3.10-rc5' of git://github.com/kleikamp/linux-shaggy:
        fs/jfs: Add check if journaling to disk has been disabled in lbmRead()
        jfs: Several bugs in jfs_freeze() and jfs_unfreeze()
      0ab60871
  4. 03 6月, 2013 4 次提交
  5. 02 6月, 2013 3 次提交
    • L
      Linux 3.10-rc4 · d683b96b
      Linus Torvalds 提交于
      d683b96b
    • S
      sata_rcar: fix interrupt handling · 52a2a108
      Sergei Shtylyov 提交于
      The driver's interrupt handling code is too picky in deciding whether it should
      handle an interrupt or not which causes completely unneeded spurious interrupts.
      Thus make sata_rcar_{ata|serr}_interrupt() *void*; add ATA status register read
      to sata_rcar_ata_interrupt() to clear an unexpected ATA interrupt -- it doesn't
      get cleared by writing to the SATAINTSTAT register in the interrupt mode we use.
      
      Also, in sata_rcar_ata_interrupt() we should check SATAINTSTAT register only for
      enabled interrupts and we should clear  only those interrupts  that we have read
      as active first time around, because else we have  a  race and risk clearing  an
      interrupt that  can  occur between read  and write of the  SATAINTSTAT  register
      and never registering it...
      Signed-off-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: stable@vger.kernel.org
      52a2a108
    • L
      Merge branch 'for-3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux · cc863973
      Linus Torvalds 提交于
      Pull parisc fixes from Helge Deller:
       "This patcheset includes fixes for:
      
         - the PCI/LBA which brings back the stifb graphics framebuffer
           console
         - possible memory overflows in parisc kernel init code
         - parport support on older GSC machines
         - avoids that users by mistake enable PARPORT_PC_SUPERIO on parisc
         - MAINTAINERS file list updates for parisc."
      
      * 'for-3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
        parisc: parport0: fix this legacy no-device port driver!
        parport_pc: disable PARPORT_PC_SUPERIO on parisc architecture
        parisc/PCI: lba: fix: convert to pci_create_root_bus() for correct root bus resources (v2)
        parisc/PCI: Set type for LBA bus_num resource
        MAINTAINERS: update parisc architecture file list
        parisc: kernel: using strlcpy() instead of strcpy()
        parisc: rename "CONFIG_PA7100" to "CONFIG_PA7000"
        parisc: fix kernel BUG at arch/parisc/include/asm/mmzone.h:50
        parisc: memory overflow, 'name' length is too short for using
      cc863973
  6. 01 6月, 2013 24 次提交