drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1592:12: warning: stack frame size of 2448 bytes in function 'amdgpu_vm_bo_update_mapping'

From: kernel test robot
Date: Wed May 05 2021 - 16:56:20 EST


Hi Christian,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d665ea6ea86c785760ee4bad4543dab3267ad074
commit: a39f2a8d70666ef728497651a16bca4d23ec8816 drm/amdgpu: nuke amdgpu_vm_bo_split_mapping v2
date: 6 months ago
config: powerpc-randconfig-r016-20210505 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a39f2a8d70666ef728497651a16bca4d23ec8816
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout a39f2a8d70666ef728497651a16bca4d23ec8816
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=powerpc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1592:12: warning: stack frame size of 2448 bytes in function 'amdgpu_vm_bo_update_mapping' [-Wframe-larger-than=]
static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
^
1 warning generated.

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for HOTPLUG_PCI_POWERNV
Depends on PCI && HOTPLUG_PCI && PPC_POWERNV && EEH
Selected by
- OCXL && PPC_POWERNV && PCI && EEH


vim +/amdgpu_vm_bo_update_mapping +1592 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

d38ceaf99ed015 Alex Deucher 2015-04-20 1569
d38ceaf99ed015 Alex Deucher 2015-04-20 1570 /**
d38ceaf99ed015 Alex Deucher 2015-04-20 1571 * amdgpu_vm_bo_update_mapping - update a mapping in the vm page table
d38ceaf99ed015 Alex Deucher 2015-04-20 1572 *
a39f2a8d70666e Christian König 2020-10-12 1573 * @adev: amdgpu_device pointer of the VM
a39f2a8d70666e Christian König 2020-10-12 1574 * @bo_adev: amdgpu_device pointer of the mapped BO
d38ceaf99ed015 Alex Deucher 2015-04-20 1575 * @vm: requested vm
eaad0c3aa978e7 Christian König 2020-04-01 1576 * @immediate: immediate submission in a page fault
9c466bcbda68d7 Christian König 2020-04-07 1577 * @unlocked: unlocked invalidation during MM callback
9f3cc18d19b7b7 Christian König 2020-01-23 1578 * @resv: fences we need to sync to
a14faa6573d956 Christian König 2016-01-25 1579 * @start: start of mapped range
a14faa6573d956 Christian König 2016-01-25 1580 * @last: last mapped entry
a14faa6573d956 Christian König 2016-01-25 1581 * @flags: flags for the entries
a39f2a8d70666e Christian König 2020-10-12 1582 * @offset: offset into nodes and pages_addr
a39f2a8d70666e Christian König 2020-10-12 1583 * @nodes: array of drm_mm_nodes with the MC addresses
acb476f541f625 Christian König 2019-03-27 1584 * @pages_addr: DMA addresses to use for mapping
d38ceaf99ed015 Alex Deucher 2015-04-20 1585 * @fence: optional resulting fence
d38ceaf99ed015 Alex Deucher 2015-04-20 1586 *
a14faa6573d956 Christian König 2016-01-25 1587 * Fill in the page table entries between @start and @last.
7fc48e5912795c Andrey Grodzovsky 2018-06-11 1588 *
7fc48e5912795c Andrey Grodzovsky 2018-06-11 1589 * Returns:
7fc48e5912795c Andrey Grodzovsky 2018-06-11 1590 * 0 for success, -EINVAL for failure.
d38ceaf99ed015 Alex Deucher 2015-04-20 1591 */
d38ceaf99ed015 Alex Deucher 2015-04-20 @1592 static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
a39f2a8d70666e Christian König 2020-10-12 1593 struct amdgpu_device *bo_adev,
eaad0c3aa978e7 Christian König 2020-04-01 1594 struct amdgpu_vm *vm, bool immediate,
9c466bcbda68d7 Christian König 2020-04-07 1595 bool unlocked, struct dma_resv *resv,
a14faa6573d956 Christian König 2016-01-25 1596 uint64_t start, uint64_t last,
a39f2a8d70666e Christian König 2020-10-12 1597 uint64_t flags, uint64_t offset,
a39f2a8d70666e Christian König 2020-10-12 1598 struct drm_mm_node *nodes,
acb476f541f625 Christian König 2019-03-27 1599 dma_addr_t *pages_addr,
f54d1867005c33 Chris Wilson 2016-10-25 1600 struct dma_fence **fence)
d38ceaf99ed015 Alex Deucher 2015-04-20 1601 {
d1e29462a06ac3 Christian König 2019-03-18 1602 struct amdgpu_vm_update_params params;
9f3cc18d19b7b7 Christian König 2020-01-23 1603 enum amdgpu_sync_mode sync_mode;
a39f2a8d70666e Christian König 2020-10-12 1604 uint64_t pfn;
d38ceaf99ed015 Alex Deucher 2015-04-20 1605 int r;
d38ceaf99ed015 Alex Deucher 2015-04-20 1606
afef8b8f99b648 Christian König 2016-08-12 1607 memset(&params, 0, sizeof(params));
afef8b8f99b648 Christian König 2016-08-12 1608 params.adev = adev;
49ac8a24caa957 Christian König 2016-10-13 1609 params.vm = vm;
eaad0c3aa978e7 Christian König 2020-04-01 1610 params.immediate = immediate;
072b7a0bd2f6be Christian König 2019-03-18 1611 params.pages_addr = pages_addr;
5654b897b5bf11 Alex Sierra 2020-04-10 1612 params.unlocked = unlocked;
afef8b8f99b648 Christian König 2016-08-12 1613
9f3cc18d19b7b7 Christian König 2020-01-23 1614 /* Implicitly sync to command submissions in the same VM before
9f3cc18d19b7b7 Christian König 2020-01-23 1615 * unmapping. Sync to moving fences before mapping.
9f3cc18d19b7b7 Christian König 2020-01-23 1616 */
a33cab7aacb2aa Christian König 2017-07-11 1617 if (!(flags & AMDGPU_PTE_VALID))
9f3cc18d19b7b7 Christian König 2020-01-23 1618 sync_mode = AMDGPU_SYNC_EQ_OWNER;
9f3cc18d19b7b7 Christian König 2020-01-23 1619 else
9f3cc18d19b7b7 Christian König 2020-01-23 1620 sync_mode = AMDGPU_SYNC_EXPLICIT;
a33cab7aacb2aa Christian König 2017-07-11 1621
a39f2a8d70666e Christian König 2020-10-12 1622 pfn = offset >> PAGE_SHIFT;
a39f2a8d70666e Christian König 2020-10-12 1623 if (nodes) {
a39f2a8d70666e Christian König 2020-10-12 1624 while (pfn >= nodes->size) {
a39f2a8d70666e Christian König 2020-10-12 1625 pfn -= nodes->size;
a39f2a8d70666e Christian König 2020-10-12 1626 ++nodes;
a39f2a8d70666e Christian König 2020-10-12 1627 }
a39f2a8d70666e Christian König 2020-10-12 1628 }
a39f2a8d70666e Christian König 2020-10-12 1629
a269e44989f3e7 Alex Sierra 2019-12-17 1630 amdgpu_vm_eviction_lock(vm);
b4ff0f8a85f3c5 Christian König 2019-12-04 1631 if (vm->evicting) {
b4ff0f8a85f3c5 Christian König 2019-12-04 1632 r = -EBUSY;
b4ff0f8a85f3c5 Christian König 2019-12-04 1633 goto error_unlock;
b4ff0f8a85f3c5 Christian König 2019-12-04 1634 }
b4ff0f8a85f3c5 Christian König 2019-12-04 1635
9c466bcbda68d7 Christian König 2020-04-07 1636 if (!unlocked && !dma_fence_is_signaled(vm->last_unlocked)) {
9c466bcbda68d7 Christian König 2020-04-07 1637 struct dma_fence *tmp = dma_fence_get_stub();
42e5fee65e918f Christian König 2020-02-19 1638
9c466bcbda68d7 Christian König 2020-04-07 1639 amdgpu_bo_fence(vm->root.base.bo, vm->last_unlocked, true);
9c466bcbda68d7 Christian König 2020-04-07 1640 swap(vm->last_unlocked, tmp);
9c466bcbda68d7 Christian König 2020-04-07 1641 dma_fence_put(tmp);
42e5fee65e918f Christian König 2020-02-19 1642 }
42e5fee65e918f Christian König 2020-02-19 1643
9f3cc18d19b7b7 Christian König 2020-01-23 1644 r = vm->update_funcs->prepare(&params, resv, sync_mode);
d71518b5aa7c9c Christian König 2016-02-01 1645 if (r)
b4ff0f8a85f3c5 Christian König 2019-12-04 1646 goto error_unlock;
d71518b5aa7c9c Christian König 2016-02-01 1647
63e0ba40e52c60 Christian König 2016-08-16 1648 do {
a39f2a8d70666e Christian König 2020-10-12 1649 uint64_t tmp, num_entries, addr;
63e0ba40e52c60 Christian König 2016-08-16 1650
a39f2a8d70666e Christian König 2020-10-12 1651
a39f2a8d70666e Christian König 2020-10-12 1652 num_entries = last - start + 1;
63e0ba40e52c60 Christian König 2016-08-16 1653 if (nodes) {
63e0ba40e52c60 Christian König 2016-08-16 1654 addr = nodes->start << PAGE_SHIFT;
a39f2a8d70666e Christian König 2020-10-12 1655 num_entries = min((nodes->size - pfn) *
a39f2a8d70666e Christian König 2020-10-12 1656 AMDGPU_GPU_PAGES_IN_CPU_PAGE, num_entries);
63e0ba40e52c60 Christian König 2016-08-16 1657 } else {
63e0ba40e52c60 Christian König 2016-08-16 1658 addr = 0;
63e0ba40e52c60 Christian König 2016-08-16 1659 }
63e0ba40e52c60 Christian König 2016-08-16 1660
8358dceed981cf Christian König 2016-03-30 1661 if (pages_addr) {
a39f2a8d70666e Christian König 2020-10-12 1662 bool contiguous = true;
a39f2a8d70666e Christian König 2020-10-12 1663
a39f2a8d70666e Christian König 2020-10-12 1664 if (num_entries > AMDGPU_GPU_PAGES_IN_CPU_PAGE) {
9fc8fc709b356c Christian König 2017-09-18 1665 uint64_t count;
9fc8fc709b356c Christian König 2017-09-18 1666
a39f2a8d70666e Christian König 2020-10-12 1667 contiguous = pages_addr[pfn + 1] ==
a39f2a8d70666e Christian König 2020-10-12 1668 pages_addr[pfn] + PAGE_SIZE;
a39f2a8d70666e Christian König 2020-10-12 1669
a39f2a8d70666e Christian König 2020-10-12 1670 tmp = num_entries /
a39f2a8d70666e Christian König 2020-10-12 1671 AMDGPU_GPU_PAGES_IN_CPU_PAGE;
a39f2a8d70666e Christian König 2020-10-12 1672 for (count = 2; count < tmp; ++count) {
9fc8fc709b356c Christian König 2017-09-18 1673 uint64_t idx = pfn + count;
9fc8fc709b356c Christian König 2017-09-18 1674
a39f2a8d70666e Christian König 2020-10-12 1675 if (contiguous != (pages_addr[idx] ==
a39f2a8d70666e Christian König 2020-10-12 1676 pages_addr[idx - 1] + PAGE_SIZE))
9fc8fc709b356c Christian König 2017-09-18 1677 break;
9fc8fc709b356c Christian König 2017-09-18 1678 }
a39f2a8d70666e Christian König 2020-10-12 1679 num_entries = count *
a39f2a8d70666e Christian König 2020-10-12 1680 AMDGPU_GPU_PAGES_IN_CPU_PAGE;
a39f2a8d70666e Christian König 2020-10-12 1681 }
9fc8fc709b356c Christian König 2017-09-18 1682
a39f2a8d70666e Christian König 2020-10-12 1683 if (!contiguous) {
9fc8fc709b356c Christian König 2017-09-18 1684 addr = pfn << PAGE_SHIFT;
a39f2a8d70666e Christian König 2020-10-12 1685 params.pages_addr = pages_addr;
9fc8fc709b356c Christian König 2017-09-18 1686 } else {
9fc8fc709b356c Christian König 2017-09-18 1687 addr = pages_addr[pfn];
a39f2a8d70666e Christian König 2020-10-12 1688 params.pages_addr = NULL;
9fc8fc709b356c Christian König 2017-09-18 1689 }
9fc8fc709b356c Christian König 2017-09-18 1690
31d0271d450f30 Yintian Tao 2020-03-16 1691 } else if (flags & (AMDGPU_PTE_VALID | AMDGPU_PTE_PRT)) {
a690aa0f459eba shaoyunl 2019-02-22 1692 addr += bo_adev->vm_manager.vram_base_offset;
63e0ba40e52c60 Christian König 2016-08-16 1693 addr += pfn << PAGE_SHIFT;
9fc8fc709b356c Christian König 2017-09-18 1694 }
a14faa6573d956 Christian König 2016-01-25 1695
a39f2a8d70666e Christian König 2020-10-12 1696 tmp = start + num_entries;
a39f2a8d70666e Christian König 2020-10-12 1697 r = amdgpu_vm_update_ptes(&params, start, tmp, addr, flags);
a14faa6573d956 Christian König 2016-01-25 1698 if (r)
a39f2a8d70666e Christian König 2020-10-12 1699 goto error_unlock;
a14faa6573d956 Christian König 2016-01-25 1700
a39f2a8d70666e Christian König 2020-10-12 1701 pfn += num_entries / AMDGPU_GPU_PAGES_IN_CPU_PAGE;
63e0ba40e52c60 Christian König 2016-08-16 1702 if (nodes && nodes->size == pfn) {
63e0ba40e52c60 Christian König 2016-08-16 1703 pfn = 0;
63e0ba40e52c60 Christian König 2016-08-16 1704 ++nodes;
a14faa6573d956 Christian König 2016-01-25 1705 }
a39f2a8d70666e Christian König 2020-10-12 1706 start = tmp;
63e0ba40e52c60 Christian König 2016-08-16 1707
a39f2a8d70666e Christian König 2020-10-12 1708 } while (unlikely(start != last + 1));
a14faa6573d956 Christian König 2016-01-25 1709
a39f2a8d70666e Christian König 2020-10-12 1710 r = vm->update_funcs->commit(&params, fence);
a39f2a8d70666e Christian König 2020-10-12 1711
a39f2a8d70666e Christian König 2020-10-12 1712 error_unlock:
a39f2a8d70666e Christian König 2020-10-12 1713 amdgpu_vm_eviction_unlock(vm);
a39f2a8d70666e Christian König 2020-10-12 1714 return r;
a14faa6573d956 Christian König 2016-01-25 1715 }
a14faa6573d956 Christian König 2016-01-25 1716

:::::: The code at line 1592 was first introduced by commit
:::::: d38ceaf99ed015f2a0b9af3499791bd3a3daae21 drm/amdgpu: add core driver (v4)

:::::: TO: Alex Deucher <alexander.deucher@xxxxxxx>
:::::: CC: Alex Deucher <alexander.deucher@xxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip