1. 07 11月, 2015 1 次提交
    • M
      mm, page_alloc: distinguish between being unable to sleep, unwilling to sleep... · d0164adc
      Mel Gorman 提交于
      mm, page_alloc: distinguish between being unable to sleep, unwilling to sleep and avoiding waking kswapd
      
      __GFP_WAIT has been used to identify atomic context in callers that hold
      spinlocks or are in interrupts.  They are expected to be high priority and
      have access one of two watermarks lower than "min" which can be referred
      to as the "atomic reserve".  __GFP_HIGH users get access to the first
      lower watermark and can be called the "high priority reserve".
      
      Over time, callers had a requirement to not block when fallback options
      were available.  Some have abused __GFP_WAIT leading to a situation where
      an optimisitic allocation with a fallback option can access atomic
      reserves.
      
      This patch uses __GFP_ATOMIC to identify callers that are truely atomic,
      cannot sleep and have no alternative.  High priority users continue to use
      __GFP_HIGH.  __GFP_DIRECT_RECLAIM identifies callers that can sleep and
      are willing to enter direct reclaim.  __GFP_KSWAPD_RECLAIM to identify
      callers that want to wake kswapd for background reclaim.  __GFP_WAIT is
      redefined as a caller that is willing to enter direct reclaim and wake
      kswapd for background reclaim.
      
      This patch then converts a number of sites
      
      o __GFP_ATOMIC is used by callers that are high priority and have memory
        pools for those requests. GFP_ATOMIC uses this flag.
      
      o Callers that have a limited mempool to guarantee forward progress clear
        __GFP_DIRECT_RECLAIM but keep __GFP_KSWAPD_RECLAIM. bio allocations fall
        into this category where kswapd will still be woken but atomic reserves
        are not used as there is a one-entry mempool to guarantee progress.
      
      o Callers that are checking if they are non-blocking should use the
        helper gfpflags_allow_blocking() where possible. This is because
        checking for __GFP_WAIT as was done historically now can trigger false
        positives. Some exceptions like dm-crypt.c exist where the code intent
        is clearer if __GFP_DIRECT_RECLAIM is used instead of the helper due to
        flag manipulations.
      
      o Callers that built their own GFP flags instead of starting with GFP_KERNEL
        and friends now also need to specify __GFP_KSWAPD_RECLAIM.
      
      The first key hazard to watch out for is callers that removed __GFP_WAIT
      and was depending on access to atomic reserves for inconspicuous reasons.
      In some cases it may be appropriate for them to use __GFP_HIGH.
      
      The second key hazard is callers that assembled their own combination of
      GFP flags instead of starting with something like GFP_KERNEL.  They may
      now wish to specify __GFP_KSWAPD_RECLAIM.  It's almost certainly harmless
      if it's missed in most cases as other activity will wake kswapd.
      Signed-off-by: NMel Gorman <mgorman@techsingularity.net>
      Acked-by: NVlastimil Babka <vbabka@suse.cz>
      Acked-by: NMichal Hocko <mhocko@suse.com>
      Acked-by: NJohannes Weiner <hannes@cmpxchg.org>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Vitaly Wool <vitalywool@gmail.com>
      Cc: Rik van Riel <riel@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d0164adc
  2. 31 10月, 2015 2 次提交
  3. 29 10月, 2015 2 次提交
  4. 28 10月, 2015 1 次提交
  5. 23 10月, 2015 3 次提交
  6. 22 10月, 2015 3 次提交
  7. 20 10月, 2015 3 次提交
  8. 16 10月, 2015 1 次提交
    • A
      drm/virtio: use %llu format string form atomic64_t · d549f545
      Arnd Bergmann 提交于
      The virtgpu driver prints the last_seq variable using the %ld or
      %lu format string, which does not work correctly on all architectures
      and causes this compiler warning on ARM:
      
      drivers/gpu/drm/virtio/virtgpu_fence.c: In function 'virtio_timeline_value_str':
      drivers/gpu/drm/virtio/virtgpu_fence.c:64:22: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'long long int' [-Wformat=]
        snprintf(str, size, "%lu", atomic64_read(&fence->drv->last_seq));
                            ^
      drivers/gpu/drm/virtio/virtgpu_debugfs.c: In function 'virtio_gpu_debugfs_irq_info':
      drivers/gpu/drm/virtio/virtgpu_debugfs.c:37:16: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'long long int' [-Wformat=]
        seq_printf(m, "fence %ld %lld\n",
                      ^
      
      In order to avoid the warnings, this changes the format strings to %llu
      and adds a cast to u64, which makes it work the same way everywhere.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      d549f545
  9. 15 10月, 2015 4 次提交
  10. 14 10月, 2015 4 次提交
  11. 13 10月, 2015 6 次提交
  12. 12 10月, 2015 5 次提交
  13. 09 10月, 2015 2 次提交
    • D
      drm: Fix locking for sysfs dpms file · 621bd0f6
      Daniel Vetter 提交于
      With atomic drivers we need to make sure that (at least in general)
      property reads hold the right locks. But the legacy dpms property is
      special and can be read locklessly. Since userspace loves to just
      randomly look at that all the time (like with "status") do that.
      
      To make it clear that we play tricks use the READ_ONCE compiler
      barrier (and also for paranoia).
      
      Note that there's not really anything bad going on since even with the
      new atomic paths we eventually end up not chasing any pointers (and
      hence possibly freed memory and other fun stuff). The locking WARNING
      has been added in
      
      commit 88a48e29
      Author: Rob Clark <robdclark@gmail.com>
      Date:   Thu Dec 18 16:01:50 2014 -0500
      
          drm: add atomic properties
      
      but since drivers are converting not everyone will have seen this from
      the start.
      
      Jens reported this and submitted a patch to just grab the
      mode_config.connection_mutex, but we can do a bit better.
      
      v2: Remove unused variables I failed to git add for real.
      
      Reference: http://mid.gmane.org/20150928194822.GA3930@kernel.dkReported-by: NJens Axboe <axboe@fb.com>
      Tested-by: NJens Axboe <axboe@fb.com>
      Cc: Rob Clark <robdclark@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      621bd0f6
    • S
      drm/amdgpu: fix memory leak in amdgpu_vm_update_page_directory · 7a574557
      Sudip Mukherjee 提交于
      If amdgpu_ib_get() fails we returned the error code but we missed
      freeing ib.
      
      Cc: "Christian König" <christian.koenig@amd.com>
      Cc: Jammy Zhou <Jammy.Zhou@amd.com>
      Cc: Chunming Zhou <david1.zhou@amd.com>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: "monk.liu" <monk.liu@amd.com>
      Signed-off-by: NSudip Mukherjee <sudip@vectorindia.org>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      7a574557
  14. 07 10月, 2015 3 次提交
    • A
      drm/amdgpu: fix 32-bit compiler warning · 028423b0
      Arnd Bergmann 提交于
      The new amdgpu driver passes a user space pointer in a 64-bit structure
      member, which is the correct way to do it, but it attempts to
      directly cast it to a __user pointer in the kernel, which causes
      a warning in three places:
      
      drm/amd/amdgpu/amdgpu_cs.c: In function 'amdgpu_cs_parser_init':
      drm/amd/amdgpu/amdgpu_cs.c:180:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
        chunk_array_user = (uint64_t __user *)(cs->in.chunks);
      
      This changes all three to add an intermediate cast to 'unsigned long'
      as other drivers do. This avoids the warning and works correctly on
      both 32-bit and 64-bit architectures.
      
      Fixes: e60b344f ("drm/amdgpu: optimize amdgpu_parser_init")
      Reviewed-by: NChristian König <christian.koenig@amd.com>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      028423b0
    • F
      drm/qxl: avoid dependency lock · 266424b5
      Frediano Ziglio 提交于
      qxl_bo_unref calls drm_gem_object_unreference_unlocked which
      locks dev->struct_mutex. However this lock could be already
      locked if the call came from qxl_gem_object_free.
      As we don't need to call qxl_bo_ref/qxl_bo_unref cause
      qxl_release_list_add will hold a reference by itself avoid
      to call them and the possible deadlock.
      Signed-off-by: NFrediano Ziglio <fziglio@redhat.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      266424b5
    • F
      drm/qxl: avoid buffer reservation in qxl_crtc_page_flip · 7eb9974f
      Frediano Ziglio 提交于
      This avoid a dependency lock error.
      According to https://lwn.net/Articles/548909/ users of WW mutex API
      should avoid using different context.
      When a buffer is reserved with qxl_bo_reserve a ww_mutex_lock without
      context is used. However during qxl_draw_dirty_fb different locks
      with specific context are used.
      This is detected during a machine booting with a debug kernel with lock
      dependency checking enabled.
      Like many other function in this file to avoid this problem object
      pinning is used. Once the object is pinned is not necessary to keep
      the lock so it can be released avoiding the locking problem.
      Signed-off-by: NFrediano Ziglio <fziglio@redhat.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      7eb9974f