Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3688405pxb; Wed, 13 Oct 2021 10:52:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxF7H8Z19c9gTMoG6rfGjDtXaBj4KIhOtZ+cZAoy2t/cttceKuuTzBDnfbhnLWNnjUNa4g X-Received: by 2002:a63:1d10:: with SMTP id d16mr438264pgd.13.1634147541006; Wed, 13 Oct 2021 10:52:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634147541; cv=none; d=google.com; s=arc-20160816; b=pMNTNrUBUkz5Ij/jzbmZRFgmB2jA+D0o7eeo8bt2qaPyZcrdz040fAmnRuQ8tNguJv HN2x3ij/Hd2uNPp+By7ygijcDDTqtTYVSIk6cyPCrpeC4SrpYtVryNcZKQcKslSirYO7 R4SajornFFRP/v4zOwCM41tJIW0NjxiM1tj6A2pF6zpOX04uclFl3J2hHZNt18lea/s8 ztr8svGhIu6h/xlJxiM16dzbKx0FkoJ53wlGBfw85AB2GR1w7HLACYIp+Mc2PmnUu9S4 XZUeNqPIyMWVfTxH8dWja1cIjmVE1wLi8ThUrLTrzm23ArdzTmHlcbotmooXLDRAaoYt KG7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject; bh=dIS3XXuOBtHyJr5wsb7Lfexo0vFQeWuc/qd2zvthpLs=; b=Rkd8lNpaXSGzrIEak34XUmAlKQiGbIKQ651PMa20RLFogWr5Cum6NGp4az3vOscUqC 8DGBoMqR1jZfoMOYLBkMrNWRyucgk8+rl0fnzhrrVMrhJp4V4fvJo9T7Kla+cnXGjtw0 rTxXZRRx5Nw6uY6vrI/entGDjytvqVrHbAcoTHIEuhKrwh7rBuesVjsCUmE+6TbRZ0zG JYTyO1nLc5MoVlQcEEK2/9JyR5EKYJkpExAq9tOuF/K6YIUI4YIX0an3ZbWOVMzMGmcy CDZes+NZ78acp9ptVGhxNFiDixxXujIyoTvhmnxa9nkdpe6pJkhBNNST4vJgjMNAeirh LVjQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k9si431714pff.158.2021.10.13.10.52.06; Wed, 13 Oct 2021 10:52:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238629AbhJMRwV (ORCPT + 99 others); Wed, 13 Oct 2021 13:52:21 -0400 Received: from foss.arm.com ([217.140.110.172]:43260 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238518AbhJMRvo (ORCPT ); Wed, 13 Oct 2021 13:51:44 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DB1A81063; Wed, 13 Oct 2021 10:49:39 -0700 (PDT) Received: from [10.57.95.157] (unknown [10.57.95.157]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C72943F70D; Wed, 13 Oct 2021 10:49:38 -0700 (PDT) Subject: Re: [PATCH v2] drm/cma-helper: Set VM_DONTEXPAND for mmap To: Alyssa Rosenzweig , dri-devel@lists.freedesktop.org, Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , linux-kernel@vger.kernel.org References: <20211013143654.39031-1-alyssa@rosenzweig.io> From: Robin Murphy Message-ID: <9048b38d-f4e0-6fec-96dc-0d90909d77c6@arm.com> Date: Wed, 13 Oct 2021 18:49:32 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Daniel, On 2021-10-13 18:08, Daniel Vetter wrote: > On Wed, Oct 13, 2021 at 10:36:54AM -0400, Alyssa Rosenzweig wrote: >> From: Robin Murphy >> >> drm_gem_cma_mmap() cannot assume every implementation of dma_mmap_wc() >> will end up calling remap_pfn_range() (which happens to set the relevant >> vma flag, among others), so in order to make sure expectations around >> VM_DONTEXPAND are met, let it explicitly set the flag like most other >> GEM mmap implementations do. >> >> This avoids repeated warnings on a small minority of systems where the >> display is behind an IOMMU, and has a simple driver which does not >> override drm_gem_cma_default_funcs. Arm hdlcd is an in-tree affected >> driver. Out-of-tree, the Apple DCP driver is affected; this fix is >> required for DCP to be mainlined. > > How/where does this warn? In drm_gem_mmap_obj(). > Also there should be a lot more drivers than > just these two which have an iommu for the display block, so this not > working is definitely a more wide-spread issue. As the commit message implies, all those other drivers appear to end up using different mmap() implementations one way or another. Once I'd eventually figured it out, it didn't surprise me that the combination of a trivially-dumb display with an IOMMU is an oddball corner-case. > -Daniel > >> Signed-off-by: Robin Murphy >> Reviewed-and-tested-by: Alyssa Rosenzweig Alyssa - thanks for reviving this BTW, I'd forgotten all about it! - for future reference the clunky olde-worlde version of reassigning an MR to yourself is to add your sign-off to the end of the block (in addition to any review tags you may have previously given or choose to add) to note that you've chosen to take on responsibility for the patch[1]. FWIW I'm also partial to the practice of adding a little note in between if you've made any tweaks, e.g. "[alyssa: clarify affected drivers]", but that's often more of a personal choice. Cheers, Robin. [1] https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin >> --- >> drivers/gpu/drm/drm_gem_cma_helper.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c >> index d53388199f34..63e48d98263d 100644 >> --- a/drivers/gpu/drm/drm_gem_cma_helper.c >> +++ b/drivers/gpu/drm/drm_gem_cma_helper.c >> @@ -510,6 +510,7 @@ int drm_gem_cma_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma) >> */ >> vma->vm_pgoff -= drm_vma_node_start(&obj->vma_node); >> vma->vm_flags &= ~VM_PFNMAP; >> + vma->vm_flags |= VM_DONTEXPAND; >> >> cma_obj = to_drm_gem_cma_obj(obj); >> >> -- >> 2.30.2 >> >