From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [thomash:topic/ttm_branch 38/45] drivers/gpu/drm/i915/gem/i915_gem_pages.c:466:1: warning: no previous prototype for '____i915_gem_object_get_sg'
Date: Mon, 03 May 2021 23:48:04 +0800 [thread overview]
Message-ID: <202105032357.KjXsRCd0-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 5358 bytes --]
tree: git://people.freedesktop.org/~thomash/linux topic/ttm_branch
head: 0aaa25061a7b6db523bfb7127b3fd83c5bc314d7
commit: 9bcc198d3054f4fd5834415e941d399eef45fd07 [38/45] drm/i915/ttm: Introduce a TTM gem object backend
config: x86_64-rhel-8.3-kselftests (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
git remote add thomash git://people.freedesktop.org/~thomash/linux
git fetch --no-tags thomash topic/ttm_branch
git checkout 9bcc198d3054f4fd5834415e941d399eef45fd07
# save the attached .config to linux build tree
make W=1 W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/gpu/drm/i915/gem/i915_gem_pages.c:466:1: warning: no previous prototype for '____i915_gem_object_get_sg' [-Wmissing-prototypes]
466 | ____i915_gem_object_get_sg(struct scatterlist *orig_sg,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/____i915_gem_object_get_sg +466 drivers/gpu/drm/i915/gem/i915_gem_pages.c
462
463
464
465 struct scatterlist *
> 466 ____i915_gem_object_get_sg(struct scatterlist *orig_sg,
467 struct i915_gem_object_page_iter *iter,
468 unsigned int n,
469 unsigned int *offset,
470 bool dma,
471 bool allow_alloc)
472 {
473 struct scatterlist *sg;
474 unsigned int idx, count;
475
476 might_sleep();
477
478 /* As we iterate forward through the sg, we record each entry in a
479 * radixtree for quick repeated (backwards) lookups. If we have seen
480 * this index previously, we will have an entry for it.
481 *
482 * Initial lookup is O(N), but this is amortized to O(1) for
483 * sequential page access (where each new request is consecutive
484 * to the previous one). Repeated lookups are O(lg(obj->base.size)),
485 * i.e. O(1) with a large constant!
486 */
487 if (n < READ_ONCE(iter->sg_idx))
488 goto lookup;
489
490 if (!allow_alloc)
491 goto manual_lookup;
492
493 mutex_lock(&iter->lock);
494
495 /* We prefer to reuse the last sg so that repeated lookup of this
496 * (or the subsequent) sg are fast - comparing against the last
497 * sg is faster than going through the radixtree.
498 */
499
500 sg = iter->sg_pos;
501 idx = iter->sg_idx;
502 count = dma ? __sg_dma_page_count(sg) : __sg_page_count(sg);
503
504 while (idx + count <= n) {
505 void *entry;
506 unsigned long i;
507 int ret;
508
509 /* If we cannot allocate and insert this entry, or the
510 * individual pages from this range, cancel updating the
511 * sg_idx so that on this lookup we are forced to linearly
512 * scan onwards, but on future lookups we will try the
513 * insertion again (in which case we need to be careful of
514 * the error return reporting that we have already inserted
515 * this index).
516 */
517 ret = radix_tree_insert(&iter->radix, idx, sg);
518 if (ret && ret != -EEXIST)
519 goto scan;
520
521 entry = xa_mk_value(idx);
522 for (i = 1; i < count; i++) {
523 ret = radix_tree_insert(&iter->radix, idx + i, entry);
524 if (ret && ret != -EEXIST)
525 goto scan;
526 }
527
528 idx += count;
529 sg = ____sg_next(sg);
530 count = dma ? __sg_dma_page_count(sg) : __sg_page_count(sg);
531 }
532
533 scan:
534 iter->sg_pos = sg;
535 iter->sg_idx = idx;
536
537 mutex_unlock(&iter->lock);
538
539 if (unlikely(n < idx)) /* insertion completed by another thread */
540 goto lookup;
541
542 goto manual_walk;
543
544 manual_lookup:
545 idx = 0;
546 sg = orig_sg;
547 count = __sg_page_count(sg);
548
549 manual_walk:
550 /*
551 * In case we failed to insert the entry into the radixtree, we need
552 * to look beyond the current sg.
553 */
554 while (idx + count <= n) {
555 idx += count;
556 sg = ____sg_next(sg);
557 count = dma ? __sg_dma_page_count(sg) : __sg_page_count(sg);
558 }
559
560 *offset = n - idx;
561 return sg;
562
563 lookup:
564 rcu_read_lock();
565
566 sg = radix_tree_lookup(&iter->radix, n);
567 GEM_BUG_ON(!sg);
568
569 /* If this index is in the middle of multi-page sg entry,
570 * the radix tree will contain a value entry that points
571 * to the start of that range. We will return the pointer to
572 * the base page and the offset of this page within the
573 * sg entry's range.
574 */
575 *offset = 0;
576 if (unlikely(xa_is_value(sg))) {
577 unsigned long base = xa_to_value(sg);
578
579 sg = radix_tree_lookup(&iter->radix, base);
580 GEM_BUG_ON(!sg);
581
582 *offset = n - base;
583 }
584
585 rcu_read_unlock();
586
587 return sg;
588 }
589
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 41538 bytes --]
reply other threads:[~2021-05-03 15:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202105032357.KjXsRCd0-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.org \
/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.