From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66194C4727C for ; Wed, 30 Sep 2020 22:18:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DA462206F7 for ; Wed, 30 Sep 2020 22:18:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="mwGFiDJ2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA462206F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1581E6B005C; Wed, 30 Sep 2020 18:18:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0E20B6B0062; Wed, 30 Sep 2020 18:18:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EEAEA6B0068; Wed, 30 Sep 2020 18:18:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0031.hostedemail.com [216.40.44.31]) by kanga.kvack.org (Postfix) with ESMTP id D2F4A6B005C for ; Wed, 30 Sep 2020 18:18:37 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 8CD86181AE864 for ; Wed, 30 Sep 2020 22:18:37 +0000 (UTC) X-FDA: 77321143074.04.front23_41184ba27196 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id 6CB29800EFB7 for ; Wed, 30 Sep 2020 22:18:37 +0000 (UTC) X-HE-Tag: front23_41184ba27196 X-Filterd-Recvd-Size: 3750 Received: from hqnvemgate24.nvidia.com (hqnvemgate24.nvidia.com [216.228.121.143]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Wed, 30 Sep 2020 22:18:36 +0000 (UTC) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Wed, 30 Sep 2020 15:16:53 -0700 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 30 Sep 2020 22:18:31 +0000 Received: from agoins-ThinkPad-P50.nvidia.com (10.124.1.5) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1473.3 via Frontend Transport; Wed, 30 Sep 2020 22:18:30 +0000 From: Alex Goins To: =?UTF-8?q?Christian=20K=C3=B6nig?= CC: Alex Goins , , , , John Hubbard , Zi Yan Subject: [PATCH RFC 0/1] drm/ttm: Allocate transparent huge pages without clearing __GFP_COMP Date: Wed, 30 Sep 2020 17:18:20 -0500 Message-ID: <20200930221821.13719-1-agoins@nvidia.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-NVConfidentiality: public Content-Transfer-Encoding: quoted-printable Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1601504213; bh=tMz3LKthgMWnzr+Vh8IQBgPkRR2AQ1/d22RThpXsnoY=; h=From:To:CC:Subject:Date:Message-ID:X-Mailer:MIME-Version: X-NVConfidentiality:Content-Transfer-Encoding:Content-Type; b=mwGFiDJ29YNCR0H+y/SRd0On62HFQ+reIG+9/N/VhoHqenLu8TGk9HKHlC56iB4cs MVOm9C3Pq4p1ai3t7MZGhJrMmvA2It9getxhN8IAOJ8K9LVt92G3euxwFv75pi9bh+ v0tuhThKhhNBASSNhAdh7DD3I6a4Bzr+/9xYRHZDyhWHAQ2zGdkoxcgoy2FdBSyDDv /c7TOZeoGy8pEhjXDcHYa3aRz+rLgRhp4ksb/LUSIGLGcII9gb6baAXhikiHpbv/oR Vl6V8QQzU/HyIDwCjKUO1nS7CdRh5zTR2qMlG2xdJcHpsCeRna2p09i4yUD7mmuV5u BR9dG8ExpM9BQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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(-) --=20 2.25.1