Re: [PATCH] drm/i915: Unbind objects in shrinker only if device is runtime active

kbuild test robot
2015-12-25T02:23:51Z

[-- Attachment #1: Type: text/plain, Size: 5233 bytes --]

[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
Hi Praveen,

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on v4.4-rc6 next-20151223]

url: https://github.com/0day-ci/linux/commits/Praveen-Paneri/drm-i915-Unbind-objects-in-shrinker-only-if-device-is-runtime-active/20151224-183944
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-x001-201551 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All warnings (new ones prefixed by >>):

In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/uapi/linux/capability.h:16,
from include/linux/capability.h:15,
from include/linux/sched.h:15,
from include/linux/oom.h:5,
from drivers/gpu/drm/i915/i915_gem_shrinker.c:25:
drivers/gpu/drm/i915/i915_gem_shrinker.c: In function 'i915_gem_shrink':
drivers/gpu/drm/i915/i915_gem_shrinker.c:97:5: error: implicit declaration of function 'intel_runtime_pm_get_noidle' [-Werror=implicit-function-declaration]
!intel_runtime_pm_get_noidle(dev_priv))
^
include/linux/compiler.h:147:28: note: in definition of macro '__trace_if'
if (__builtin_constant_p((cond)) ? !!(cond) : \
^
>> drivers/gpu/drm/i915/i915_gem_shrinker.c:96:2: note: in expansion of macro 'if'
if ((flags & I915_SHRINK_BOUND) &&
^
cc1: some warnings being treated as errors

vim +/if +96 drivers/gpu/drm/i915/i915_gem_shrinker.c

19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 *
23 */
24
> 25 #include <linux/oom.h>
26 #include <linux/shmem_fs.h>
27 #include <linux/slab.h>
28 #include <linux/swap.h>
29 #include <linux/pci.h>
30 #include <linux/dma-buf.h>
31 #include <drm/drmP.h>
32 #include <drm/i915_drm.h>
33
34 #include "i915_drv.h"
35 #include "i915_trace.h"
36
37 static bool mutex_is_locked_by(struct mutex *mutex, struct task_struct *task)
38 {
39 if (!mutex_is_locked(mutex))
40 return false;
41
42 #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_MUTEXES)
43 return mutex->owner == task;
44 #else
45 /* Since UP may be pre-empted, we cannot assume that we own the lock */
46 return false;
47 #endif
48 }
49
50 /**
51 * i915_gem_shrink - Shrink buffer object caches
52 * @dev_priv: i915 device
53 * @target: amount of memory to make available, in pages
54 * @flags: control flags for selecting cache types
55 *
56 * This function is the main interface to the shrinker. It will try to release
57 * up to @target pages of main memory backing storage from buffer objects.
58 * Selection of the specific caches can be done with @flags. This is e.g. useful
59 * when purgeable objects should be removed from caches preferentially.
60 *
61 * Note that it's not guaranteed that released amount is actually available as
62 * free system memory - the pages might still be in-used to due to other reasons
63 * (like cpu mmaps) or the mm core has reused them before we could grab them.
64 * Therefore code that needs to explicitly shrink buffer objects caches (e.g. to
65 * avoid deadlocks in memory reclaim) must fall back to i915_gem_shrink_all().
66 *
67 * Also note that any kind of pinning (both per-vma address space pins and
68 * backing storage pins at the buffer object level) result in the shrinker code
69 * having to skip the object.
70 *
71 * Returns:
72 * The number of pages of backing storage actually released.
73 */
74 unsigned long
75 i915_gem_shrink(struct drm_i915_private *dev_priv,
76 unsigned long target, unsigned flags)
77 {
78 const struct {
79 struct list_head *list;
80 unsigned int bit;
81 } phases[] = {
82 { &dev_priv->mm.unbound_list, I915_SHRINK_UNBOUND },
83 { &dev_priv->mm.bound_list, I915_SHRINK_BOUND },
84 { NULL, 0 },
85 }, *phase;
86 unsigned long count = 0;
87
88 trace_i915_gem_shrink(dev_priv, target, flags);
89 i915_gem_retire_requests(dev_priv->dev);
90
91 /*
92 * Unbinding of objects will require HW access. Lets not wake
93 * up gfx device just for this. Do the unbinding only if gfx
94 * device is already active.
95 */
> 96 if ((flags & I915_SHRINK_BOUND) &&
97 !intel_runtime_pm_get_noidle(dev_priv))
98 flags &= ~I915_SHRINK_BOUND;
99

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 28518 bytes --]

[-- Attachment #3: Type: text/plain, Size: 159 bytes --]