[radeon-alex:amd-staging-4.11 1309/1319] drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1122:16: warning: 'shadow_addr' may be used uninitialized in this function
kbuild test robot
fengguang.wu at intel.com
Fri Jun 9 18:52:57 UTC 2017
tree: git://people.freedesktop.org/~agd5f/linux.git amd-staging-4.11
head: cad2d1111e124fe8a1637785bb47202da55f54af
commit: 9989707c4000667d37a711b6a4eb2e77d8cd00a8 [1309/1319] drm/amdgpu: Support page directory update via CPU
config: i386-randconfig-r0-06050939 (attached as .config)
compiler: gcc-5 (Debian 5.4.1-2) 5.4.1 20160904
reproduce:
git checkout 9989707c4000667d37a711b6a4eb2e77d8cd00a8
# save the attached .config to linux build tree
make ARCH=i386
Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
All warnings (new ones prefixed by >>):
In file included from drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:32:0:
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c: In function 'amdgpu_vm_cpu_set_ptes':
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:977:41: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
amdgpu_gart_set_pte_pde(params->adev, (void *)pe,
^
drivers/gpu/drm/amd/amdgpu/amdgpu.h:1870:107: note: in definition of macro 'amdgpu_gart_set_pte_pde'
#define amdgpu_gart_set_pte_pde(adev, pt, idx, addr, flags) (adev)->gart.gart_funcs->set_pte_pde((adev), (pt), (idx), (addr), (flags))
^
In file included from arch/x86/include/asm/bug.h:35:0,
from include/linux/bug.h:4,
from include/linux/thread_info.h:11,
from arch/x86/include/asm/preempt.h:6,
from include/linux/preempt.h:80,
from include/linux/spinlock.h:50,
from include/linux/wait.h:8,
from include/linux/dma-fence.h:25,
from include/linux/dma-fence-array.h:23,
from drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:28:
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c: In function 'amdgpu_vm_update_level':
include/asm-generic/bug.h:93:5: warning: 'ndw' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (unlikely(__ret_warn_on)) \
^
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1020:30: note: 'ndw' was declared here
unsigned count = 0, pt_idx, ndw;
^
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1122:16: warning: 'shadow_addr' may be used uninitialized in this function [-Wmaybe-uninitialized]
last_shadow = shadow_addr + pt_idx * 8;
^
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1151:5: warning: 'ring' may be used uninitialized in this function [-Wmaybe-uninitialized]
r = amdgpu_job_submit(job, ring, &vm->entity,
^
vim +/shadow_addr +1122 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
d38ceaf99e Alex Deucher 2015-04-20 1014 {
f8991bab1a Christian König 2016-09-16 1015 struct amdgpu_bo *shadow;
2d55e45a03 Christian König 2016-02-08 1016 struct amdgpu_ring *ring;
f8991bab1a Christian König 2016-09-16 1017 uint64_t pd_addr, shadow_addr;
bcb75af82e Christian König 2016-10-12 1018 uint32_t incr = amdgpu_vm_bo_size(adev, level + 1);
f8991bab1a Christian König 2016-09-16 1019 uint64_t last_pde = ~0, last_pt = ~0, last_shadow = ~0;
d38ceaf99e Alex Deucher 2015-04-20 @1020 unsigned count = 0, pt_idx, ndw;
d71518b5aa Christian König 2016-02-01 1021 struct amdgpu_job *job;
29efc4f5df Christian König 2016-08-04 1022 struct amdgpu_pte_update_params params;
f54d186700 Chris Wilson 2016-10-25 1023 struct dma_fence *fence = NULL;
d5fc5e82a3 Chunming Zhou 2015-07-21 1024
d38ceaf99e Alex Deucher 2015-04-20 1025 int r;
d38ceaf99e Alex Deucher 2015-04-20 1026
bcb75af82e Christian König 2016-10-12 1027 if (!parent->entries)
bcb75af82e Christian König 2016-10-12 1028 return 0;
9989707c40 Harish Kasiviswanathan 2017-05-11 1029
9989707c40 Harish Kasiviswanathan 2017-05-11 1030 memset(¶ms, 0, sizeof(params));
9989707c40 Harish Kasiviswanathan 2017-05-11 1031 params.adev = adev;
9989707c40 Harish Kasiviswanathan 2017-05-11 1032 shadow = parent->bo->shadow;
9989707c40 Harish Kasiviswanathan 2017-05-11 1033
9989707c40 Harish Kasiviswanathan 2017-05-11 1034 WARN_ON(vm->use_cpu_for_update && shadow);
9989707c40 Harish Kasiviswanathan 2017-05-11 1035 if (vm->use_cpu_for_update && !shadow) {
9989707c40 Harish Kasiviswanathan 2017-05-11 1036 r = amdgpu_bo_kmap(parent->bo, (void **)&pd_addr);
9989707c40 Harish Kasiviswanathan 2017-05-11 1037 if (r)
9989707c40 Harish Kasiviswanathan 2017-05-11 1038 return r;
9989707c40 Harish Kasiviswanathan 2017-05-11 1039 r = amdgpu_vm_bo_wait(adev, parent->bo);
9989707c40 Harish Kasiviswanathan 2017-05-11 1040 if (unlikely(r)) {
9989707c40 Harish Kasiviswanathan 2017-05-11 1041 amdgpu_bo_kunmap(parent->bo);
9989707c40 Harish Kasiviswanathan 2017-05-11 1042 return r;
9989707c40 Harish Kasiviswanathan 2017-05-11 1043 }
9989707c40 Harish Kasiviswanathan 2017-05-11 1044 params.func = amdgpu_vm_cpu_set_ptes;
9989707c40 Harish Kasiviswanathan 2017-05-11 1045 } else {
9989707c40 Harish Kasiviswanathan 2017-05-11 1046 if (shadow) {
9989707c40 Harish Kasiviswanathan 2017-05-11 1047 r = amdgpu_ttm_bind(&shadow->tbo, &shadow->tbo.mem);
9989707c40 Harish Kasiviswanathan 2017-05-11 1048 if (r)
9989707c40 Harish Kasiviswanathan 2017-05-11 1049 return r;
9989707c40 Harish Kasiviswanathan 2017-05-11 1050 }
9989707c40 Harish Kasiviswanathan 2017-05-11 1051 ring = container_of(vm->entity.sched, struct amdgpu_ring,
9989707c40 Harish Kasiviswanathan 2017-05-11 1052 sched);
2d55e45a03 Christian König 2016-02-08 1053
d38ceaf99e Alex Deucher 2015-04-20 1054 /* padding, etc. */
d38ceaf99e Alex Deucher 2015-04-20 1055 ndw = 64;
d38ceaf99e Alex Deucher 2015-04-20 1056
d38ceaf99e Alex Deucher 2015-04-20 1057 /* assume the worst case */
bcb75af82e Christian König 2016-10-12 1058 ndw += parent->last_entry_used * 6;
d38ceaf99e Alex Deucher 2015-04-20 1059
bcb75af82e Christian König 2016-10-12 1060 pd_addr = amdgpu_bo_gpu_offset(parent->bo);
bcb75af82e Christian König 2016-10-12 1061
f8991bab1a Christian König 2016-09-16 1062 if (shadow) {
f8991bab1a Christian König 2016-09-16 1063 shadow_addr = amdgpu_bo_gpu_offset(shadow);
f8991bab1a Christian König 2016-09-16 1064 ndw *= 2;
f8991bab1a Christian König 2016-09-16 1065 } else {
f8991bab1a Christian König 2016-09-16 1066 shadow_addr = 0;
f8991bab1a Christian König 2016-09-16 1067 }
f8991bab1a Christian König 2016-09-16 1068
d71518b5aa Christian König 2016-02-01 1069 r = amdgpu_job_alloc_with_ib(adev, ndw * 4, &job);
d71518b5aa Christian König 2016-02-01 1070 if (r)
d38ceaf99e Alex Deucher 2015-04-20 1071 return r;
d71518b5aa Christian König 2016-02-01 1072
29efc4f5df Christian König 2016-08-04 1073 params.ib = &job->ibs[0];
9989707c40 Harish Kasiviswanathan 2017-05-11 1074 params.func = amdgpu_vm_do_set_ptes;
9989707c40 Harish Kasiviswanathan 2017-05-11 1075 }
9989707c40 Harish Kasiviswanathan 2017-05-11 1076
d38ceaf99e Alex Deucher 2015-04-20 1077
bcb75af82e Christian König 2016-10-12 1078 /* walk over the address space and update the directory */
bcb75af82e Christian König 2016-10-12 1079 for (pt_idx = 0; pt_idx <= parent->last_entry_used; ++pt_idx) {
bcb75af82e Christian König 2016-10-12 1080 struct amdgpu_bo *bo = parent->entries[pt_idx].bo;
d38ceaf99e Alex Deucher 2015-04-20 1081 uint64_t pde, pt;
d38ceaf99e Alex Deucher 2015-04-20 1082
d38ceaf99e Alex Deucher 2015-04-20 1083 if (bo == NULL)
d38ceaf99e Alex Deucher 2015-04-20 1084 continue;
d38ceaf99e Alex Deucher 2015-04-20 1085
0fc8683e56 Christian König 2016-09-16 1086 if (bo->shadow) {
f8991bab1a Christian König 2016-09-16 1087 struct amdgpu_bo *pt_shadow = bo->shadow;
0fc8683e56 Christian König 2016-09-16 1088
f8991bab1a Christian König 2016-09-16 1089 r = amdgpu_ttm_bind(&pt_shadow->tbo,
f8991bab1a Christian König 2016-09-16 1090 &pt_shadow->tbo.mem);
0fc8683e56 Christian König 2016-09-16 1091 if (r)
0fc8683e56 Christian König 2016-09-16 1092 return r;
0fc8683e56 Christian König 2016-09-16 1093 }
0fc8683e56 Christian König 2016-09-16 1094
d38ceaf99e Alex Deucher 2015-04-20 1095 pt = amdgpu_bo_gpu_offset(bo);
d029622227 Christian König 2017-05-15 1096 pt = amdgpu_gart_get_vm_pde(adev, pt);
bcb75af82e Christian König 2016-10-12 1097 if (parent->entries[pt_idx].addr == pt)
d38ceaf99e Alex Deucher 2015-04-20 1098 continue;
f8991bab1a Christian König 2016-09-16 1099
bcb75af82e Christian König 2016-10-12 1100 parent->entries[pt_idx].addr = pt;
d38ceaf99e Alex Deucher 2015-04-20 1101
d38ceaf99e Alex Deucher 2015-04-20 1102 pde = pd_addr + pt_idx * 8;
d38ceaf99e Alex Deucher 2015-04-20 1103 if (((last_pde + 8 * count) != pde) ||
96105e5375 Christian König 2016-08-12 1104 ((last_pt + incr * count) != pt) ||
96105e5375 Christian König 2016-08-12 1105 (count == AMDGPU_VM_MAX_UPDATE_SIZE)) {
d38ceaf99e Alex Deucher 2015-04-20 1106
d38ceaf99e Alex Deucher 2015-04-20 1107 if (count) {
f8991bab1a Christian König 2016-09-16 1108 if (shadow)
9989707c40 Harish Kasiviswanathan 2017-05-11 1109 params.func(¶ms,
f8991bab1a Christian König 2016-09-16 1110 last_shadow,
d029622227 Christian König 2017-05-15 1111 last_pt, count,
f8991bab1a Christian König 2016-09-16 1112 incr,
f8991bab1a Christian König 2016-09-16 1113 AMDGPU_PTE_VALID);
f8991bab1a Christian König 2016-09-16 1114
9989707c40 Harish Kasiviswanathan 2017-05-11 1115 params.func(¶ms, last_pde,
d029622227 Christian König 2017-05-15 1116 last_pt, count, incr,
9ab2146289 Christian König 2015-11-30 1117 AMDGPU_PTE_VALID);
d38ceaf99e Alex Deucher 2015-04-20 1118 }
d38ceaf99e Alex Deucher 2015-04-20 1119
d38ceaf99e Alex Deucher 2015-04-20 1120 count = 1;
d38ceaf99e Alex Deucher 2015-04-20 1121 last_pde = pde;
f8991bab1a Christian König 2016-09-16 @1122 last_shadow = shadow_addr + pt_idx * 8;
d38ceaf99e Alex Deucher 2015-04-20 1123 last_pt = pt;
d38ceaf99e Alex Deucher 2015-04-20 1124 } else {
d38ceaf99e Alex Deucher 2015-04-20 1125 ++count;
d38ceaf99e Alex Deucher 2015-04-20 1126 }
d38ceaf99e Alex Deucher 2015-04-20 1127 }
d38ceaf99e Alex Deucher 2015-04-20 1128
f8991bab1a Christian König 2016-09-16 1129 if (count) {
fd5c3bae81 Christian König 2016-10-12 1130 if (vm->root.bo->shadow)
9989707c40 Harish Kasiviswanathan 2017-05-11 1131 params.func(¶ms, last_shadow, last_pt,
f8991bab1a Christian König 2016-09-16 1132 count, incr, AMDGPU_PTE_VALID);
f8991bab1a Christian König 2016-09-16 1133
9989707c40 Harish Kasiviswanathan 2017-05-11 1134 params.func(¶ms, last_pde, last_pt,
9ab2146289 Christian König 2015-11-30 1135 count, incr, AMDGPU_PTE_VALID);
f8991bab1a Christian König 2016-09-16 1136 }
f8991bab1a Christian König 2016-09-16 1137
9989707c40 Harish Kasiviswanathan 2017-05-11 1138 if (params.func == amdgpu_vm_cpu_set_ptes)
9989707c40 Harish Kasiviswanathan 2017-05-11 1139 amdgpu_bo_kunmap(parent->bo);
9989707c40 Harish Kasiviswanathan 2017-05-11 1140 else if (params.ib->length_dw == 0) {
f8991bab1a Christian König 2016-09-16 1141 amdgpu_job_free(job);
bcb75af82e Christian König 2016-10-12 1142 } else {
29efc4f5df Christian König 2016-08-04 1143 amdgpu_ring_pad_ib(ring, params.ib);
bcb75af82e Christian König 2016-10-12 1144 amdgpu_sync_resv(adev, &job->sync, parent->bo->tbo.resv,
e86f9ceee1 Christian König 2016-02-08 1145 AMDGPU_FENCE_OWNER_VM);
f8991bab1a Christian König 2016-09-16 1146 if (shadow)
f8991bab1a Christian König 2016-09-16 1147 amdgpu_sync_resv(adev, &job->sync, shadow->tbo.resv,
f8991bab1a Christian König 2016-09-16 1148 AMDGPU_FENCE_OWNER_VM);
f8991bab1a Christian König 2016-09-16 1149
29efc4f5df Christian König 2016-08-04 1150 WARN_ON(params.ib->length_dw > ndw);
2bd9ccfa75 Christian König 2016-02-01 @1151 r = amdgpu_job_submit(job, ring, &vm->entity,
2bd9ccfa75 Christian König 2016-02-01 1152 AMDGPU_FENCE_OWNER_VM, &fence);
d5fc5e82a3 Chunming Zhou 2015-07-21 1153 if (r)
4af9f07ccd Chunming Zhou 2015-08-03 1154 goto error_free;
:::::: The code at line 1122 was first introduced by commit
:::::: f8991bab1aa2121e33b8569857dfb22e536bc396 drm/amdgpu: update the shadow PD together with the real one v2
:::::: TO: Christian König <christian.koenig at amd.com>
:::::: CC: Alex Deucher <alexander.deucher at amd.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 30981 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20170610/a7c6eb9a/attachment-0001.gz>
More information about the dri-devel
mailing list