lkml.org 
[lkml]   [2021]   [Mar]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectdrivers/gpu/drm/etnaviv/etnaviv_dump.c:213 etnaviv_core_dump() warn: should - mem_map) + arch_pfn_offset) << 12' be a 64 bit
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 28806e4d9b97865b450d72156e9ad229f2067f0b
commit: 050b2da268f8fc4f8123f6462c430a61547b2f7b arc: use FLATMEM with freeing of unused memory map instead of DISCONTIGMEM
date: 3 months ago
config: arc-randconfig-m031-20210311 (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0

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

smatch warnings:
drivers/gpu/drm/etnaviv/etnaviv_dump.c:213 etnaviv_core_dump() warn: should '(((*pages++) - mem_map) + arch_pfn_offset) << 12' be a 64 bit type?

vim +213 drivers/gpu/drm/etnaviv/etnaviv_dump.c

a8c21a5451d831 The etnaviv authors 2015-12-03 112
9a1fdae5876016 Lucas Stach 2019-08-09 113 void etnaviv_core_dump(struct etnaviv_gem_submit *submit)
a8c21a5451d831 The etnaviv authors 2015-12-03 114 {
9a1fdae5876016 Lucas Stach 2019-08-09 115 struct etnaviv_gpu *gpu = submit->gpu;
a8c21a5451d831 The etnaviv authors 2015-12-03 116 struct core_dump_iterator iter;
a8c21a5451d831 The etnaviv authors 2015-12-03 117 struct etnaviv_gem_object *obj;
a8c21a5451d831 The etnaviv authors 2015-12-03 118 unsigned int n_obj, n_bomap_pages;
a8c21a5451d831 The etnaviv authors 2015-12-03 119 size_t file_size, mmu_size;
a8c21a5451d831 The etnaviv authors 2015-12-03 120 __le64 *bomap, *bomap_start;
9a1fdae5876016 Lucas Stach 2019-08-09 121 int i;
a8c21a5451d831 The etnaviv authors 2015-12-03 122
6d7a20c0776036 Lucas Stach 2017-12-06 123 /* Only catch the first event, or when manually re-armed */
6d7a20c0776036 Lucas Stach 2017-12-06 124 if (!etnaviv_dump_core)
6d7a20c0776036 Lucas Stach 2017-12-06 125 return;
6d7a20c0776036 Lucas Stach 2017-12-06 126 etnaviv_dump_core = false;
6d7a20c0776036 Lucas Stach 2017-12-06 127
27b67278e007b5 Lucas Stach 2019-07-05 128 mutex_lock(&gpu->mmu_context->lock);
1396500d673bd0 Lucas Stach 2019-05-21 129
27b67278e007b5 Lucas Stach 2019-07-05 130 mmu_size = etnaviv_iommu_dump_size(gpu->mmu_context);
a8c21a5451d831 The etnaviv authors 2015-12-03 131
9a1fdae5876016 Lucas Stach 2019-08-09 132 /* We always dump registers, mmu, ring, hanging cmdbuf and end marker */
9a1fdae5876016 Lucas Stach 2019-08-09 133 n_obj = 5;
a8c21a5451d831 The etnaviv authors 2015-12-03 134 n_bomap_pages = 0;
a8c21a5451d831 The etnaviv authors 2015-12-03 135 file_size = ARRAY_SIZE(etnaviv_dump_registers) *
a8c21a5451d831 The etnaviv authors 2015-12-03 136 sizeof(struct etnaviv_dump_registers) +
9a1fdae5876016 Lucas Stach 2019-08-09 137 mmu_size + gpu->buffer.size + submit->cmdbuf.size;
a8c21a5451d831 The etnaviv authors 2015-12-03 138
a8c21a5451d831 The etnaviv authors 2015-12-03 139 /* Add in the active buffer objects */
9a1fdae5876016 Lucas Stach 2019-08-09 140 for (i = 0; i < submit->nr_bos; i++) {
9a1fdae5876016 Lucas Stach 2019-08-09 141 obj = submit->bos[i].obj;
a8c21a5451d831 The etnaviv authors 2015-12-03 142 file_size += obj->base.size;
a8c21a5451d831 The etnaviv authors 2015-12-03 143 n_bomap_pages += obj->base.size >> PAGE_SHIFT;
a8c21a5451d831 The etnaviv authors 2015-12-03 144 n_obj++;
a8c21a5451d831 The etnaviv authors 2015-12-03 145 }
a8c21a5451d831 The etnaviv authors 2015-12-03 146
a8c21a5451d831 The etnaviv authors 2015-12-03 147 /* If we have any buffer objects, add a bomap object */
a8c21a5451d831 The etnaviv authors 2015-12-03 148 if (n_bomap_pages) {
a8c21a5451d831 The etnaviv authors 2015-12-03 149 file_size += n_bomap_pages * sizeof(__le64);
a8c21a5451d831 The etnaviv authors 2015-12-03 150 n_obj++;
a8c21a5451d831 The etnaviv authors 2015-12-03 151 }
a8c21a5451d831 The etnaviv authors 2015-12-03 152
a8c21a5451d831 The etnaviv authors 2015-12-03 153 /* Add the size of the headers */
a8c21a5451d831 The etnaviv authors 2015-12-03 154 file_size += sizeof(*iter.hdr) * n_obj;
a8c21a5451d831 The etnaviv authors 2015-12-03 155
a8c21a5451d831 The etnaviv authors 2015-12-03 156 /* Allocate the file in vmalloc memory, it's likely to be big */
88dca4ca5a93d2 Christoph Hellwig 2020-06-01 157 iter.start = __vmalloc(file_size, GFP_KERNEL | __GFP_NOWARN |
88dca4ca5a93d2 Christoph Hellwig 2020-06-01 158 __GFP_NORETRY);
a8c21a5451d831 The etnaviv authors 2015-12-03 159 if (!iter.start) {
27b67278e007b5 Lucas Stach 2019-07-05 160 mutex_unlock(&gpu->mmu_context->lock);
a8c21a5451d831 The etnaviv authors 2015-12-03 161 dev_warn(gpu->dev, "failed to allocate devcoredump file\n");
a8c21a5451d831 The etnaviv authors 2015-12-03 162 return;
a8c21a5451d831 The etnaviv authors 2015-12-03 163 }
a8c21a5451d831 The etnaviv authors 2015-12-03 164
a8c21a5451d831 The etnaviv authors 2015-12-03 165 /* Point the data member after the headers */
a8c21a5451d831 The etnaviv authors 2015-12-03 166 iter.hdr = iter.start;
a8c21a5451d831 The etnaviv authors 2015-12-03 167 iter.data = &iter.hdr[n_obj];
a8c21a5451d831 The etnaviv authors 2015-12-03 168
a8c21a5451d831 The etnaviv authors 2015-12-03 169 memset(iter.hdr, 0, iter.data - iter.start);
a8c21a5451d831 The etnaviv authors 2015-12-03 170
a8c21a5451d831 The etnaviv authors 2015-12-03 171 etnaviv_core_dump_registers(&iter, gpu);
27b67278e007b5 Lucas Stach 2019-07-05 172 etnaviv_core_dump_mmu(&iter, gpu->mmu_context, mmu_size);
2f9225dbc09abe Lucas Stach 2017-11-24 173 etnaviv_core_dump_mem(&iter, ETDUMP_BUF_RING, gpu->buffer.vaddr,
2f9225dbc09abe Lucas Stach 2017-11-24 174 gpu->buffer.size,
db82a0435b8be3 Lucas Stach 2019-07-05 175 etnaviv_cmdbuf_get_va(&gpu->buffer,
17e4660ae3d7e1 Lucas Stach 2019-07-05 176 &gpu->mmu_context->cmdbuf_mapping));
2f9225dbc09abe Lucas Stach 2017-11-24 177
2f9225dbc09abe Lucas Stach 2017-11-24 178 etnaviv_core_dump_mem(&iter, ETDUMP_BUF_CMD,
2f9225dbc09abe Lucas Stach 2017-11-24 179 submit->cmdbuf.vaddr, submit->cmdbuf.size,
db82a0435b8be3 Lucas Stach 2019-07-05 180 etnaviv_cmdbuf_get_va(&submit->cmdbuf,
17e4660ae3d7e1 Lucas Stach 2019-07-05 181 &gpu->mmu_context->cmdbuf_mapping));
a8c21a5451d831 The etnaviv authors 2015-12-03 182
ca8cb69580236f Lucas Stach 2019-10-16 183 mutex_unlock(&gpu->mmu_context->lock);
ca8cb69580236f Lucas Stach 2019-10-16 184
a8c21a5451d831 The etnaviv authors 2015-12-03 185 /* Reserve space for the bomap */
a8c21a5451d831 The etnaviv authors 2015-12-03 186 if (n_bomap_pages) {
a8c21a5451d831 The etnaviv authors 2015-12-03 187 bomap_start = bomap = iter.data;
a8c21a5451d831 The etnaviv authors 2015-12-03 188 memset(bomap, 0, sizeof(*bomap) * n_bomap_pages);
a8c21a5451d831 The etnaviv authors 2015-12-03 189 etnaviv_core_dump_header(&iter, ETDUMP_BUF_BOMAP,
a8c21a5451d831 The etnaviv authors 2015-12-03 190 bomap + n_bomap_pages);
a8c21a5451d831 The etnaviv authors 2015-12-03 191 } else {
a8c21a5451d831 The etnaviv authors 2015-12-03 192 /* Silence warning */
a8c21a5451d831 The etnaviv authors 2015-12-03 193 bomap_start = bomap = NULL;
a8c21a5451d831 The etnaviv authors 2015-12-03 194 }
a8c21a5451d831 The etnaviv authors 2015-12-03 195
9a1fdae5876016 Lucas Stach 2019-08-09 196 for (i = 0; i < submit->nr_bos; i++) {
9a1fdae5876016 Lucas Stach 2019-08-09 197 struct etnaviv_vram_mapping *vram;
a8c21a5451d831 The etnaviv authors 2015-12-03 198 struct page **pages;
a8c21a5451d831 The etnaviv authors 2015-12-03 199 void *vaddr;
a8c21a5451d831 The etnaviv authors 2015-12-03 200
9a1fdae5876016 Lucas Stach 2019-08-09 201 obj = submit->bos[i].obj;
9a1fdae5876016 Lucas Stach 2019-08-09 202 vram = submit->bos[i].mapping;
a8c21a5451d831 The etnaviv authors 2015-12-03 203
339073ef77e45e Lucas Stach 2016-01-22 204 mutex_lock(&obj->lock);
a8c21a5451d831 The etnaviv authors 2015-12-03 205 pages = etnaviv_gem_get_pages(obj);
339073ef77e45e Lucas Stach 2016-01-22 206 mutex_unlock(&obj->lock);
f8261c376e7f8c Dan Carpenter 2019-01-14 207 if (!IS_ERR(pages)) {
a8c21a5451d831 The etnaviv authors 2015-12-03 208 int j;
a8c21a5451d831 The etnaviv authors 2015-12-03 209
a8c21a5451d831 The etnaviv authors 2015-12-03 210 iter.hdr->data[0] = bomap - bomap_start;
a8c21a5451d831 The etnaviv authors 2015-12-03 211
a8c21a5451d831 The etnaviv authors 2015-12-03 212 for (j = 0; j < obj->base.size >> PAGE_SHIFT; j++)
a8c21a5451d831 The etnaviv authors 2015-12-03 @213 *bomap++ = cpu_to_le64(page_to_phys(*pages++));

:::::: The code at line 213 was first introduced by commit
:::::: a8c21a5451d831e67b7a6fb910f9ca8bc7b43554 drm/etnaviv: add initial etnaviv DRM driver

:::::: TO: The etnaviv authors <dri-devel@lists.freedesktop.org>
:::::: CC: Lucas Stach <l.stach@pengutronix.de>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2021-03-12 01:28    [W:1.754 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site