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=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 217C6C433FE for ; Thu, 16 Sep 2021 09:58:46 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DD2E461207 for ; Thu, 16 Sep 2021 09:58:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DD2E461207 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3678D6EB41; Thu, 16 Sep 2021 09:58:45 +0000 (UTC) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id 585F56EB41; Thu, 16 Sep 2021 09:58:44 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10108"; a="209619424" X-IronPort-AV: E=Sophos;i="5.85,298,1624345200"; d="scan'208";a="209619424" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2021 02:58:43 -0700 X-IronPort-AV: E=Sophos;i="5.85,298,1624345200"; d="scan'208";a="700563391" Received: from mmullen-mobl1.ger.corp.intel.com (HELO [10.213.235.197]) ([10.213.235.197]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2021 02:58:42 -0700 To: =?UTF-8?Q?Thomas_Hellstr=c3=b6m?= , =?UTF-8?Q?Christian_K=c3=b6nig?= , intel-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org References: <20210915185954.3114858-1-matthew.auld@intel.com> <20210915185954.3114858-6-matthew.auld@intel.com> <00e355ba-fa5a-945e-d9ea-48260a2c56ae@amd.com> <7548b96f116883a4f0db6a6d82c3023488761ea4.camel@linux.intel.com> From: Matthew Auld Message-ID: Date: Thu, 16 Sep 2021 10:58:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <7548b96f116883a4f0db6a6d82c3023488761ea4.camel@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit Subject: Re: [Intel-gfx] [PATCH v3 06/12] drm/ttm: add TTM_PAGE_FLAG_EXTERNAL_MAPPABLE X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On 16/09/2021 10:03, Thomas Hellström wrote: > On Thu, 2021-09-16 at 08:55 +0200, Christian König wrote: >> >> >> Am 15.09.21 um 20:59 schrieb Matthew Auld: >>> In commit: >>> >>> commit 667a50db0477d47fdff01c666f5ee1ce26b5264c >>> Author: Thomas Hellstrom >>> Date:   Fri Jan 3 11:17:18 2014 +0100 >>> >>>      drm/ttm: Refuse to fault (prime-) imported pages >>> >>> we introduced the restriction that imported pages should not be >>> directly >>> mappable through TTM(this also extends to userptr). In the next >>> patch we >>> want to introduce a shmem_tt backend, which should follow all the >>> existing rules with TTM_PAGE_FLAG_EXTERNAL, since it will need to >>> handle >>> swapping itself, but with the above mapping restriction lifted. >>> >>> Signed-off-by: Matthew Auld >>> Cc: Thomas Hellström >>> Cc: Christian König >>> --- >>>   drivers/gpu/drm/ttm/ttm_bo_vm.c | 6 ++++-- >>>   include/drm/ttm/ttm_tt.h        | 7 +++++++ >>>   2 files changed, 11 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c >>> b/drivers/gpu/drm/ttm/ttm_bo_vm.c >>> index 708390588c7c..fd6e18f12f50 100644 >>> --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c >>> +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c >>> @@ -163,8 +163,10 @@ vm_fault_t ttm_bo_vm_reserve(struct >>> ttm_buffer_object *bo, >>>          * (if at all) by redirecting mmap to the exporter. >>>          */ >>>         if (bo->ttm && (bo->ttm->page_flags & >>> TTM_PAGE_FLAG_EXTERNAL)) { >>> -               dma_resv_unlock(bo->base.resv); >>> -               return VM_FAULT_SIGBUS; >>> +               if (!(bo->ttm->page_flags & >>> TTM_PAGE_FLAG_EXTERNAL_MAPPABLE)) { > > I saw there was previously a thought about testing for ttm_bo_type_sg > here. Was that a dead end? I guess the issue was userptr, which is also EXTERNAL and needs to be rejected here, but underneath it's not type_sg. Just having an explicit MAPPABLE flag or similar seemed the more flexible approach? Happy to try out other ideas. > > Thanks, > Thomas > >