dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: David Stevens <stevensd@chromium.org>
To: "Christian König" <christian.koenig@amd.com>
Cc: ML dri-devel <dri-devel@lists.freedesktop.org>,
	Gurchetan Singh <gurchetansingh@chromium.org>
Subject: Re: [PATCH] drm/ttm: use compound pages for THP
Date: Wed, 13 Jan 2021 18:33:17 +0900	[thread overview]
Message-ID: <CAD=HUj4isb5-knjijDj6MqGkk6xSQuXt3uBK8jBy1qtxHM9NZg@mail.gmail.com> (raw)
In-Reply-To: <e0797913-7314-979f-cea8-6af3a67a22a6@amd.com>

On Wed, Jan 13, 2021 at 5:58 PM Christian König
<christian.koenig@amd.com> wrote:
>
> Am 13.01.21 um 09:47 schrieb David Stevens:
> > Compound page metadata is necessary for page reference counting to work
> > properly on pages besides the head page. Without it, put_page
> > corresponding to the last outstanding get_page call on a tail page will
> > end up freeing that page, even if the bo still references the page.
>
> NAK, I should add a comment since I can't count any more how many times
> people came up with this.
>
> Calling put_page() on a TTM allocated page is strictly illegal in the
> first place since they are not reference counted.
>
> Please don't tell me somebody once more tried to mmap() pages from a
> DMA-buf created sg_table into a process address space?

I ran into this on a system using the currently in development
virtio-gpu blob resources [1]. The implementation passes dma buffers
allocated by the host gpu to KVM_SET_USER_MEMORY_REGION, so the guest
can directly access the buffers without the need for an intermediate
copy.

[1] https://patchwork.kernel.org/project/dri-devel/cover/20200814024000.2485-1-gurchetansingh@chromium.org/

> Regards,
> Christian.
>
> >
> > Signed-off-by: David Stevens <stevensd@chromium.org>
> > ---
> >   drivers/gpu/drm/ttm/ttm_pool.c | 1 -
> >   1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c
> > index 7b2f60616750..09239b93dc2c 100644
> > --- a/drivers/gpu/drm/ttm/ttm_pool.c
> > +++ b/drivers/gpu/drm/ttm/ttm_pool.c
> > @@ -83,7 +83,6 @@ static struct page *ttm_pool_alloc_page(struct ttm_pool *pool, gfp_t gfp_flags,
> >               gfp_flags |= GFP_TRANSHUGE_LIGHT | __GFP_NORETRY |
> >                       __GFP_KSWAPD_RECLAIM;
> >               gfp_flags &= ~__GFP_MOVABLE;
> > -             gfp_flags &= ~__GFP_COMP;
> >       }
> >
> >       if (!pool->use_dma_alloc) {
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2021-01-14  9:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-13  8:47 [PATCH] drm/ttm: use compound pages for THP David Stevens
2021-01-13  8:58 ` Christian König
2021-01-13  9:33   ` David Stevens [this message]
2021-01-13 12:44     ` Christian König

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='CAD=HUj4isb5-knjijDj6MqGkk6xSQuXt3uBK8jBy1qtxHM9NZg@mail.gmail.com' \
    --to=stevensd@chromium.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gurchetansingh@chromium.org \
    /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;
as well as URLs for NNTP newsgroup(s).