Am 27.06.19 um 16:06 schrieb Dan Carpenter: > Hello Christian König, > > The patch 648bc3574716: "drm/ttm: add transparent huge page support > for DMA allocations v2" from Jul 6, 2017, leads to the following > static checker warning: > > drivers/gpu/drm/ttm/ttm_page_alloc_dma.c:314 __ttm_dma_alloc_page() > error: 'vaddr' came from dma_alloc_coherent() so we can't do virt_to_phys() > > drivers/gpu/drm/ttm/ttm_page_alloc_dma.c > 295 static struct dma_page *__ttm_dma_alloc_page(struct dma_pool *pool) > 296 { > 297 struct dma_page *d_page; > 298 unsigned long attrs = 0; > 299 void *vaddr; > 300 > 301 d_page = kmalloc(sizeof(struct dma_page), GFP_KERNEL); > 302 if (!d_page) > 303 return NULL; > 304 > 305 if (pool->type & IS_HUGE) > 306 attrs = DMA_ATTR_NO_WARN; > 307 > 308 vaddr = dma_alloc_attrs(pool->dev, pool->size, &d_page->dma, > 309 pool->gfp_flags, attrs); > 310 if (vaddr) { > 311 if (is_vmalloc_addr(vaddr)) > 312 d_page->p = vmalloc_to_page(vaddr); > 313 else > 314 d_page->p = virt_to_page(vaddr); > > Christoph was explaining this earlier and I don't think it's sufficient > to just check is_vmalloc_addr(). See https://lkml.org/lkml/2019/6/17/155 > Apparently the vaddr might not have a page backing... That stuff was copied from the older non-huge page code and I actually think it is correct. If not then the real question is how to correctly get the backing page from dma_alloc_attrs(). Christian. > > (I am a newbie to this so I may be wrong or have misunderstood also). > > 315 d_page->vaddr = (unsigned long)vaddr; > 316 if (pool->type & IS_HUGE) > 317 d_page->vaddr |= VADDR_FLAG_HUGE_POOL; > 318 } else { > 319 kfree(d_page); > 320 d_page = NULL; > 321 } > 322 return d_page; > 323 } > > regards, > dan carpenter _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel