dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Koenig, Christian" <Christian.Koenig@amd.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: Re: [bug report] drm/ttm: add transparent huge page support for DMA allocations v2
Date: Thu, 27 Jun 2019 16:19:14 +0000	[thread overview]
Message-ID: <41b33cc3-2f07-681a-5fee-25a328de46bd@amd.com> (raw)
In-Reply-To: <20190627140626.GA6027@mwanda>

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

  reply	other threads:[~2019-06-27 16:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
     [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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41b33cc3-2f07-681a-5fee-25a328de46bd@amd.com \
    --to=christian.koenig@amd.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hch@lst.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox