Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3598101lfo; Mon, 23 May 2022 08:54:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWCOu4OkxXbXD+h6H0W6ic2YhXXJXNLtzbDodgvhoJwV3kcgjeu3Jd9Fv6WxK1UzKOmH1h X-Received: by 2002:a17:903:234d:b0:161:994f:f83e with SMTP id c13-20020a170903234d00b00161994ff83emr23614750plh.120.1653321251270; Mon, 23 May 2022 08:54:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653321251; cv=none; d=google.com; s=arc-20160816; b=Ic1JCUuqW6suCgEupRGI+/aFUqAXPz/WIkLhBKKhgK5O60LUTHtvI7DntDA0sC2lJB YhkmtK7Xb90D57p2VWQR87A0tjg7qUI2pP+wKSJw0NO6aRh/Qc4iMSQGeSg/zJRRGphK 343EHULA396jl4DTHYrN5WeElICcGg7efqY2KA1vSgC18rrGg9UZZIT+Gs/iz0Mv3als SA3/NL7wAC9wpNrKRpf7I/9ujInaRuUOPdNjCHsjiIxa/DxAVUuCg3GR9xm+pggLfhdZ DFQI6FkHTHa/Qa7+m05/ayhILOy59GrmYfie8hOSY5+xmX23+VleyQtKP2Nd5ij5TKG6 92Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=XvT8RDApEJ7DwXLFC6+hIYHdlPTl7ZwYBoJSyLFpwA0=; b=0KtwJC5fDgrZtRYNYjVV1+xozILb+7U9F1Qx7SNaGu/aPw5z+Ns30b/S/QiPIi8i0q 8h5vbIZL//L0A3etbvV3n97dG6bToJ2qalUhQRd4x0JTUkG4xXxI4SuZwT/l6l71yk67 M471GWCeTz9Od+891jgm10YEe9m33tZ4klppLXqUxR80rBUW+t2e2778INyhyTfK4V8A Chy/zUpQ5Cml1E3dKuD1vbzVU17GjZv6wB0oCnhPnw0jlKyVS164EmzzTsTa6Sgji6Fx HA/j2QJLHFLT+Kf9UdzT4IICnB6LaXlVT9OJ2JjXTt09cYkrKvqYVBUATwxUvXlhonSE uGmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=jTvwol6+; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id u17-20020a170903125100b0015e92bcc291si12824851plh.73.2022.05.23.08.54.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 08:54:11 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=jTvwol6+; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9636B3FBE1; Mon, 23 May 2022 08:53:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238178AbiEWPw7 (ORCPT + 99 others); Mon, 23 May 2022 11:52:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238286AbiEWPwh (ORCPT ); Mon, 23 May 2022 11:52:37 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9204C26570 for ; Mon, 23 May 2022 08:52:34 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: bbeckett) with ESMTPSA id 31D9D1F43999 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1653321153; bh=BRBPt5ET+rgbs/sHyY5rXpb/IZ19k3OSJSYokuIVcs0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=jTvwol6+oz4NF7k2PhH1jAJ5jyaw5XwD8cy6AmK2OWiXXd/5G4WjhHoMCcKmuymX2 L0oguiqyOdy498ZoipWwrSIXzQlIOoQe+17mZeIpkYVdRvhEjY4P1rWL8pAELoUggR K444h8gjnmfUFKV33eeO9cMhQ9MLR/Z0iRQ/wDEAN4jneEJPrXG8PYdPOOivurDvbT AizH9y/wmOmPDiGADNsIcUWxj20eQaSBG0z1p/bLEt2pREZCZRnvvVpezfChPosxZq GFGWA0t2kdCdYKGT4yjB6d4+uCuw5Yh2JHZn+O7lVdOXnVIoq6R3s5s02ffWJ4E0zg XrTU5+dJoSe8g== Message-ID: Date: Mon, 23 May 2022 16:52:30 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH 1/4] drm/i915: add gen6 ppgtt dummy creation function Content-Language: en-US To: =?UTF-8?Q?Thomas_Hellstr=c3=b6m?= , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter Cc: Matthew Auld , linux-kernel@vger.kernel.org References: <20220503191316.1145124-1-bob.beckett@collabora.com> <20220503191316.1145124-2-bob.beckett@collabora.com> <3d08eb595c4a4eff02be5385c82d1e1d0e781c98.camel@linux.intel.com> From: Robert Beckett In-Reply-To: <3d08eb595c4a4eff02be5385c82d1e1d0e781c98.camel@linux.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/05/2022 11:13, Thomas Hellström wrote: > Hi, > > On Tue, 2022-05-03 at 19:13 +0000, Robert Beckett wrote: >> Internal gem objects will soon just be volatile system memory region >> objects. >> To enable this, create a separate dummy object creation function >> for gen6 ppgtt > > > It's not clear from the commit message why we need a special case for > this. Could you describe more in detail? it always was a special case, that used the internal backend but provided it's own ops, so actually had no benefit from using the internal backend. See b0b0f2d225da6fe58417fae37e3f797e2db27b62 I'll add some further explanation in the commit message for v2. > > Thanks, > Thomas > > >> >> Signed-off-by: Robert Beckett >> --- >>  drivers/gpu/drm/i915/gt/gen6_ppgtt.c | 43 >> ++++++++++++++++++++++++++-- >>  1 file changed, 40 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/gpu/drm/i915/gt/gen6_ppgtt.c >> b/drivers/gpu/drm/i915/gt/gen6_ppgtt.c >> index 1bb766c79dcb..f3b660cfeb7f 100644 >> --- a/drivers/gpu/drm/i915/gt/gen6_ppgtt.c >> +++ b/drivers/gpu/drm/i915/gt/gen6_ppgtt.c >> @@ -372,6 +372,45 @@ static const struct drm_i915_gem_object_ops >> pd_dummy_obj_ops = { >>         .put_pages = pd_dummy_obj_put_pages, >>  }; >> >> +static struct drm_i915_gem_object * >> +i915_gem_object_create_dummy(struct drm_i915_private *i915, >> phys_addr_t size) >> +{ >> +       static struct lock_class_key lock_class; >> +       struct drm_i915_gem_object *obj; >> +       unsigned int cache_level; >> + >> +       GEM_BUG_ON(!size); >> +       GEM_BUG_ON(!IS_ALIGNED(size, PAGE_SIZE)); >> + >> +       if (overflows_type(size, obj->base.size)) >> +               return ERR_PTR(-E2BIG); >> + >> +       obj = i915_gem_object_alloc(); >> +       if (!obj) >> +               return ERR_PTR(-ENOMEM); >> + >> +       drm_gem_private_object_init(&i915->drm, &obj->base, size); >> +       i915_gem_object_init(obj, &pd_dummy_obj_ops, &lock_class, 0); >> +       obj->mem_flags |= I915_BO_FLAG_STRUCT_PAGE; >> + >> +       /* >> +        * Mark the object as volatile, such that the pages are >> marked as >> +        * dontneed whilst they are still pinned. As soon as they are >> unpinned >> +        * they are allowed to be reaped by the shrinker, and the >> caller is >> +        * expected to repopulate - the contents of this object are >> only valid >> +        * whilst active and pinned. >> +        */ >> +       i915_gem_object_set_volatile(obj); >> + >> +       obj->read_domains = I915_GEM_DOMAIN_CPU; >> +       obj->write_domain = I915_GEM_DOMAIN_CPU; >> + >> +       cache_level = HAS_LLC(i915) ? I915_CACHE_LLC : >> I915_CACHE_NONE; >> +       i915_gem_object_set_cache_coherency(obj, cache_level); >> + >> +       return obj; >> +} >> + >>  static struct i915_page_directory * >>  gen6_alloc_top_pd(struct gen6_ppgtt *ppgtt) >>  { >> @@ -383,9 +422,7 @@ gen6_alloc_top_pd(struct gen6_ppgtt *ppgtt) >>         if (unlikely(!pd)) >>                 return ERR_PTR(-ENOMEM); >> >> -       pd->pt.base = __i915_gem_object_create_internal(ppgtt- >>> base.vm.gt->i915, >> - >>                                                        &pd_dummy_obj_o >> ps, >> -                                                       I915_PDES * >> SZ_4K); >> +       pd->pt.base = i915_gem_object_create_dummy(ppgtt->base.vm.gt- >>> i915, I915_PDES * SZ_4K); >>         if (IS_ERR(pd->pt.base)) { >>                 err = PTR_ERR(pd->pt.base); >>                 pd->pt.base = NULL; > >