All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] drm/ttm: add transparent huge page support for DMA allocations v2
@ 2019-06-27 14:06 Dan Carpenter
  2019-06-27 16:19 ` Koenig, Christian
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2019-06-27 14:06 UTC (permalink / raw)
  To: christian.koenig; +Cc: Christoph Hellwig, dri-devel

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...

(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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-07-15 13:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-27 14:06 [bug report] drm/ttm: add transparent huge page support for DMA allocations v2 Dan Carpenter
2019-06-27 16:19 ` Koenig, Christian
     [not found]   ` <20190627165532.GD10652@lst.de>
2019-06-27 17:12     ` Koenig, Christian
     [not found]       ` <20190627171536.GA11117@lst.de>
2019-06-27 17:30         ` Koenig, Christian
     [not found]           ` <20190628073935.GA29114@lst.de>
2019-06-28  8:05             ` Koenig, Christian
     [not found]               ` <20190701083117.GA22587@lst.de>
2019-07-15 10:41                 ` Koenig, Christian
     [not found]                   ` <20190715125058.GA4384@lst.de>
2019-07-15 13:38                     ` Koenig, Christian

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.