Hi Chris,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on v5.9 next-20201016]
[cannot apply to drm-tip/drm-tip]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url:
https://github.com/0day-ci/linux/commits/Chris-Wilson/drm-i915-gem-Poison...
base:
git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-s001-20201020 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-dirty
#
https://github.com/0day-ci/linux/commit/93c29b1ae3354ce7e031c46913550703c...
git remote add linux-review
https://github.com/0day-ci/linux
git fetch --no-tags linux-review
Chris-Wilson/drm-i915-gem-Poison-stolen-pages-before-use/20201020-005212
git checkout 93c29b1ae3354ce7e031c46913550703c25af3e7
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
"sparse warnings: (new ones prefixed by >>)"
drivers/gpu/drm/i915/gt/intel_reset.c: note: in included file:
> drivers/gpu/drm/i915/gt/selftest_reset.c:98:34: sparse: sparse:
incorrect type in argument 1 (different address spaces) @@ expected unsigned int
[usertype] *s @@ got void [noderef] __iomem *[assigned] s @@
> drivers/gpu/drm/i915/gt/selftest_reset.c:98:34: sparse: expected unsigned int
[usertype] *s
> drivers/gpu/drm/i915/gt/selftest_reset.c:98:34: sparse: got void [noderef]
__iomem *[assigned] s
> drivers/gpu/drm/i915/gt/selftest_reset.c:100:20: sparse: sparse: incorrect type in
assignment (different address spaces) @@ expected void *in @@ got void [noderef]
__iomem *[assigned] s @@
> drivers/gpu/drm/i915/gt/selftest_reset.c:100:20: sparse: expected void *in
drivers/gpu/drm/i915/gt/selftest_reset.c:100:20: sparse: got void [noderef] __iomem
*[assigned] s
> drivers/gpu/drm/i915/gt/selftest_reset.c:101:46: sparse: sparse:
incorrect type in argument 2 (different address spaces) @@ expected void const *src @@
got void [noderef] __iomem *[assigned] s @@
> drivers/gpu/drm/i915/gt/selftest_reset.c:101:46: sparse: expected void const *src
drivers/gpu/drm/i915/gt/selftest_reset.c:101:46: sparse: got void [noderef]
__iomem *[assigned] s
drivers/gpu/drm/i915/gt/selftest_reset.c:136:20: sparse: sparse: incorrect type in
assignment (different address spaces) @@ expected void *in @@ got void [noderef]
__iomem *[assigned] s @@
drivers/gpu/drm/i915/gt/selftest_reset.c:136:20: sparse: expected void *in
drivers/gpu/drm/i915/gt/selftest_reset.c:136:20: sparse: got void [noderef] __iomem
*[assigned] s
drivers/gpu/drm/i915/gt/selftest_reset.c:137:46: sparse: sparse: incorrect type in
argument 2 (different address spaces) @@ expected void const *src @@ got void
[noderef] __iomem *[assigned] s @@
drivers/gpu/drm/i915/gt/selftest_reset.c:137:46: sparse: expected void const *src
drivers/gpu/drm/i915/gt/selftest_reset.c:137:46: sparse: got void [noderef] __iomem
*[assigned] s
drivers/gpu/drm/i915/gt/intel_reset.c:1311:5: sparse: sparse: context imbalance in
'intel_gt_reset_trylock' - different lock contexts for basic block
vim +98 drivers/gpu/drm/i915/gt/selftest_reset.c
15
16 static int
17 __igt_reset_stolen(struct intel_gt *gt,
18 intel_engine_mask_t mask,
19 const char *msg)
20 {
21 struct i915_ggtt *ggtt = >->i915->ggtt;
22 const struct resource *dsm = >->i915->dsm;
23 resource_size_t num_pages, page;
24 struct intel_engine_cs *engine;
25 intel_wakeref_t wakeref;
26 enum intel_engine_id id;
27 struct igt_spinner spin;
28 long max, count;
29 void *tmp;
30 u32 *crc;
31 int err;
32
33 if (!drm_mm_node_allocated(&ggtt->error_capture))
34 return 0;
35
36 num_pages = resource_size(dsm) >> PAGE_SHIFT;
37 if (!num_pages)
38 return 0;
39
40 crc = kmalloc_array(num_pages, sizeof(u32), GFP_KERNEL);
41 if (!crc)
42 return -ENOMEM;
43
44 tmp = kmalloc(PAGE_SIZE, GFP_KERNEL);
45 if (!tmp) {
46 err = -ENOMEM;
47 goto err_crc;
48 }
49
50 igt_global_reset_lock(gt);
51 wakeref = intel_runtime_pm_get(gt->uncore->rpm);
52
53 err = igt_spinner_init(&spin, gt);
54 if (err)
55 goto err_lock;
56
57 for_each_engine(engine, gt, id) {
58 struct intel_context *ce;
59 struct i915_request *rq;
60
61 if (!(mask & engine->mask))
62 continue;
63
64 if (!intel_engine_can_store_dword(engine))
65 continue;
66
67 ce = intel_context_create(engine);
68 if (IS_ERR(ce)) {
69 err = PTR_ERR(ce);
70 goto err_spin;
71 }
72 rq = igt_spinner_create_request(&spin, ce, MI_ARB_CHECK);
73 intel_context_put(ce);
74 if (IS_ERR(rq)) {
75 err = PTR_ERR(rq);
76 goto err_spin;
77 }
78 i915_request_add(rq);
79 }
80
81 for (page = 0; page < num_pages; page++) {
82 dma_addr_t dma = (dma_addr_t)dsm->start + (page << PAGE_SHIFT);
83 void __iomem *s;
84 void *in;
85
86 ggtt->vm.insert_page(&ggtt->vm, dma,
87 ggtt->error_capture.start,
88 I915_CACHE_NONE, 0);
89 mb();
90
91 s = io_mapping_map_wc(&ggtt->iomap,
92 ggtt->error_capture.start,
93 PAGE_SIZE);
94
95 if (!__drm_mm_interval_first(>->i915->mm.stolen,
96 page << PAGE_SHIFT,
97 ((page + 1) << PAGE_SHIFT) - 1))
98 memset32(s, STACK_MAGIC, PAGE_SIZE / sizeof(u32));
99
100 in = s;
101 if (i915_memcpy_from_wc(tmp, s, PAGE_SIZE))
102 in = tmp;
103 crc[page] = crc32_le(0, in, PAGE_SIZE);
104
105 io_mapping_unmap(s);
106 }
107 mb();
108 ggtt->vm.clear_range(&ggtt->vm, ggtt->error_capture.start,
PAGE_SIZE);
109
110 if (mask == ALL_ENGINES) {
111 intel_gt_reset(gt, mask, NULL);
112 } else {
113 for_each_engine(engine, gt, id) {
114 if (mask & engine->mask)
115 intel_engine_reset(engine, NULL);
116 }
117 }
118
119 max = -1;
120 count = 0;
121 for (page = 0; page < num_pages; page++) {
122 dma_addr_t dma = (dma_addr_t)dsm->start + (page << PAGE_SHIFT);
123 void __iomem *s;
124 void *in;
125 u32 x;
126
127 ggtt->vm.insert_page(&ggtt->vm, dma,
128 ggtt->error_capture.start,
129 I915_CACHE_NONE, 0);
130 mb();
131
132 s = io_mapping_map_wc(&ggtt->iomap,
133 ggtt->error_capture.start,
134 PAGE_SIZE);
135
136 in = s;
137 if (i915_memcpy_from_wc(tmp, s, PAGE_SIZE))
138 in = tmp;
139 x = crc32_le(0, in, PAGE_SIZE);
140
141 if (x != crc[page] &&
142 !__drm_mm_interval_first(>->i915->mm.stolen,
143 page << PAGE_SHIFT,
144 ((page + 1) << PAGE_SHIFT) - 1)) {
145 pr_debug("unused stolen page %pa modified by GPU reset\n",
146 &page);
147 if (count++ == 0)
148 igt_hexdump(in, PAGE_SIZE);
149 max = page;
150 }
151
152 io_mapping_unmap(s);
153 }
154 mb();
155 ggtt->vm.clear_range(&ggtt->vm, ggtt->error_capture.start,
PAGE_SIZE);
156
157 if (count > 0) {
158 pr_info("%s reset clobbered %ld pages of stolen, last clobber at page
%ld\n",
159 msg, count, max);
160 }
161 if (max >= I915_GEM_STOLEN_BIAS >> PAGE_SHIFT) {
162 pr_err("%s reset clobbered unreserved area [above %x] of stolen; may cause
severe faults\n",
163 msg, I915_GEM_STOLEN_BIAS);
164 err = -EINVAL;
165 }
166
167 err_spin:
168 igt_spinner_fini(&spin);
169
170 err_lock:
171 intel_runtime_pm_put(gt->uncore->rpm, wakeref);
172 igt_global_reset_unlock(gt);
173
174 kfree(tmp);
175 err_crc:
176 kfree(crc);
177 return err;
178 }
179
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org