Hi Chris, Thank you for the patch! Yet something to improve: [auto build test ERROR on drm-intel/for-linux-next] [also build test ERROR on v5.0-rc1 next-20190108] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Chris-Wilson/drm-i915-Track-all-held-rpm-wakerefs/20190108-233439 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: x86_64-randconfig-s5-01090236 (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All errors (new ones prefixed by >>): drivers/gpu/drm/i915/intel_runtime_pm.o: In function `__print_intel_runtime_pm_wakeref': >> drivers/gpu/drm/i915/intel_runtime_pm.c:154: undefined reference to `depot_fetch_stack' >> drivers/gpu/drm/i915/intel_runtime_pm.c:154: undefined reference to `depot_fetch_stack' >> drivers/gpu/drm/i915/intel_runtime_pm.c:154: undefined reference to `depot_fetch_stack' >> drivers/gpu/drm/i915/intel_runtime_pm.c:154: undefined reference to `depot_fetch_stack' drivers/gpu/drm/i915/intel_runtime_pm.o: In function `track_intel_runtime_pm_wakeref': >> drivers/gpu/drm/i915/intel_runtime_pm.c:86: undefined reference to `depot_save_stack' vim +154 drivers/gpu/drm/i915/intel_runtime_pm.c 64 65 static noinline void 66 track_intel_runtime_pm_wakeref(struct drm_i915_private *i915) 67 { 68 struct i915_runtime_pm *rpm = &i915->runtime_pm; 69 unsigned long entries[STACKDEPTH]; 70 struct stack_trace trace = { 71 .entries = entries, 72 .max_entries = ARRAY_SIZE(entries), 73 .skip = 0 /* gcc is ignoring noinline for tail calls? */ 74 }; 75 unsigned long flags; 76 depot_stack_handle_t stack, *stacks; 77 78 if (!HAS_RUNTIME_PM(i915)) 79 return; 80 81 save_stack_trace(&trace); 82 if (trace.nr_entries && 83 trace.entries[trace.nr_entries - 1] == ULONG_MAX) 84 trace.nr_entries--; 85 > 86 stack = depot_save_stack(&trace, GFP_NOWAIT | __GFP_NOWARN); 87 if (!stack) 88 return; 89 90 spin_lock_irqsave(&rpm->debug_lock, flags); 91 stacks = krealloc(rpm->debug_owners, 92 (rpm->debug_count + 1) * sizeof(*stacks), 93 GFP_NOWAIT | __GFP_NOWARN); 94 if (stacks) { 95 stacks[rpm->debug_count++] = stack; 96 rpm->debug_owners = stacks; 97 } 98 spin_unlock_irqrestore(&rpm->debug_lock, flags); 99 } 100 101 static void untrack_intel_runtime_pm_wakeref(struct drm_i915_private *i915) 102 { 103 struct i915_runtime_pm *rpm = &i915->runtime_pm; 104 depot_stack_handle_t *stacks; 105 unsigned long flags; 106 107 spin_lock_irqsave(&rpm->debug_lock, flags); 108 stacks = fetch_and_zero(&rpm->debug_owners); 109 rpm->debug_count = 0; 110 spin_unlock_irqrestore(&rpm->debug_lock, flags); 111 112 kfree(stacks); 113 } 114 115 static int cmphandle(const void *_a, const void *_b) 116 { 117 const depot_stack_handle_t * const a = _a, * const b = _b; 118 119 if (*a < *b) 120 return -1; 121 else if (*a > *b) 122 return 1; 123 else 124 return 0; 125 } 126 127 static void __print_intel_runtime_pm_wakeref(struct drm_printer *p, 128 depot_stack_handle_t *stacks, 129 unsigned long count) 130 { 131 unsigned long entries[STACKDEPTH]; 132 unsigned long i; 133 char *buf; 134 135 drm_printf(p, "Wakeref count: %lu\n", count); 136 137 buf = kmalloc(PAGE_SIZE, GFP_KERNEL); 138 if (!buf) 139 return; 140 141 sort(stacks, count, sizeof(*stacks), cmphandle, NULL); 142 143 for (i = 0; i < count; i++) { 144 struct stack_trace trace = { 145 .entries = entries, 146 .max_entries = ARRAY_SIZE(entries), 147 }; 148 depot_stack_handle_t stack = stacks[i]; 149 unsigned long rep; 150 151 rep = 1; 152 while (i + 1 < count && stacks[i + 1] == stack) 153 rep++, i++; > 154 depot_fetch_stack(stack, &trace); 155 snprint_stack_trace(buf, PAGE_SIZE, &trace, 2); 156 drm_printf(p, "Wakeref x%lu taken at:\n%s", rep, buf); 157 } 158 159 kfree(buf); 160 } 161 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation