1. 06 5月, 2016 1 次提交
    • A
      mm: thp: kvm: fix memory corruption in KVM with THP enabled · 127393fb
      Andrea Arcangeli 提交于
      After the THP refcounting change, obtaining a compound pages from
      get_user_pages() no longer allows us to assume the entire compound page
      is immediately mappable from a secondary MMU.
      
      A secondary MMU doesn't want to call get_user_pages() more than once for
      each compound page, in order to know if it can map the whole compound
      page.  So a secondary MMU needs to know from a single get_user_pages()
      invocation when it can map immediately the entire compound page to avoid
      a flood of unnecessary secondary MMU faults and spurious
      atomic_inc()/atomic_dec() (pages don't have to be pinned by MMU notifier
      users).
      
      Ideally instead of the page->_mapcount < 1 check, get_user_pages()
      should return the granularity of the "page" mapping in the "mm" passed
      to get_user_pages().  However it's non trivial change to pass the "pmd"
      status belonging to the "mm" walked by get_user_pages up the stack (up
      to the caller of get_user_pages).  So the fix just checks if there is
      not a single pte mapping on the page returned by get_user_pages, and in
      turn if the caller can assume that the whole compound page is mapped in
      the current "mm" (in a pmd_trans_huge()).  In such case the entire
      compound page is safe to map into the secondary MMU without additional
      get_user_pages() calls on the surrounding tail/head pages.  In addition
      of being faster, not having to run other get_user_pages() calls also
      reduces the memory footprint of the secondary MMU fault in case the pmd
      split happened as result of memory pressure.
      
      Without this fix after a MADV_DONTNEED (like invoked by QEMU during
      postcopy live migration or balloning) or after generic swapping (with a
      failure in split_huge_page() that would only result in pmd splitting and
      not a physical page split), KVM would map the whole compound page into
      the shadow pagetables, despite regular faults or userfaults (like
      UFFDIO_COPY) may map regular pages into the primary MMU as result of the
      pte faults, leading to the guest mode and userland mode going out of
      sync and not working on the same memory at all times.
      
      Any other secondary MMU notifier manager (KVM is just one of the many
      MMU notifier users) will need the same information if it doesn't want to
      run a flood of get_user_pages_fast and it can support multiple
      granularity in the secondary MMU mappings, so I think it is justified to
      be exposed not just to KVM.
      
      The other option would be to move transparent_hugepage_adjust to
      mm/huge_memory.c but that currently has all kind of KVM data structures
      in it, so it's definitely not a cut-and-paste work, so I couldn't do a
      fix as cleaner as this one for 4.6.
      Signed-off-by: NAndrea Arcangeli <aarcange@redhat.com>
      Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
      Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
      Cc: "Li, Liang Z" <liang.z.li@intel.com>
      Cc: Amit Shah <amit.shah@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      127393fb
  2. 20 4月, 2016 5 次提交
  3. 19 4月, 2016 1 次提交
  4. 15 4月, 2016 1 次提交
  5. 14 4月, 2016 4 次提交
  6. 13 4月, 2016 3 次提交
  7. 11 4月, 2016 1 次提交
    • K
      ARM: DRA7: clockdomain: Implement timer workaround for errata i874 · 1cbabcb9
      Keerthy 提交于
      Errata Title:
      i874: TIMER5/6/7/8 interrupts not propagated
      
      Description:
      When TIMER5, TIMER6, TIMER7, or TIMER8 clocks are enabled
      (CM_IPU_TIMER5/6/7/8_CLKCTRL[0:1]MODULEMODE=0x2:ENABLE) and the CD-IPU
      is in HW_AUTO mode (CM_IPU_CLKSTCTRL[0:1]CLKTRCTRL=0x3:HW_AUTO) the
      corresponding TIMER will continue counting, but enabled interrupts
      will not be propagated to the destinations (MPU, DSP, etc) in the
      SoC until the TIMER registers are accessed from the CPUs (MPU, DSP
      etc.). This can result in missed timer interrupts.
      
      Workaround:
      In order for TIMER5/6/7/8 interrupts to be propagated and serviced
      correctly the CD_IPU domain should be set to SW_WKUP mode
      (CM_IPU_CLKSTCTRL[0:1]CLKTRCTRL=0x2:SW_WKUP).
      
      The above workaround is achieved by switching the IPU clockdomain
      flags from HWSUP_SWSUP to SWSUP only.
      Signed-off-by: NKeerthy <j-keerthy@ti.com>
      Signed-off-by: NSuman Anna <s-anna@ti.com>
      Signed-off-by: NPaul Walmsley <paul@pwsan.com>
      1cbabcb9
  8. 09 4月, 2016 2 次提交
  9. 08 4月, 2016 4 次提交
    • N
      ARM: OMAP: DRA7: Provide proper class to omap2_set_globals_tap · ec490f6f
      Nishanth Menon 提交于
      When commit 06c2d368 ("ARM: OMAP: DRA7: Make use of omap_revision
      information for soc_is* calls") introduced SoC check using
      omap_revision, it missed providing DRA7 as class for initializing
      the omap_version variable. Without doing this, soc_is_dra7xx() will
      fail and as a result, omap4_pm_init_early never initializes the dra7
      erratum for CPU power state. This causes the suspend path to fail
      on DRA7 devices.
      
      Fixes: 06c2d368 ("ARM: OMAP: DRA7: Make use of omap_revision information for soc_is* calls")
      Signed-off-by: NNishanth Menon <nm@ti.com>
      Tested-by: NKeerthy <j-keerthy@ti.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      ec490f6f
    • N
      ARM: OMAP: DRA7: wakeupgen: Skip SAR save for wakeupgen · c783e6fd
      Nishanth Menon 提交于
      DRA7 has no SAR region for automated save and restore of wakeupgen,
      which does not make real since the SoC really does not do legacy OFF
      mode anymore. Further wakeupgen should never loose context in CSWR
      retention mode for MPU domain on DRA7 since that is the deepest state
      we will enter.
      
      So, just skip, instead of oopsing as follows while attemptint to enter
      suspend on BeagleBoard-X15.
      [   55.589771] Unable to handle kernel paging request at virtual address 00002684
      [   55.589771] pgd = ec69c000
      [...]
      [   55.589771] [<c0123cc8>] (irq_notifier) from [<c015ad70>] (notifier_call_chain+0x4c/0x8c)
      [   55.589771] [<c015ad70>] (notifier_call_chain) from [<c021469c>] (cpu_cluster_pm_enter+0x2c/0x78)
      [   55.589771] [<c021469c>] (cpu_cluster_pm_enter) from [<c0514508>] (syscore_suspend+0xb8/0x31c)
      [   55.589771] [<c0514508>] (syscore_suspend) from [<c0197d24>] (suspend_devices_and_enter+0x308/0x9e4)
      [   55.589771] [<c0197d24>] (suspend_devices_and_enter) from [<c0198a40>] (pm_suspend+0x640/0x75c)
      [   55.589771] [<c0198a40>] (pm_suspend) from [<c0196bcc>] (state_store+0x64/0xb8)
      [   55.589771] [<c0196bcc>] (state_store) from [<c0307914>] (kernfs_fop_write+0xc0/0x1bc)
      [   55.589771] [<c0307914>] (kernfs_fop_write) from [<c028ac80>] (__vfs_write+0x1c/0xd8)
      [   55.589771] [<c028ac80>] (__vfs_write) from [<c028bb70>] (vfs_write+0x90/0x16c)
      [   55.589771] [<c028bb70>] (vfs_write) from [<c028c890>] (SyS_write+0x44/0x9c)
      [   55.589771] [<c028c890>] (SyS_write) from [<c0107840>] (ret_fast_syscall+0x0/0x1c)
      [...]
      Signed-off-by: NNishanth Menon <nm@ti.com>
      Tested-by: NKeerthy <j-keerthy@ti.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      c783e6fd
    • N
      ARM: 8550/1: protect idiv patching against undefined gcc behavior · 208fae5c
      Nicolas Pitre 提交于
      It was reported that a kernel with CONFIG_ARM_PATCH_IDIV=y stopped
      booting when compiled with the upcoming gcc 6.  Turns out that turning
      a function address into a writable array is undefined and gcc 6 decided
      it was OK to omit the store to the first word of the function while
      still preserving the store to the second word.
      
      Even though gcc 6 is now fixed to behave more coherently, it is a
      mystery that gcc 4 and gcc 5 actually produce wanted code in the kernel.
      And in fact the reduced test case to illustrate the issue does indeed
      break with gcc < 6 as well.
      
      In any case, let's guard the kernel against undefined compiler behavior
      by hiding the nature of the array location as suggested by gcc
      developers.
      
      Reference: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70128Signed-off-by: NNicolas Pitre <nico@linaro.org>
      Reported-by: NMarcin Juszkiewicz <mjuszkiewicz@redhat.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: stable@vger.kernel.org # v4.5
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      208fae5c
    • R
      ARM: wire up preadv2 and pwritev2 syscalls · f2335a2a
      Russell King 提交于
      Wire up the preadv2 and pwritev2 syscalls for ARM.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      f2335a2a
  10. 06 4月, 2016 1 次提交
  11. 05 4月, 2016 1 次提交
    • K
      mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros · 09cbfeaf
      Kirill A. Shutemov 提交于
      PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
      ago with promise that one day it will be possible to implement page
      cache with bigger chunks than PAGE_SIZE.
      
      This promise never materialized.  And unlikely will.
      
      We have many places where PAGE_CACHE_SIZE assumed to be equal to
      PAGE_SIZE.  And it's constant source of confusion on whether
      PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
      especially on the border between fs and mm.
      
      Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
      breakage to be doable.
      
      Let's stop pretending that pages in page cache are special.  They are
      not.
      
      The changes are pretty straight-forward:
      
       - <foo> << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
      
       - <foo> >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
      
       - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};
      
       - page_cache_get() -> get_page();
      
       - page_cache_release() -> put_page();
      
      This patch contains automated changes generated with coccinelle using
      script below.  For some reason, coccinelle doesn't patch header files.
      I've called spatch for them manually.
      
      The only adjustment after coccinelle is revert of changes to
      PAGE_CAHCE_ALIGN definition: we are going to drop it later.
      
      There are few places in the code where coccinelle didn't reach.  I'll
      fix them manually in a separate patch.  Comments and documentation also
      will be addressed with the separate patch.
      
      virtual patch
      
      @@
      expression E;
      @@
      - E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
      + E
      
      @@
      expression E;
      @@
      - E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
      + E
      
      @@
      @@
      - PAGE_CACHE_SHIFT
      + PAGE_SHIFT
      
      @@
      @@
      - PAGE_CACHE_SIZE
      + PAGE_SIZE
      
      @@
      @@
      - PAGE_CACHE_MASK
      + PAGE_MASK
      
      @@
      expression E;
      @@
      - PAGE_CACHE_ALIGN(E)
      + PAGE_ALIGN(E)
      
      @@
      expression E;
      @@
      - page_cache_get(E)
      + get_page(E)
      
      @@
      expression E;
      @@
      - page_cache_release(E)
      + put_page(E)
      Signed-off-by: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Acked-by: NMichal Hocko <mhocko@suse.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      09cbfeaf
  12. 03 4月, 2016 2 次提交
  13. 02 4月, 2016 1 次提交
    • R
      ARM: SMP enable of cache maintanence broadcast · 0fc03d4c
      Russell King 提交于
      Masahiro Yamada reports that we can fail to set the FW bit in the
      auxiliary control register, which enables broadcasting the cache
      maintanence operations.  This occurs because we only check that the
      SMP/nAMP bit is set, rather than checking whether all the bits we
      want to be set are set.
      
      Rearrange the code to ensure that all desired bits are set, and only
      update the register if we discover some required bits are not set.
      Tested-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      0fc03d4c
  14. 31 3月, 2016 8 次提交
  15. 30 3月, 2016 3 次提交
  16. 27 3月, 2016 1 次提交
    • L
      ARM: OMAP2+: hwmod: Fix updating of sysconfig register · 3ca4a238
      Lokesh Vutla 提交于
      Commit 127500cc ("ARM: OMAP2+: Only write the sysconfig on idle
      when necessary") talks about verification of sysconfig cache value before
      updating it, only during idle path. But the patch is adding the
      verification in the enable path. So, adding the check in a proper place
      as per the commit description.
      
      Not keeping this check during enable path as there is a chance of losing
      context and it is safe to do on idle as the context of the register will
      never be lost while the device is active.
      Signed-off-by: NLokesh Vutla <lokeshvutla@ti.com>
      Acked-by: NTero Kristo <t-kristo@ti.com>
      Cc: Jon Hunter <jonathanh@nvidia.com>
      Cc: <stable@vger.kernel.org> # 3.12+
      Fixes: commit 127500cc "ARM: OMAP2+: Only write the sysconfig on idle when necessary"
      [paul@pwsan.com: appears to have been caused by my own mismerge of the
       originally posted patch]
      Signed-off-by: NPaul Walmsley <paul@pwsan.com>
      3ca4a238
  17. 26 3月, 2016 1 次提交