1. 23 Jan, 2016 18 commits
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · 20c759ca
      Linus Torvalds authored
      Merge small final update from Andrew Morton:
      
       - DAX feature work: add fsync/msync support
      
       - kfree cleanup, MAINTAINERS update
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        MAINTAINERS: return arch/sh to maintained state, with new maintainers
        tree wide: use kvfree() than conditional kfree()/vfree()
        dax: never rely on bh.b_dev being set by get_block()
        xfs: call dax_pfn_mkwrite() for DAX fsync/msync
        ext4: call dax_pfn_mkwrite() for DAX fsync/msync
        ext2: call dax_pfn_mkwrite() for DAX fsync/msync
        dax: add support for fsync/sync
        mm: add find_get_entries_tag()
        dax: support dirty DAX entries in radix tree
        pmem: add wb_cache_pmem() to the PMEM API
        dax: fix conversion of holes to PMDs
        dax: fix NULL pointer dereference in __dax_dbg()
      20c759ca
    • Linus Torvalds's avatar
      Merge tag 'please-pull-copy_file_range' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux · b82dde02
      Linus Torvalds authored
      Pull ia64 copy_file_range syscall update from Tony Luck:
       "Another release, another new syscall to wire up"
      
      * tag 'please-pull-copy_file_range' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux:
        [IA64] Enable copy_file_range syscall for ia64
      b82dde02
    • Linus Torvalds's avatar
      Merge tag 'armsoc-tegra' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc · 79d24532
      Linus Torvalds authored
      Pull ARM SoC support for Tegra platforms from Olof Johansson:
       "Here's a single-SoC topic branch that we've staged separately.  Mainly
        because it was hard to sort the branch contents in a way that fit our
        existing branches due to some refactorings.
      
        The code has been in -next for quite a while, but we staged it in
        arm-soc a bit late, which is why we've kept it separate from the other
        updates and are sending it separately here"
      
      * tag 'armsoc-tegra' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
        arm64: tegra: Add NVIDIA Jetson TX1 Developer Kit support
        arm64: tegra: Add NVIDIA P2597 I/O board support
        arm64: tegra: Add NVIDIA Jetson TX1 support
        arm64: tegra: Add NVIDIA P2571 board support
        arm64: tegra: Add NVIDIA P2371 board support
        arm64: tegra: Add NVIDIA P2595 I/O board support
        arm64: tegra: Add NVIDIA P2530 main board support
        arm64: tegra: Add Tegra210 support
        arm64: tegra: Add NVIDIA Tegra132 Norrin support
        arm64: tegra: Add Tegra132 support
        ARM: tegra: select USB_ULPI from EHCI rather than platform
        ARM: tegra: Ensure entire dcache is flushed on entering LP0/1
        amba: Hide TEGRA_AHB symbol
        soc/tegra: Add Tegra210 support
        soc/tegra: Provide per-SoC Kconfig symbols
      79d24532
    • Linus Torvalds's avatar
      Merge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc · 1b8ee1ec
      Linus Torvalds authored
      Pull ARM SoC fixes from Olof Johansson:
       "A few fixes for fallout that we didn't catch in time in -next, or
        smaller warning fixes that have been discovered since"
      
      * tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
        soc: qcom/spm: shut up uninitialized variable warning
        ARM: realview: fix device tree build
        ARM: debug-ll: fix BCM63xx entry for multiplatform
        ARM: dts: armadillo800eva Correct extal1 frequency to 24 MHz
      1b8ee1ec
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input · 5430dfe9
      Linus Torvalds authored
      Pull more input updates from Dmitry Torokhov:
       "The second round of updates for the input subsystem, mainly changes to
        xpad driver to better hanlde Xbox One controllers"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
        Input: gpio-keys - allow disabling individual buttons in DT
        Input: gpio-keys - allow setting input device name in DT
        Input: xpad - correct xbox one pad device name
        Input: atmel_mxt_ts - improve touchscreen size/orientation handling
        Input: xpad - use LED API when identifying wireless controllers
        Input: xpad - workaround dead irq_out after suspend/ resume
        Input: xpad - update Xbox One Force Feedback Support
        Input: xpad - correctly handle concurrent LED and FF requests
        Input: xpad - handle "present" and "gone" correctly
        Input: xpad - remove spurious events of wireless xpad 360 controller
      5430dfe9
    • Linus Torvalds's avatar
      Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 4adea1fd
      Linus Torvalds authored
      Pull more SCSI updates from James Bottomley:
       "This is mostly stuff which missed the first pull request because it
        needed to incubate longer.  It's mainly made up of the ncr 5380 rework
        but also has a few assorted bug fixes"
      
      * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (88 commits)
        imm: Use new parport device model
        megaraid: Fix possible NULL pointer deference in mraid_mm_ioctl
        storvsc: Fix typo in MODULE_PARM_DESC
        cxgbi: Typo in MODULE_PARM_DESC
        3w-xxxx: Pass through compat mode ioctls
        hisi_sas: Use u64 for qw0 in free_device_v1_hw()
        hisi_sas: Fix typo in setup_itct_v1_hw()
        hisi_sas: Fix v1 itct masks
        ipr: Fix out-of-bounds null overwrite
        scsi: add Synology to 1024 sector blacklist
        ncr5380: Add support for HP C2502
        ncr5380: Fix wait for 53C80 registers registers after PDMA
        ncr5380: Enable PDMA for DTC chips
        ncr5380: Enable PDMA for NCR53C400A
        ncr5380: Use runtime register mapping
        ncr5380: Fix pseudo DMA transfers on 53C400
        ncr5380: Cleanup whitespace and parentheses
        atari_NCR5380: Merge changes from NCR5380.c
        ncr5380: Merge changes from atari_NCR5380.c
        ncr5380: Fix whitespace in comments using regexp
        ...
      4adea1fd
    • Rich Felker's avatar
      MAINTAINERS: return arch/sh to maintained state, with new maintainers · 114bf37e
      Rich Felker authored
      Add Yoshinori Sato and Rich Felker as maintainers for arch/sh
      (SUPERH).
      Signed-off-by: default avatarRich Felker <dalias@libc.org>
      Signed-off-by: default avatarYoshinori Sato <ysato@users.sourceforge.jp>
      Acked-by: default avatarD. Jeff Dionne <jeff@uClinux.org>
      Acked-by: default avatarRob Landley <rob@landley.net>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarSimon Horman <horms+renesas@verge.net.au>
      Acked-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      114bf37e
    • Tetsuo Handa's avatar
      tree wide: use kvfree() than conditional kfree()/vfree() · 1d5cfdb0
      Tetsuo Handa authored
      There are many locations that do
      
        if (memory_was_allocated_by_vmalloc)
          vfree(ptr);
        else
          kfree(ptr);
      
      but kvfree() can handle both kmalloc()ed memory and vmalloc()ed memory
      using is_vmalloc_addr().  Unless callers have special reasons, we can
      replace this branch with kvfree().  Please check and reply if you found
      problems.
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Acked-by: default avatarJan Kara <jack@suse.com>
      Acked-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
      Acked-by: default avatar"Rafael J. Wysocki" <rjw@rjwysocki.net>
      Acked-by: default avatarDavid Rientjes <rientjes@google.com>
      Cc: "Luck, Tony" <tony.luck@intel.com>
      Cc: Oleg Drokin <oleg.drokin@intel.com>
      Cc: Boris Petkov <bp@suse.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1d5cfdb0
    • Ross Zwisler's avatar
      dax: never rely on bh.b_dev being set by get_block() · eab95db6
      Ross Zwisler authored
      Previously in DAX we assumed that calls to get_block() would set
      bh.b_bdev, and we would then use that value even in error cases for
      debugging.  This caused a NULL pointer dereference in __dax_dbg() which
      was fixed by a previous commit, but that commit only changed the one
      place where we were hitting an error.
      
      Instead, update dax.c so that we always initialize bh.b_bdev as best we
      can based on the information that DAX has.  get_block() may or may not
      update to a new value, but this at least lets us get something helpful
      from bh.b_bdev for error messages and not have to worry about whether it
      was set by get_block() or not.
      Signed-off-by: default avatarRoss Zwisler <ross.zwisler@linux.intel.com>
      Reported-by: default avatarJan Kara <jack@suse.cz>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      eab95db6
    • Ross Zwisler's avatar
      xfs: call dax_pfn_mkwrite() for DAX fsync/msync · 5eb88dca
      Ross Zwisler authored
      To properly support the new DAX fsync/msync infrastructure filesystems
      need to call dax_pfn_mkwrite() so that DAX can track when user pages are
      dirtied.
      Signed-off-by: default avatarRoss Zwisler <ross.zwisler@linux.intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Andreas Dilger <adilger.kernel@dilger.ca>
      Cc: Dave Chinner <david@fromorbit.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jan Kara <jack@suse.com>
      Cc: Jeff Layton <jlayton@poochiereds.net>
      Cc: Matthew Wilcox <willy@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5eb88dca
    • Ross Zwisler's avatar
      ext4: call dax_pfn_mkwrite() for DAX fsync/msync · d5be7a03
      Ross Zwisler authored
      To properly support the new DAX fsync/msync infrastructure filesystems
      need to call dax_pfn_mkwrite() so that DAX can track when user pages are
      dirtied.
      Signed-off-by: default avatarRoss Zwisler <ross.zwisler@linux.intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Andreas Dilger <adilger.kernel@dilger.ca>
      Cc: Dave Chinner <david@fromorbit.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jan Kara <jack@suse.com>
      Cc: Jeff Layton <jlayton@poochiereds.net>
      Cc: Matthew Wilcox <willy@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d5be7a03
    • Ross Zwisler's avatar
      ext2: call dax_pfn_mkwrite() for DAX fsync/msync · 80b4adca
      Ross Zwisler authored
      To properly support the new DAX fsync/msync infrastructure filesystems
      need to call dax_pfn_mkwrite() so that DAX can track when user pages are
      dirtied.
      Signed-off-by: default avatarRoss Zwisler <ross.zwisler@linux.intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Andreas Dilger <adilger.kernel@dilger.ca>
      Cc: Dave Chinner <david@fromorbit.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jan Kara <jack@suse.com>
      Cc: Jeff Layton <jlayton@poochiereds.net>
      Cc: Matthew Wilcox <willy@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      80b4adca
    • Ross Zwisler's avatar
      dax: add support for fsync/sync · 9973c98e
      Ross Zwisler authored
      To properly handle fsync/msync in an efficient way DAX needs to track
      dirty pages so it is able to flush them durably to media on demand.
      
      The tracking of dirty pages is done via the radix tree in struct
      address_space.  This radix tree is already used by the page writeback
      infrastructure for tracking dirty pages associated with an open file,
      and it already has support for exceptional (non struct page*) entries.
      We build upon these features to add exceptional entries to the radix
      tree for DAX dirty PMD or PTE pages at fault time.
      
      [dan.j.williams@intel.com: fix dax_pmd_dbg build warning]
      Signed-off-by: default avatarRoss Zwisler <ross.zwisler@linux.intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Andreas Dilger <adilger.kernel@dilger.ca>
      Cc: Dave Chinner <david@fromorbit.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jan Kara <jack@suse.com>
      Cc: Jeff Layton <jlayton@poochiereds.net>
      Cc: Matthew Wilcox <willy@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9973c98e
    • Ross Zwisler's avatar
      mm: add find_get_entries_tag() · 7e7f7749
      Ross Zwisler authored
      Add find_get_entries_tag() to the family of functions that include
      find_get_entries(), find_get_pages() and find_get_pages_tag().  This is
      needed for DAX dirty page handling because we need a list of both page
      offsets and radix tree entries ('indices' and 'entries' in this
      function) that are marked with the PAGECACHE_TAG_TOWRITE tag.
      Signed-off-by: default avatarRoss Zwisler <ross.zwisler@linux.intel.com>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Andreas Dilger <adilger.kernel@dilger.ca>
      Cc: Dave Chinner <david@fromorbit.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jeff Layton <jlayton@poochiereds.net>
      Cc: Matthew Wilcox <willy@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7e7f7749
    • Ross Zwisler's avatar
      dax: support dirty DAX entries in radix tree · f9fe48be
      Ross Zwisler authored
      Add support for tracking dirty DAX entries in the struct address_space
      radix tree.  This tree is already used for dirty page writeback, and it
      already supports the use of exceptional (non struct page*) entries.
      
      In order to properly track dirty DAX pages we will insert new
      exceptional entries into the radix tree that represent dirty DAX PTE or
      PMD pages.  These exceptional entries will also contain the writeback
      addresses for the PTE or PMD faults that we can use at fsync/msync time.
      
      There are currently two types of exceptional entries (shmem and shadow)
      that can be placed into the radix tree, and this adds a third.  We rely
      on the fact that only one type of exceptional entry can be found in a
      given radix tree based on its usage.  This happens for free with DAX vs
      shmem but we explicitly prevent shadow entries from being added to radix
      trees for DAX mappings.
      
      The only shadow entries that would be generated for DAX radix trees
      would be to track zero page mappings that were created for holes.  These
      pages would receive minimal benefit from having shadow entries, and the
      choice to have only one type of exceptional entry in a given radix tree
      makes the logic simpler both in clear_exceptional_entry() and in the
      rest of DAX.
      Signed-off-by: default avatarRoss Zwisler <ross.zwisler@linux.intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Andreas Dilger <adilger.kernel@dilger.ca>
      Cc: Dave Chinner <david@fromorbit.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jan Kara <jack@suse.com>
      Cc: Jeff Layton <jlayton@poochiereds.net>
      Cc: Matthew Wilcox <willy@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Hugh Dickins <hughd@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f9fe48be
    • Ross Zwisler's avatar
      pmem: add wb_cache_pmem() to the PMEM API · 3f4a2670
      Ross Zwisler authored
      __arch_wb_cache_pmem() was already an internal implementation detail of
      the x86 PMEM API, but this functionality needs to be exported as part of
      the general PMEM API to handle the fsync/msync case for DAX mmaps.
      
      One thing worth noting is that we really do want this to be part of the
      PMEM API as opposed to a stand-alone function like clflush_cache_range()
      because of ordering restrictions.  By having wb_cache_pmem() as part of
      the PMEM API we can leave it unordered, call it multiple times to write
      back large amounts of memory, and then order the multiple calls with a
      single wmb_pmem().
      Signed-off-by: default avatarRoss Zwisler <ross.zwisler@linux.intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Andreas Dilger <adilger.kernel@dilger.ca>
      Cc: Dave Chinner <david@fromorbit.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jan Kara <jack@suse.com>
      Cc: Jeff Layton <jlayton@poochiereds.net>
      Cc: Matthew Wilcox <willy@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3f4a2670
    • Ross Zwisler's avatar
      dax: fix conversion of holes to PMDs · de14b9cb
      Ross Zwisler authored
      When we get a DAX PMD fault for a write it is possible that there could
      be some number of 4k zero pages already present for the same range that
      were inserted to service reads from a hole.  These 4k zero pages need to
      be unmapped from the VMAs and removed from the struct address_space
      radix tree before the real DAX PMD entry can be inserted.
      
      For PTE faults this same use case also exists and is handled by a
      combination of unmap_mapping_range() to unmap the VMAs and
      delete_from_page_cache() to remove the page from the address_space radix
      tree.
      
      For PMD faults we do have a call to unmap_mapping_range() (protected by
      a buffer_new() check), but nothing clears out the radix tree entry.  The
      buffer_new() check is also incorrect as the current ext4 and XFS
      filesystem code will never return a buffer_head with BH_New set, even
      when allocating new blocks over a hole.  Instead the filesystem will
      zero the blocks manually and return a buffer_head with only BH_Mapped
      set.
      
      Fix this situation by removing the buffer_new() check and adding a call
      to truncate_inode_pages_range() to clear out the radix tree entries
      before we insert the DAX PMD.
      Signed-off-by: default avatarRoss Zwisler <ross.zwisler@linux.intel.com>
      Reported-by: default avatarDan Williams <dan.j.williams@intel.com>
      Tested-by: default avatarDan Williams <dan.j.williams@intel.com>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Andreas Dilger <adilger.kernel@dilger.ca>
      Cc: Dave Chinner <david@fromorbit.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jeff Layton <jlayton@poochiereds.net>
      Cc: Matthew Wilcox <willy@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      de14b9cb
    • Ross Zwisler's avatar
      dax: fix NULL pointer dereference in __dax_dbg() · d4bbe706
      Ross Zwisler authored
      In __dax_pmd_fault() we currently assume that get_block() will always
      set bh.b_bdev and we unconditionally dereference it in __dax_dbg().
      
      This assumption isn't always true - when called for reads of holes
      ext4_dax_mmap_get_block() returns a buffer head where bh->b_bdev is
      never set.  I hit this BUG while testing the DAX PMD fault path.
      
      Instead, initialize bh.b_bdev before passing bh into get_block().  It is
      possible that the filesystem's get_block() will update bh.b_bdev, and
      this is fine - we just want to initialize bh.b_bdev to something
      reasonable so that the calls to __dax_dbg() work and print something
      useful.
      Signed-off-by: default avatarRoss Zwisler <ross.zwisler@linux.intel.com>
      Reported-by: default avatarDan Williams <dan.j.williams@intel.com>
      Cc: Jan Kara <jack@suse.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d4bbe706
  2. 22 Jan, 2016 21 commits
    • Tony Luck's avatar
      [IA64] Enable copy_file_range syscall for ia64 · 884a12a5
      Tony Luck authored
      New system call added in:
        29732938
        vfs: add copy_file_range syscall and vfs helper
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
      884a12a5
    • Linus Torvalds's avatar
      Merge tag 'mmc-v4.5-rc1' of git://git.linaro.org/people/ulf.hansson/mmc · 2c9b3ebd
      Linus Torvalds authored
      Pull MMC fixes from Ulf Hansson:
       "Here are some mmc fixes intended for v4.5 rc1.
      
        MMC core:
         - Restore reset-gpios to be optional in pwrseq_simple
         - Allow SDIO tuple for CISTPL_SDIO_STD
         - Print correct voltage value in debugfs
         - Enable tuning according to the actual timing
         - Limit SD card power limit according to cards capabilities
      
        MMC host:
         - tmio_mmc_dma: don't print invalid DMA cookie
         - mmci: Pick the correct variant and allow 8-bit mode for Nomadik"
      
      * tag 'mmc-v4.5-rc1' of git://git.linaro.org/people/ulf.hansson/mmc:
        mmc: pwrseq_simple: Make reset-gpios optional to match doc
        mmc: sdio_cis: fix unknown tuple for CISTPL_SDIO_STD
        mmc: debugfs: correct wrong voltage value
        mmc: tmio_mmc_dma: don't print invalid DMA cookie
        mmc: core: Enable tuning according to the actual timing
        mmc: mmci: support 8bit mode on the Nomadik
        mmc: mmci: fix an ages old detection error
        mmc: sd: limit SD card power limit according to cards capabilities
      2c9b3ebd
    • Linus Torvalds's avatar
      Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 · 48162a20
      Linus Torvalds authored
      Pull crypto fixes from Herbert Xu:
       "This fixes the following issues:
      
        API:
         - A large number of bug fixes for the af_alg interface, credit goes
           to Dmitry Vyukov for discovering and reporting these issues.
      
        Algorithms:
         - sw842 needs to select crc32.
         - The soft dependency on crc32c is now in the correct spot.
      
        Drivers:
         - The atmel AES driver needs HAS_DMA.
         - The atmel AES driver was a missing break statement, fortunately
           it's only a debug function.
         - A number of bug fixes for the Intel qat driver"
      
      * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (24 commits)
        crypto: algif_skcipher - sendmsg SG marking is off by one
        crypto: crc32c - Fix crc32c soft dependency
        crypto: algif_skcipher - Load TX SG list after waiting
        crypto: atmel-aes - Add missing break to atmel_aes_reg_name
        crypto: algif_skcipher - Fix race condition in skcipher_check_key
        crypto: algif_hash - Fix race condition in hash_check_key
        crypto: CRYPTO_DEV_ATMEL_AES should depend on HAS_DMA
        lib: sw842: select crc32
        crypto: af_alg - Forbid bind(2) when nokey child sockets are present
        crypto: algif_skcipher - Remove custom release parent function
        crypto: algif_hash - Remove custom release parent function
        crypto: af_alg - Allow af_af_alg_release_parent to be called on nokey path
        crypto: qat - update init_esram for C3xxx dev type
        crypto: qat - fix timeout issues
        crypto: qat - remove to call get_sram_bar_id for qat_c3xxx
        crypto: algif_skcipher - Add key check exception for cipher_null
        crypto: skcipher - Add crypto_skcipher_has_setkey
        crypto: algif_hash - Require setkey before accept(2)
        crypto: hash - Add crypto_ahash_has_setkey
        crypto: algif_skcipher - Add nokey compatibility path
        ...
      48162a20
    • Linus Torvalds's avatar
      Merge tag 'sound-fix-4.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · e7cc3edd
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "Here are lots of small fixes that have been collected since the
        previous pull.  This time, not only trivial ones but fixes for some
        serious bugs are included:
      
         - Fix for CPU lockups by snd-hrtimer accesses
         - Fix for unsafe disconnection handling in ALSA timer code
         - Fix for Oops due to race at HD-audio module removal
         - Fixes for possible memory corruption via 32bit PCM and sequencer
           compat ioctls
         - Fix for regression in HD-audio generic model handling
         - Suppress kernel warnings for invalid TLV ioctls that may flood up
         - Fix the missing SSC clock handling for at73c213
         - A pin fixup for ASUS N550JX"
      
      * tag 'sound-fix-4.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: timer: Introduce disconnect op to snd_timer_instance
        ALSA: timer: Handle disconnection more safely
        ALSA: hda - Flush the pending probe work at remove
        ALSA: hda - Fix missing module loading with model=generic option
        ALSA: hda - Degrade i915 binding failure message
        ALSA: at73c213: manage SSC clock
        ALSA: control: Avoid kernel warnings from tlv ioctl with numid 0
        ALSA: seq: Fix snd_seq_call_port_info_ioctl in compat mode
        ALSA: pcm: Fix snd_pcm_hw_params struct copy in compat mode
        ALSA: hrtimer: Fix stall by hrtimer_cancel()
        ALSA: hda - Fix bass pin fixup for ASUS N550JX
      e7cc3edd
    • Linus Torvalds's avatar
      Merge branch 'for-linus-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs · 2101ae42
      Linus Torvalds authored
      Pull more btrfs updates from Chris Mason:
       "These are mostly fixes that we've been testing, but also we grabbed
        and tested a few small cleanups that had been on the list for a while.
      
        Zhao Lei's patchset also fixes some early ENOSPC buglets"
      
      * 'for-linus-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: (21 commits)
        btrfs: raid56: Use raid_write_end_io for scrub
        btrfs: Remove unnecessary ClearPageUptodate for raid56
        btrfs: use rbio->nr_pages to reduce calculation
        btrfs: Use unified stripe_page's index calculation
        btrfs: Fix calculation of rbio->dbitmap's size calculation
        btrfs: Fix no_space in write and rm loop
        btrfs: merge functions for wait snapshot creation
        btrfs: delete unused argument in btrfs_copy_from_user
        btrfs: Use direct way to determine raid56 write/recover mode
        btrfs: Small cleanup for get index_srcdev loop
        btrfs: Enhance chunk validation check
        btrfs: Enhance super validation check
        Btrfs: fix deadlock running delayed iputs at transaction commit time
        Btrfs: fix typo in log message when starting a balance
        btrfs: remove duplicate const specifier
        btrfs: initialize the seq counter in struct btrfs_device
        Btrfs: clean up an error code in btrfs_init_space_info()
        btrfs: fix iterator with update error in backref.c
        Btrfs: fix output of compression message in btrfs_parse_options()
        Btrfs: Initialize btrfs_root->highest_objectid when loading tree root and subvolume roots
        ...
      2101ae42
    • Linus Torvalds's avatar
      Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · 391f2a16
      Linus Torvalds authored
      Pull ext4 updates from Ted Ts'o:
       "Some locking and page fault bug fixes from Jan Kara, some ext4
        encryption fixes from me, and Li Xi's Project Quota commits"
      
      * tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
        fs: clean up the flags definition in uapi/linux/fs.h
        ext4: add FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
        ext4: add project quota support
        ext4: adds project ID support
        ext4 crypto: simplify interfaces to directory entry insert functions
        ext4 crypto: add missing locking for keyring_key access
        ext4: use pre-zeroed blocks for DAX page faults
        ext4: implement allocation of pre-zeroed blocks
        ext4: provide ext4_issue_zeroout()
        ext4: get rid of EXT4_GET_BLOCKS_NO_LOCK flag
        ext4: document lock ordering
        ext4: fix races of writeback with punch hole and zero range
        ext4: fix races between buffered IO and collapse / insert range
        ext4: move unlocked dio protection from ext4_alloc_file_blocks()
        ext4: fix races between page faults and hole punching
      391f2a16
    • Linus Torvalds's avatar
      Merge tag 'xfs-for-linus-4.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs · d5ffdf8b
      Linus Torvalds authored
      Pull more xfs updates from Dave Chinner:
       "This is the second update for XFS that I mentioned in the original
        pull request last week.
      
        It contains a revert for a suspend regression in 4.4 and a fix for a
        long standing log recovery issue that has been further exposed by all
        the log recovery changes made in the original 4.5 merge.
      
        There is one more thing in this pull request - one that I forgot to
        merge into the origin.  That is, pulling the XFS_IOC_FS[GS]ETXATTR
        ioctl up to the VFS level so that other filesystems can also use it
        for modifying project quota IDs
      
        Summary:
      
         - promotion of XFS_IOC_FS[GS]ETXATTR ioctl to the vfs level so that
           it can be shared with other filesystems.  The ext4 project quota
           functionality is the first target for this.  The commits in this
           series have not been updated with review or final SOB tags because
           the branch they were originally published in was needed by ext4.
           Those tags are:
      Reviewed-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarDave Chinner <david@fromrobit.com>
      
         - Revert a change that is causing suspend failures.
      
         - Fix a use-after-free that can occur on log mount failures.  Been
           around forever, but now exposed by other changes to log recovery
           made in the first 4.5 merge"
      
      * tag 'xfs-for-linus-4.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs:
        xfs: log mount failures don't wait for buffers to be released
        Revert "xfs: clear PF_NOFREEZE for xfsaild kthread"
        xfs: introduce per-inode DAX enablement
        xfs: use FS_XFLAG definitions directly
        fs: XFS_IOC_FS[SG]SETXATTR to FS_IOC_FS[SG]ETXATTR promotion
      d5ffdf8b
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · eadee0ce
      Linus Torvalds authored
      Pull more vfs updates from Al Viro:
       "Embarrassing braino fix + pipe page accounting + fixing an eyesore in
        find_filesystem() (checking that s1 is equal to prefix of s2 of given
        length can be done in many ways, but "compare strlen(s1) with length
        and then do strncmp()" is not a good one...)"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        [regression] fix braino in fs/dlm/user.c
        pipe: limit the per-user amount of pages allocated in pipes
        find_filesystem(): simplify comparison
      eadee0ce
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · 6fb11e65
      Linus Torvalds authored
      Merge misc fixes from Andrew Morton:
       "Six fixes"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        ocfs2: NFS hangs in __ocfs2_cluster_lock due to race with ocfs2_unblock_lock
        reiserfs: fix dereference of ERR_PTR
        ratelimit: fix bug in time interval by resetting right begin time
        mm: fix kernel crash in khugepaged thread
        mm: fix mlock accouting
        thp: change pmd_trans_huge_lock() interface to return ptl
      6fb11e65
    • Olof Johansson's avatar
      Merge tag 'renesas-fixes-for-v4.5' of... · 53c517a8
      Olof Johansson authored
      Merge tag 'renesas-fixes-for-v4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas into fixes
      
      Renesas ARM Based SoC Fixes for v4.5
      
      Correct extal1 frequency of armadillo800eva board
      
      * tag 'renesas-fixes-for-v4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas:
        ARM: dts: armadillo800eva Correct extal1 frequency to 24 MHz
      Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
      53c517a8
    • Arnd Bergmann's avatar
      soc: qcom/spm: shut up uninitialized variable warning · 00affcac
      Arnd Bergmann authored
      gcc warns about the 'found' variable possibly being used uninitialized:
      
      drivers/soc/qcom/spm.c: In function 'spm_dev_probe':
      drivers/soc/qcom/spm.c:305:5: error: 'found' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      
      However, the code is correct because we know that there is
      always at least one online CPU. This initializes the 'found'
      variable to zero before the loop so the compiler knows
      it does not have to warn about it.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      00affcac
    • Linus Torvalds's avatar
      Merge branch 'for-4.5/nvme' of git://git.kernel.dk/linux-block · 3e1e21c7
      Linus Torvalds authored
      Pull NVMe updates from Jens Axboe:
       "Last branch for this series is the nvme changes.  It's in a separate
        branch to avoid splitting too much between core and NVMe changes,
        since NVMe is still helping drive some blk-mq changes.  That said, not
        a huge amount of core changes in here.  The grunt of the work is the
        continued split of the code"
      
      * 'for-4.5/nvme' of git://git.kernel.dk/linux-block: (67 commits)
        uapi: update install list after nvme.h rename
        NVMe: Export NVMe attributes to sysfs group
        NVMe: Shutdown controller only for power-off
        NVMe: IO queue deletion re-write
        NVMe: Remove queue freezing on resets
        NVMe: Use a retryable error code on reset
        NVMe: Fix admin queue ring wrap
        nvme: make SG_IO support optional
        nvme: fixes for NVME_IOCTL_IO_CMD on the char device
        nvme: synchronize access to ctrl->namespaces
        nvme: Move nvme_freeze/unfreeze_queues to nvme core
        PCI/AER: include header file
        NVMe: Export namespace attributes to sysfs
        NVMe: Add pci error handlers
        block: remove REQ_NO_TIMEOUT flag
        nvme: merge iod and cmd_info
        nvme: meta_sg doesn't have to be an array
        nvme: properly free resources for cancelled command
        nvme: simplify completion handling
        nvme: special case AEN requests
        ...
      3e1e21c7
    • Linus Torvalds's avatar
      Merge branch 'for-4.5/lightnvm' of git://git.kernel.dk/linux-block · 0a13daed
      Linus Torvalds authored
      Pull lightnvm fixes and updates from Jens Axboe:
       "This should have been part of the drivers branch, but it arrived a bit
        late and wasn't based on the official core block driver branch.  So
        they got a small scolding, but got a pass since it's still new.  Hence
        it's in a separate branch.
      
        This is mostly pure fixes, contained to lightnvm/, and minor feature
        additions"
      
      * 'for-4.5/lightnvm' of git://git.kernel.dk/linux-block: (26 commits)
        lightnvm: ensure that nvm_dev_ops can be used without CONFIG_NVM
        lightnvm: introduce factory reset
        lightnvm: use system block for mm initialization
        lightnvm: introduce ioctl to initialize device
        lightnvm: core on-disk initialization
        lightnvm: introduce mlc lower page table mappings
        lightnvm: add mccap support
        lightnvm: manage open and closed blocks separately
        lightnvm: fix missing grown bad block type
        lightnvm: reference rrpc lun in rrpc block
        lightnvm: introduce nvm_submit_ppa
        lightnvm: move rq->error to nvm_rq->error
        lightnvm: support multiple ppas in nvm_erase_ppa
        lightnvm: move the pages per block check out of the loop
        lightnvm: sectors first in ppa list
        lightnvm: fix locking and mempool in rrpc_lun_gc
        lightnvm: put block back to gc list on its reclaim fail
        lightnvm: check bi_error in gc
        lightnvm: return the get_bb_tbl return value
        lightnvm: refactor end_io functions for sync
        ...
      0a13daed
    • Linus Torvalds's avatar
      Merge branch 'for-4.5/drivers' of git://git.kernel.dk/linux-block · 64120354
      Linus Torvalds authored
      Pull block driver updates from Jens Axboe:
       "This is the block driver pull request for 4.5, with the exception of
        NVMe, which is in a separate branch and will be posted after this one.
      
        This pull request contains:
      
         - A set of bcache stability fixes, which have been acked by Kent.
           These have been used and tested for more than a year by the
           community, so it's about time that they got in.
      
         - A set of drbd updates from the drbd team (Andreas, Lars, Philipp)
           and Markus Elfring, Oleg Drokin.
      
         - A set of fixes for xen blkback/front from the usual suspects, (Bob,
           Konrad) as well as community based fixes from Kiri, Julien, and
           Peng.
      
         - A 2038 time fix for sx8 from Shraddha, with a fix from me.
      
         - A small mtip32xx cleanup from Zhu Yanjun.
      
         - A null_blk division fix from Arnd"
      
      * 'for-4.5/drivers' of git://git.kernel.dk/linux-block: (71 commits)
        null_blk: use sector_div instead of do_div
        mtip32xx: restrict variables visible in current code module
        xen/blkfront: Fix crash if backend doesn't follow the right states.
        xen/blkback: Fix two memory leaks.
        xen/blkback: make st_ statistics per ring
        xen/blkfront: Handle non-indirect grant with 64KB pages
        xen-blkfront: Introduce blkif_ring_get_request
        xen-blkback: clear PF_NOFREEZE for xen_blkif_schedule()
        xen/blkback: Free resources if connect_ring failed.
        xen/blocks: Return -EXX instead of -1
        xen/blkback: make pool of persistent grants and free pages per-queue
        xen/blkback: get the number of hardware queues/rings from blkfront
        xen/blkback: pseudo support for multi hardware queues/rings
        xen/blkback: separate ring information out of struct xen_blkif
        xen/blkfront: correct setting for xen_blkif_max_ring_order
        xen/blkfront: make persistent grants pool per-queue
        xen/blkfront: Remove duplicate setting of ->xbdev.
        xen/blkfront: Cleanup of comments, fix unaligned variables, and syntax errors.
        xen/blkfront: negotiate number of queues/rings to be used with backend
        xen/blkfront: split per device io_lock
        ...
      64120354
    • Dmitry Torokhov's avatar
      Merge branch 'next' into for-linus · b26a95d4
      Dmitry Torokhov authored
      Prepare second round of input updates for 4.5 merge window.
      b26a95d4
    • Tariq Saeed's avatar
      ocfs2: NFS hangs in __ocfs2_cluster_lock due to race with ocfs2_unblock_lock · b1b1e15e
      Tariq Saeed authored
      NFS on a 2 node ocfs2 cluster each node exporting dir.  The lock causing
      the hang is the global bit map inode lock.  Node 1 is master, has the
      lock granted in PR mode; Node 2 is in the converting list (PR -> EX).
      There are no holders of the lock on the master node so it should
      downconvert to NL and grant EX to node 2 but that does not happen.
      BLOCKED + QUEUED in lock res are set and it is on osb blocked list.
      Threads are waiting in __ocfs2_cluster_lock on BLOCKED.  One thread
      wants EX, rest want PR.  So it is as though the downconvert thread needs
      to be kicked to complete the conv.
      
      The hang is caused by an EX req coming into __ocfs2_cluster_lock on the
      heels of a PR req after it sets BUSY (drops l_lock, releasing EX
      thread), forcing the incoming EX to wait on BUSY without doing anything.
      PR has called ocfs2_dlm_lock, which sets the node 1 lock from NL -> PR,
      queues ast.
      
      At this time, upconvert (PR ->EX) arrives from node 2, finds conflict
      with node 1 lock in PR, so the lock res is put on dlm thread's dirty
      listt.
      
      After ret from ocf2_dlm_lock, PR thread now waits behind EX on BUSY till
      awoken by ast.
      
      Now it is dlm_thread that serially runs dlm_shuffle_lists, ast, bast, in
      that order.  dlm_shuffle_lists ques a bast on behalf of node 2 (which
      will be run by dlm_thread right after the ast).  ast does its part, sets
      UPCONVERT_FINISHING, clears BUSY and wakes its waiters.  Next,
      dlm_thread runs bast.  It sets BLOCKED and kicks dc thread.  dc thread
      runs ocfs2_unblock_lock, but since UPCONVERT_FINISHING set, skips doing
      anything and reques.
      
      Inside of __ocfs2_cluster_lock, since EX has been waiting on BUSY ahead
      of PR, it wakes up first, finds BLOCKED set and skips doing anything but
      clearing UPCONVERT_FINISHING (which was actually "meant" for the PR
      thread), and this time waits on BLOCKED.  Next, the PR thread comes out
      of wait but since UPCONVERT_FINISHING is not set, it skips updating the
      l_ro_holders and goes straight to wait on BLOCKED.  So there, we have a
      hang! Threads in __ocfs2_cluster_lock wait on BLOCKED, lock res in osb
      blocked list.  Only when dc thread is awoken, it will run
      ocfs2_unblock_lock and things will unhang.
      
      One way to fix this is to wake the dc thread on the flag after clearing
      UPCONVERT_FINISHING
      
      Orabug: 20933419
      Signed-off-by: default avatarTariq Saeed <tariq.x.saeed@oracle.com>
      Signed-off-by: default avatarSantosh Shilimkar <santosh.shilimkar@oracle.com>
      Reviewed-by: default avatarWengang Wang <wen.gang.wang@oracle.com>
      Reviewed-by: default avatarMark Fasheh <mfasheh@suse.de>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Junxiao Bi <junxiao.bi@oracle.com>
      Reviewed-by: default avatarJoseph Qi <joseph.qi@huawei.com>
      Cc: Eric Ren <zren@suse.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b1b1e15e
    • Sudip Mukherjee's avatar
      reiserfs: fix dereference of ERR_PTR · ff7d080e
      Sudip Mukherjee authored
      reiserfs_iget() returns either NULL or error code in ERR_PTR.  And we
      were only checking for NULL, so in case of some other error we will try
      to dereference the ERR_PTR(-errno) thinking it to be a valid pointer.
      Signed-off-by: default avatarSudip Mukherjee <sudip@vectorindia.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ff7d080e
    • Jaewon Kim's avatar
      ratelimit: fix bug in time interval by resetting right begin time · c2594bc3
      Jaewon Kim authored
      rs->begin in ratelimit is set in two cases.
       1) when rs->begin was not initialized
       2) when rs->interval was passed
      
      For case #2, current ratelimit sets the begin to 0.  This incurrs
      improper suppression.  The begin value will be set in the next ratelimit
      call by 1).  Then the time interval check will be always false, and
      rs->printed will not be initialized.  Although enough time passed,
      ratelimit may return 0 if rs->printed is not less than rs->burst.  To
      reset interval properly, begin should be jiffies rather than 0.
      
      For an example code below:
      
          static DEFINE_RATELIMIT_STATE(mylimit, 1, 1);
          for (i = 1; i <= 10; i++) {
              if (__ratelimit(&mylimit))
                  printk("ratelimit test count %d\n", i);
              msleep(3000);
          }
      
      test result in the current code shows suppression even there is 3 seconds sleep.
      
        [  78.391148] ratelimit test count 1
        [  81.295988] ratelimit test count 2
        [  87.315981] ratelimit test count 4
        [  93.336267] ratelimit test count 6
        [  99.356031] ratelimit test count 8
        [ 105.376367] ratelimit test count 10
      Signed-off-by: default avatarJaewon Kim <jaewon31.kim@samsung.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c2594bc3
    • yalin wang's avatar
      mm: fix kernel crash in khugepaged thread · 16fd0fe4
      yalin wang authored
      This crash is caused by NULL pointer deference, in page_to_pfn() marco,
      when page == NULL :
      
        Unable to handle kernel NULL pointer dereference at virtual address 00000000
        Internal error: Oops: 94000006 [#1] SMP
        Modules linked in:
        CPU: 1 PID: 26 Comm: khugepaged Tainted: G        W       4.3.0-rc6-next-20151022ajb-00001-g32f3386-dirty #3
        PC is at khugepaged+0x378/0x1af8
        LR is at khugepaged+0x418/0x1af8
        Process khugepaged (pid: 26, stack limit = 0xffffffc079638020)
        Call trace:
          khugepaged+0x378/0x1af8
          kthread+0xdc/0xf4
          ret_from_fork+0xc/0x40
        Code: 35001700 f0002c60 aa0703e3 f9009fa0 (f94000e0)
        ---[ end trace 637503d8e28ae69e  ]---
        Kernel panic - not syncing: Fatal exception
        CPU2: stopping
        CPU: 2 PID: 0 Comm: swapper/2 Tainted: G      D W       4.3.0-rc6-next-20151022ajb-00001-g32f3386-dirty #3
        Hardware name: linux,dummy-virt (DT)
      
      [akpm@linux-foundation.org: fix fat-fingered merge resolution]
      Signed-off-by: default avataryalin wang <yalin.wang2010@gmail.com>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Acked-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Acked-by: default avatarDavid Rientjes <rientjes@google.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      16fd0fe4
    • Kirill A. Shutemov's avatar
      mm: fix mlock accouting · 7162a1e8
      Kirill A. Shutemov authored
      Tetsuo Handa reported underflow of NR_MLOCK on munlock.
      
      Testcase:
      
          #include <stdio.h>
          #include <stdlib.h>
          #include <sys/mman.h>
      
          #define BASE ((void *)0x400000000000)
          #define SIZE (1UL << 21)
      
          int main(int argc, char *argv[])
          {
              void *addr;
      
              system("grep Mlocked /proc/meminfo");
              addr = mmap(BASE, SIZE, PROT_READ | PROT_WRITE,
                      MAP_ANONYMOUS | MAP_PRIVATE | MAP_LOCKED | MAP_FIXED,
                      -1, 0);
              if (addr == MAP_FAILED)
                  printf("mmap() failed\n"), exit(1);
              munmap(addr, SIZE);
              system("grep Mlocked /proc/meminfo");
              return 0;
          }
      
      It happens on munlock_vma_page() due to unfortunate choice of nr_pages
      data type:
      
          __mod_zone_page_state(zone, NR_MLOCK, -nr_pages);
      
      For unsigned int nr_pages, implicitly casted to long in
      __mod_zone_page_state(), it becomes something around UINT_MAX.
      
      munlock_vma_page() usually called for THP as small pages go though
      pagevec.
      
      Let's make nr_pages signed int.
      
      Similar fixes in 6cdb18ad ("mm/vmstat: fix overflow in
      mod_zone_page_state()") used `long' type, but `int' here is OK for a
      count of the number of sub-pages in a huge page.
      
      Fixes: ff6a6da6 ("mm: accelerate munlock() treatment of THP pages")
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Reported-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Tested-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: Michel Lespinasse <walken@google.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: <stable@vger.kernel.org>  [4.4+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7162a1e8
    • Kirill A. Shutemov's avatar
      thp: change pmd_trans_huge_lock() interface to return ptl · b6ec57f4
      Kirill A. Shutemov authored
      After THP refcounting rework we have only two possible return values
      from pmd_trans_huge_lock(): success and failure.  Return-by-pointer for
      ptl doesn't make much sense in this case.
      
      Let's convert pmd_trans_huge_lock() to return ptl on success and NULL on
      failure.
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Minchan Kim <minchan@kernel.org>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b6ec57f4
  3. 21 Jan, 2016 1 commit