From: "Christian König" <christian.koenig@amd.com>
To: Alex Goins <agoins@nvidia.com>
Cc: linux-mm@kvack.org, Zi Yan <ziy@nvidia.com>,
dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
John Hubbard <jhubbard@nvidia.com>
Subject: Re: [PATCH RFC 0/1] drm/ttm: Allocate transparent huge pages without clearing __GFP_COMP
Date: Thu, 1 Oct 2020 09:19:01 +0200 [thread overview]
Message-ID: <4566cf03-1c9e-1626-6c92-7b5fa29d6b75@amd.com> (raw)
In-Reply-To: <20200930221821.13719-1-agoins@nvidia.com>
Hi Alex,
first of all accessing the underlying page of an exported DMA-buf is
illegal! So I'm not 100% sure what you're intentions are here, please
explain further.
Then the reason for TTM not using compound pages is that we can't
guarantee that they are mapped as a whole to userspace.
The result is that the kernel sometimes tried to de-compound them which
created a bunch of problems.
So yes this is completely intentional.
Regards,
Christian.
Am 01.10.20 um 00:18 schrieb Alex Goins:
> Hi Christian,
>
> I've been looking into the DMA-BUFs exported from AMDGPU / TTM. Would
> you mind giving some input on this?
>
> I noticed that your changes implementing transparent huge page support
> in TTM are allocating them as non-compound. I understand that using
> multiorder non-compound pages is common in device drivers, but I think
> this can cause a problem when these pages are exported to other drivers.
>
> It's possible for other drivers to access the DMA-BUF's pages via
> gem_prime_import_sg_table(), but without context from TTM, it's
> impossible for the importing driver to make sense of them; they simply
> appear as individual pages, with only the first page having a non-zero
> refcount. Making TTM's THP allocations compound puts them more in line
> with the standard definition of a THP, and allows DMA-BUF-importing
> drivers to make sense of the pages within.
>
> I would like to propose making these allocations compound, but based on
> patch history, it looks like the decision to make them non-compound was
> intentional, as there were difficulties figuring out how to map them
> into CPU page tables. I did some cursory testing with compound THPs, and
> nothing seems obviously broken. I was also able to map compound THP
> DMA-BUFs into userspace without issue, and access their contents. Are
> you aware of any other potential consequences?
>
> Commit 5c42c64f7d54 ("drm/ttm: fix the fix for huge compound pages") should
> probably also be reverted if this is applied.
>
> Thanks,
> Alex
>
> Alex Goins (1):
> drm-ttm: Allocate compound transparent huge pages
>
> drivers/gpu/drm/ttm/ttm_page_alloc.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-10-01 7:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-30 22:18 [PATCH RFC 0/1] drm/ttm: Allocate transparent huge pages without clearing __GFP_COMP Alex Goins
2020-09-30 22:18 ` [PATCH RFC 1/1] drm-ttm: " Alex Goins
2020-10-01 7:19 ` Christian König [this message]
2020-10-01 18:45 ` [PATCH RFC 0/1] drm/ttm: " Alex Goins
2020-10-02 6:41 ` Christian König
2020-10-02 7:31 ` Daniel Vetter
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=4566cf03-1c9e-1626-6c92-7b5fa29d6b75@amd.com \
--to=christian.koenig@amd.com \
--cc=agoins@nvidia.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jhubbard@nvidia.com \
--cc=linux-mm@kvack.org \
--cc=ziy@nvidia.com \
/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).