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=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,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 9186CC43603 for ; Fri, 13 Dec 2019 05:40:07 +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 6683922527 for ; Fri, 13 Dec 2019 05:40:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6683922527 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E1B296E279; Fri, 13 Dec 2019 05:40:06 +0000 (UTC) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id B65246E279 for ; Fri, 13 Dec 2019 05:40:05 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Dec 2019 21:40:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,308,1571727600"; d="scan'208";a="239193196" Received: from echew2-mobl.gar.corp.intel.com ([10.255.170.251]) by fmsmga004.fm.intel.com with ESMTP; 12 Dec 2019 21:40:02 -0800 To: Chris Wilson , Matthew Auld References: <20191212113438.5412-1-abdiel.janulgue@linux.intel.com> <157616034917.4546.15052864218216216334@skylake-alporthouse-com> <157616399450.4546.5472279753206797713@skylake-alporthouse-com> From: Abdiel Janulgue Message-ID: <51f2f2da-c60c-2b54-c81a-5f6d6385f0ed@linux.intel.com> Date: Fri, 13 Dec 2019 07:39:36 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <157616399450.4546.5472279753206797713@skylake-alporthouse-com> Content-Language: en-US Subject: Re: [Intel-gfx] [PATCH] drm/i915: Add lmem fault handler 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: , Cc: Intel Graphics Development , Matthew Auld Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On 12/12/2019 17.19, Chris Wilson wrote: > Quoting Matthew Auld (2019-12-12 15:11:02) >> On Thu, 12 Dec 2019 at 14:20, Chris Wilson wrote: >>> >>> Quoting Abdiel Janulgue (2019-12-12 11:34:38) >>>> Fault handler to handle missing pages for lmem objects. >>>> >>>> v3: Add get_vm_cpu_ops, iterate over all memory regions in the >>>> lmem selftest, use remap_io_mapping. >>>> >>>> Signed-off-by: Abdiel Janulgue >>>> Signed-off-by: Matthew Auld >>>> Cc: Chris Wilson >>>> Cc: Joonas Lahtinen >>>> --- >>>> drivers/gpu/drm/i915/gem/i915_gem_lmem.c | 40 +++++ >>>> drivers/gpu/drm/i915/gem/i915_gem_lmem.h | 6 + >>>> drivers/gpu/drm/i915/gem/i915_gem_mman.c | 32 +++- >>>> drivers/gpu/drm/i915/gem/i915_gem_mman.h | 1 + >>>> .../drm/i915/gem/selftests/i915_gem_mman.c | 137 +++++++++++++++--- >>>> 5 files changed, 188 insertions(+), 28 deletions(-) >>>> >>>> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_lmem.c b/drivers/gpu/drm/i915/gem/i915_gem_lmem.c >>>> index 0e2bf6b7e143..bbe625935005 100644 >>>> --- a/drivers/gpu/drm/i915/gem/i915_gem_lmem.c >>>> +++ b/drivers/gpu/drm/i915/gem/i915_gem_lmem.c >>>> @@ -6,8 +6,36 @@ >>>> #include "intel_memory_region.h" >>>> #include "gem/i915_gem_region.h" >>>> #include "gem/i915_gem_lmem.h" >>>> +#include "gem/i915_gem_mman.h" >>>> #include "i915_drv.h" >>>> >>>> +vm_fault_t vm_fault_iomem(struct vm_fault *vmf) >>>> +{ >>>> + struct vm_area_struct *area = vmf->vma; >>>> + struct i915_mmap_offset *priv = area->vm_private_data; >>>> + struct drm_i915_gem_object *obj = priv->obj; >>>> + struct intel_memory_region *mem = obj->mm.region; >>>> + unsigned long size = area->vm_end - area->vm_start; >>>> + bool write = area->vm_flags & VM_WRITE; >>>> + int ret; >>>> + >>>> + /* Sanity check that we allow writing into this object */ >>>> + if (i915_gem_object_is_readonly(obj) && write) >>>> + return VM_FAULT_SIGBUS; >>>> + >>>> + ret = i915_gem_object_pin_pages(obj); >>>> + if (ret) >>>> + return i915_error_to_vmf_fault(ret); >>>> + >>>> + ret = remap_io_mapping(area, area->vm_start, >>>> + i915_gem_object_lmem_io_pfn(obj, 0), size, >>>> + &mem->iomap); >>> >>> So this implementation only works with contiguous objects, right? >> >> Hmm can't we go back to what we had before, so support !contiguous also? > > The fun part is that you can do both :) Do a discontiguous > remap_io_mapping() The queue part is that remap_io_mapping() avoids the > O(N^2), and should give us O(N) instead. So just to be clear, if (obj->flags & I915_BO_ALLOC_CONTIGUOUS) { remap_io_mapping(...) } else { for(...) vmf_insert_pfn() } ?? - Abdiel _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx