From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: drivers/gpu/drm/xe/tests/xe_migrate.c:224 xe_migrate_sanity_test() warn: passing zero to 'PTR_ERR'
Date: Tue, 30 Jan 2024 21:46:43 +0800 [thread overview]
Message-ID: <202401302106.gPIPs6Ge-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Matthew Brost <matthew.brost@intel.com>
CC: Rodrigo Vivi <rodrigo.vivi@intel.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 861c0981648f5b64c86fd028ee622096eb7af05a
commit: dd08ebf6c3525a7ea2186e636df064ea47281987 drm/xe: Introduce a new DRM driver for Intel GPUs
date: 7 weeks ago
:::::: branch date: 11 hours ago
:::::: commit date: 7 weeks ago
config: sparc-randconfig-r081-20240128 (https://download.01.org/0day-ci/archive/20240130/202401302106.gPIPs6Ge-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 13.2.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202401302106.gPIPs6Ge-lkp@intel.com/
New smatch warnings:
drivers/gpu/drm/xe/tests/xe_migrate.c:224 xe_migrate_sanity_test() warn: passing zero to 'PTR_ERR'
Old smatch warnings:
drivers/gpu/drm/xe/xe_migrate.c:646 xe_migrate_copy() error: uninitialized symbol 'ccs_ofs'.
drivers/gpu/drm/xe/tests/xe_migrate.c:254 xe_migrate_sanity_test() warn: passing zero to 'PTR_ERR'
vim +/PTR_ERR +224 drivers/gpu/drm/xe/tests/xe_migrate.c
dd08ebf6c3525a Matthew Brost 2023-03-30 209
dd08ebf6c3525a Matthew Brost 2023-03-30 210 static void xe_migrate_sanity_test(struct xe_migrate *m, struct kunit *test)
dd08ebf6c3525a Matthew Brost 2023-03-30 211 {
dd08ebf6c3525a Matthew Brost 2023-03-30 212 struct xe_gt *gt = m->gt;
dd08ebf6c3525a Matthew Brost 2023-03-30 213 struct xe_device *xe = gt_to_xe(gt);
dd08ebf6c3525a Matthew Brost 2023-03-30 214 struct xe_bo *pt, *bo = m->pt_bo, *big, *tiny;
dd08ebf6c3525a Matthew Brost 2023-03-30 215 struct xe_res_cursor src_it;
dd08ebf6c3525a Matthew Brost 2023-03-30 216 struct dma_fence *fence;
dd08ebf6c3525a Matthew Brost 2023-03-30 217 u64 retval, expected;
dd08ebf6c3525a Matthew Brost 2023-03-30 218 struct xe_bb *bb;
dd08ebf6c3525a Matthew Brost 2023-03-30 219 int err;
dd08ebf6c3525a Matthew Brost 2023-03-30 220 u8 id = gt->info.id;
dd08ebf6c3525a Matthew Brost 2023-03-30 221
dd08ebf6c3525a Matthew Brost 2023-03-30 222 err = xe_bo_vmap(bo);
dd08ebf6c3525a Matthew Brost 2023-03-30 223 if (err) {
dd08ebf6c3525a Matthew Brost 2023-03-30 @224 KUNIT_FAIL(test, "Failed to vmap our pagetables: %li\n",
dd08ebf6c3525a Matthew Brost 2023-03-30 225 PTR_ERR(bo));
dd08ebf6c3525a Matthew Brost 2023-03-30 226 return;
dd08ebf6c3525a Matthew Brost 2023-03-30 227 }
dd08ebf6c3525a Matthew Brost 2023-03-30 228
dd08ebf6c3525a Matthew Brost 2023-03-30 229 big = xe_bo_create_pin_map(xe, m->gt, m->eng->vm, SZ_4M,
dd08ebf6c3525a Matthew Brost 2023-03-30 230 ttm_bo_type_kernel,
dd08ebf6c3525a Matthew Brost 2023-03-30 231 XE_BO_CREATE_VRAM_IF_DGFX(m->gt) |
dd08ebf6c3525a Matthew Brost 2023-03-30 232 XE_BO_CREATE_PINNED_BIT);
dd08ebf6c3525a Matthew Brost 2023-03-30 233 if (IS_ERR(big)) {
dd08ebf6c3525a Matthew Brost 2023-03-30 234 KUNIT_FAIL(test, "Failed to allocate bo: %li\n", PTR_ERR(big));
dd08ebf6c3525a Matthew Brost 2023-03-30 235 goto vunmap;
dd08ebf6c3525a Matthew Brost 2023-03-30 236 }
dd08ebf6c3525a Matthew Brost 2023-03-30 237
dd08ebf6c3525a Matthew Brost 2023-03-30 238 pt = xe_bo_create_pin_map(xe, m->gt, m->eng->vm, GEN8_PAGE_SIZE,
dd08ebf6c3525a Matthew Brost 2023-03-30 239 ttm_bo_type_kernel,
dd08ebf6c3525a Matthew Brost 2023-03-30 240 XE_BO_CREATE_VRAM_IF_DGFX(m->gt) |
dd08ebf6c3525a Matthew Brost 2023-03-30 241 XE_BO_CREATE_PINNED_BIT);
dd08ebf6c3525a Matthew Brost 2023-03-30 242 if (IS_ERR(pt)) {
dd08ebf6c3525a Matthew Brost 2023-03-30 243 KUNIT_FAIL(test, "Failed to allocate fake pt: %li\n",
dd08ebf6c3525a Matthew Brost 2023-03-30 244 PTR_ERR(pt));
dd08ebf6c3525a Matthew Brost 2023-03-30 245 goto free_big;
dd08ebf6c3525a Matthew Brost 2023-03-30 246 }
dd08ebf6c3525a Matthew Brost 2023-03-30 247
dd08ebf6c3525a Matthew Brost 2023-03-30 248 tiny = xe_bo_create_pin_map(xe, m->gt, m->eng->vm,
dd08ebf6c3525a Matthew Brost 2023-03-30 249 2 * SZ_4K,
dd08ebf6c3525a Matthew Brost 2023-03-30 250 ttm_bo_type_kernel,
dd08ebf6c3525a Matthew Brost 2023-03-30 251 XE_BO_CREATE_VRAM_IF_DGFX(m->gt) |
dd08ebf6c3525a Matthew Brost 2023-03-30 252 XE_BO_CREATE_PINNED_BIT);
dd08ebf6c3525a Matthew Brost 2023-03-30 253 if (IS_ERR(tiny)) {
dd08ebf6c3525a Matthew Brost 2023-03-30 254 KUNIT_FAIL(test, "Failed to allocate fake pt: %li\n",
dd08ebf6c3525a Matthew Brost 2023-03-30 255 PTR_ERR(pt));
dd08ebf6c3525a Matthew Brost 2023-03-30 256 goto free_pt;
dd08ebf6c3525a Matthew Brost 2023-03-30 257 }
dd08ebf6c3525a Matthew Brost 2023-03-30 258
dd08ebf6c3525a Matthew Brost 2023-03-30 259 bb = xe_bb_new(m->gt, 32, xe->info.supports_usm);
dd08ebf6c3525a Matthew Brost 2023-03-30 260 if (IS_ERR(bb)) {
dd08ebf6c3525a Matthew Brost 2023-03-30 261 KUNIT_FAIL(test, "Failed to create batchbuffer: %li\n",
dd08ebf6c3525a Matthew Brost 2023-03-30 262 PTR_ERR(bb));
dd08ebf6c3525a Matthew Brost 2023-03-30 263 goto free_tiny;
dd08ebf6c3525a Matthew Brost 2023-03-30 264 }
dd08ebf6c3525a Matthew Brost 2023-03-30 265
dd08ebf6c3525a Matthew Brost 2023-03-30 266 kunit_info(test, "Starting tests, top level PT addr: %llx, special pagetable base addr: %llx\n",
dd08ebf6c3525a Matthew Brost 2023-03-30 267 xe_bo_main_addr(m->eng->vm->pt_root[id]->bo, GEN8_PAGE_SIZE),
dd08ebf6c3525a Matthew Brost 2023-03-30 268 xe_bo_main_addr(m->pt_bo, GEN8_PAGE_SIZE));
dd08ebf6c3525a Matthew Brost 2023-03-30 269
dd08ebf6c3525a Matthew Brost 2023-03-30 270 /* First part of the test, are we updating our pagetable bo with a new entry? */
dd08ebf6c3525a Matthew Brost 2023-03-30 271 xe_map_wr(xe, &bo->vmap, GEN8_PAGE_SIZE * (NUM_KERNEL_PDE - 1), u64, 0xdeaddeadbeefbeef);
dd08ebf6c3525a Matthew Brost 2023-03-30 272 expected = gen8_pte_encode(NULL, pt, 0, XE_CACHE_WB, 0, 0);
dd08ebf6c3525a Matthew Brost 2023-03-30 273 if (m->eng->vm->flags & XE_VM_FLAGS_64K)
dd08ebf6c3525a Matthew Brost 2023-03-30 274 expected |= GEN12_PTE_PS64;
dd08ebf6c3525a Matthew Brost 2023-03-30 275 xe_res_first(pt->ttm.resource, 0, pt->size, &src_it);
dd08ebf6c3525a Matthew Brost 2023-03-30 276 emit_pte(m, bb, NUM_KERNEL_PDE - 1, xe_bo_is_vram(pt),
dd08ebf6c3525a Matthew Brost 2023-03-30 277 &src_it, GEN8_PAGE_SIZE, pt);
dd08ebf6c3525a Matthew Brost 2023-03-30 278 run_sanity_job(m, xe, bb, bb->len, "Writing PTE for our fake PT", test);
dd08ebf6c3525a Matthew Brost 2023-03-30 279
dd08ebf6c3525a Matthew Brost 2023-03-30 280 retval = xe_map_rd(xe, &bo->vmap, GEN8_PAGE_SIZE * (NUM_KERNEL_PDE - 1),
dd08ebf6c3525a Matthew Brost 2023-03-30 281 u64);
dd08ebf6c3525a Matthew Brost 2023-03-30 282 check(retval, expected, "PTE entry write", test);
dd08ebf6c3525a Matthew Brost 2023-03-30 283
dd08ebf6c3525a Matthew Brost 2023-03-30 284 /* Now try to write data to our newly mapped 'pagetable', see if it succeeds */
dd08ebf6c3525a Matthew Brost 2023-03-30 285 bb->len = 0;
dd08ebf6c3525a Matthew Brost 2023-03-30 286 bb->cs[bb->len++] = MI_BATCH_BUFFER_END;
dd08ebf6c3525a Matthew Brost 2023-03-30 287 xe_map_wr(xe, &pt->vmap, 0, u32, 0xdeaddead);
dd08ebf6c3525a Matthew Brost 2023-03-30 288 expected = 0x12345678U;
dd08ebf6c3525a Matthew Brost 2023-03-30 289
dd08ebf6c3525a Matthew Brost 2023-03-30 290 emit_clear(m->gt, bb, xe_migrate_vm_addr(NUM_KERNEL_PDE - 1, 0), 4, 4,
dd08ebf6c3525a Matthew Brost 2023-03-30 291 expected, IS_DGFX(xe));
dd08ebf6c3525a Matthew Brost 2023-03-30 292 run_sanity_job(m, xe, bb, 1, "Writing to our newly mapped pagetable",
dd08ebf6c3525a Matthew Brost 2023-03-30 293 test);
dd08ebf6c3525a Matthew Brost 2023-03-30 294
dd08ebf6c3525a Matthew Brost 2023-03-30 295 retval = xe_map_rd(xe, &pt->vmap, 0, u32);
dd08ebf6c3525a Matthew Brost 2023-03-30 296 check(retval, expected, "Write to PT after adding PTE", test);
dd08ebf6c3525a Matthew Brost 2023-03-30 297
dd08ebf6c3525a Matthew Brost 2023-03-30 298 /* Sanity checks passed, try the full ones! */
dd08ebf6c3525a Matthew Brost 2023-03-30 299
dd08ebf6c3525a Matthew Brost 2023-03-30 300 /* Clear a small bo */
dd08ebf6c3525a Matthew Brost 2023-03-30 301 kunit_info(test, "Clearing small buffer object\n");
dd08ebf6c3525a Matthew Brost 2023-03-30 302 xe_map_memset(xe, &tiny->vmap, 0, 0x22, tiny->size);
dd08ebf6c3525a Matthew Brost 2023-03-30 303 expected = 0x224488ff;
dd08ebf6c3525a Matthew Brost 2023-03-30 304 fence = xe_migrate_clear(m, tiny, tiny->ttm.resource, expected);
dd08ebf6c3525a Matthew Brost 2023-03-30 305 if (sanity_fence_failed(xe, fence, "Clearing small bo", test))
dd08ebf6c3525a Matthew Brost 2023-03-30 306 goto out;
dd08ebf6c3525a Matthew Brost 2023-03-30 307
dd08ebf6c3525a Matthew Brost 2023-03-30 308 dma_fence_put(fence);
dd08ebf6c3525a Matthew Brost 2023-03-30 309 retval = xe_map_rd(xe, &tiny->vmap, 0, u32);
dd08ebf6c3525a Matthew Brost 2023-03-30 310 check(retval, expected, "Command clear small first value", test);
dd08ebf6c3525a Matthew Brost 2023-03-30 311 retval = xe_map_rd(xe, &tiny->vmap, tiny->size - 4, u32);
dd08ebf6c3525a Matthew Brost 2023-03-30 312 check(retval, expected, "Command clear small last value", test);
dd08ebf6c3525a Matthew Brost 2023-03-30 313
dd08ebf6c3525a Matthew Brost 2023-03-30 314 if (IS_DGFX(xe)) {
dd08ebf6c3525a Matthew Brost 2023-03-30 315 kunit_info(test, "Copying small buffer object to system\n");
dd08ebf6c3525a Matthew Brost 2023-03-30 316 test_copy(m, tiny, test);
dd08ebf6c3525a Matthew Brost 2023-03-30 317 }
dd08ebf6c3525a Matthew Brost 2023-03-30 318
dd08ebf6c3525a Matthew Brost 2023-03-30 319 /* Clear a big bo with a fixed value */
dd08ebf6c3525a Matthew Brost 2023-03-30 320 kunit_info(test, "Clearing big buffer object\n");
dd08ebf6c3525a Matthew Brost 2023-03-30 321 xe_map_memset(xe, &big->vmap, 0, 0x11, big->size);
dd08ebf6c3525a Matthew Brost 2023-03-30 322 expected = 0x11223344U;
dd08ebf6c3525a Matthew Brost 2023-03-30 323 fence = xe_migrate_clear(m, big, big->ttm.resource, expected);
dd08ebf6c3525a Matthew Brost 2023-03-30 324 if (sanity_fence_failed(xe, fence, "Clearing big bo", test))
dd08ebf6c3525a Matthew Brost 2023-03-30 325 goto out;
dd08ebf6c3525a Matthew Brost 2023-03-30 326
dd08ebf6c3525a Matthew Brost 2023-03-30 327 dma_fence_put(fence);
dd08ebf6c3525a Matthew Brost 2023-03-30 328 retval = xe_map_rd(xe, &big->vmap, 0, u32);
dd08ebf6c3525a Matthew Brost 2023-03-30 329 check(retval, expected, "Command clear big first value", test);
dd08ebf6c3525a Matthew Brost 2023-03-30 330 retval = xe_map_rd(xe, &big->vmap, big->size - 4, u32);
dd08ebf6c3525a Matthew Brost 2023-03-30 331 check(retval, expected, "Command clear big last value", test);
dd08ebf6c3525a Matthew Brost 2023-03-30 332
dd08ebf6c3525a Matthew Brost 2023-03-30 333 if (IS_DGFX(xe)) {
dd08ebf6c3525a Matthew Brost 2023-03-30 334 kunit_info(test, "Copying big buffer object to system\n");
dd08ebf6c3525a Matthew Brost 2023-03-30 335 test_copy(m, big, test);
dd08ebf6c3525a Matthew Brost 2023-03-30 336 }
dd08ebf6c3525a Matthew Brost 2023-03-30 337
dd08ebf6c3525a Matthew Brost 2023-03-30 338 test_pt_update(m, pt, test);
dd08ebf6c3525a Matthew Brost 2023-03-30 339
dd08ebf6c3525a Matthew Brost 2023-03-30 340 out:
dd08ebf6c3525a Matthew Brost 2023-03-30 341 xe_bb_free(bb, NULL);
dd08ebf6c3525a Matthew Brost 2023-03-30 342 free_tiny:
dd08ebf6c3525a Matthew Brost 2023-03-30 343 xe_bo_unpin(tiny);
dd08ebf6c3525a Matthew Brost 2023-03-30 344 xe_bo_put(tiny);
dd08ebf6c3525a Matthew Brost 2023-03-30 345 free_pt:
dd08ebf6c3525a Matthew Brost 2023-03-30 346 xe_bo_unpin(pt);
dd08ebf6c3525a Matthew Brost 2023-03-30 347 xe_bo_put(pt);
dd08ebf6c3525a Matthew Brost 2023-03-30 348 free_big:
dd08ebf6c3525a Matthew Brost 2023-03-30 349 xe_bo_unpin(big);
dd08ebf6c3525a Matthew Brost 2023-03-30 350 xe_bo_put(big);
dd08ebf6c3525a Matthew Brost 2023-03-30 351 vunmap:
dd08ebf6c3525a Matthew Brost 2023-03-30 352 xe_bo_vunmap(m->pt_bo);
dd08ebf6c3525a Matthew Brost 2023-03-30 353 }
dd08ebf6c3525a Matthew Brost 2023-03-30 354
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2024-01-30 13:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-30 13:46 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-01-30 5:11 drivers/gpu/drm/xe/tests/xe_migrate.c:224 xe_migrate_sanity_test() warn: passing zero to 'PTR_ERR' Dan Carpenter
2024-01-29 15:41 kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202401302106.gPIPs6Ge-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.