From patchwork Fri Jul 23 19:29:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 12396831 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.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 19917C4338F for ; Fri, 23 Jul 2021 19:30: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 E0FCF60E97 for ; Fri, 23 Jul 2021 19:30:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E0FCF60E97 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch 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 8868A6FCFF; Fri, 23 Jul 2021 19:29:59 +0000 (UTC) Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9972D6FCF9 for ; Fri, 23 Jul 2021 19:29:47 +0000 (UTC) Received: by mail-wm1-x32b.google.com with SMTP id n21so1395050wmq.5 for ; Fri, 23 Jul 2021 12:29:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5KPQdAtfUuAEZXdl1+FPSraE1XmWL2Gl8s1TvYt3hu8=; b=VsrD4GDEw74GSkXPag1dvThxvoaPzCMfrjjWKTcm1hvG6k/sH0f+tjKWi64+N7CmRH NMQ5voU1duzEoRBYPGBJq+r49nLTf9eKFVwG+cevhnIDvqIJjuYRTuIFC+9WtwFDDHdX ObJ+IEELOblcyuM9pWOTiC1y6aVuPXQvrsVj0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5KPQdAtfUuAEZXdl1+FPSraE1XmWL2Gl8s1TvYt3hu8=; b=eCDV6ynDjIbKAR4V8FAkEZVzvuTGzfggmNXMwoKdnQSpSzRIB3D31SphsG67Ya0Rzo Fsma9KpYb+IQ5p5oaovp9MGj6YFDFKNKiFprrMdTHNItO3H24Cx8kIMNa46OBvfaYj8/ 7gZoJvSGArxkO11KIiLVorIQI9qfxUZ3JDzMOngQeTcgwUy3HsS8yD3TyKEGvCerY1WM R4NArl3US+ceQB8yAmeYgE2ebpEmgKHZn3zx8+a0Zs78cx2d1TyY0cs2OSFNqCBWDaoa hL+LkDnN4+RA4r2d3t/8XIzWeMHgKHyCD0pOdrT3ikbknP/ToyN6vtYenhfMb0RE3WWG ed/g== X-Gm-Message-State: AOAM5333qI/KvAAzOvXY3p9lHA40eM/O3gn9hfW50Qs7nKZ0s6vZ8fJ+ LHCA9sYBwbyiuIqHG14dxBfI9DeWrIzfUg== X-Google-Smtp-Source: ABdhPJxvHFhJF5sgcIePbTk3e9dTjZ5PM01QGTfOOEeTW5s8eVHlwdl3QlIHhJNHSAZGkZM6jS3hFQ== X-Received: by 2002:a7b:c318:: with SMTP id k24mr6085109wmj.144.1627068586288; Fri, 23 Jul 2021 12:29:46 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id s14sm17609870wmc.25.2021.07.23.12.29.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jul 2021 12:29:45 -0700 (PDT) From: Daniel Vetter To: DRI Development Date: Fri, 23 Jul 2021 21:29:33 +0200 Message-Id: <20210723192934.1004427-9-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210723192934.1004427-1-daniel.vetter@ffwll.ch> References: <20210723192934.1004427-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 09/10] drm/i915: move vma slab to direct module init/exit 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: Daniel Vetter , Intel Graphics Development , Daniel Vetter Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" With the global kmem_cache shrink infrastructure gone there's nothing special and we can convert them over. I'm doing this split up into each patch because there's quite a bit of noise with removing the static global.slab_vmas to just a slab_vmas. We have to keep i915_drv.h include in i915_globals otherwise there's nothing anymore that pulls in GEM_BUG_ON. Cc: Jason Ekstrand Signed-off-by: Daniel Vetter Reported-by: kernel test robot Reviewed-by: Jason Ekstrand --- drivers/gpu/drm/i915/i915_globals.c | 3 +-- drivers/gpu/drm/i915/i915_globals.h | 3 --- drivers/gpu/drm/i915/i915_pci.c | 2 ++ drivers/gpu/drm/i915/i915_vma.c | 25 ++++++++----------------- drivers/gpu/drm/i915/i915_vma.h | 3 +++ 5 files changed, 14 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_globals.c b/drivers/gpu/drm/i915/i915_globals.c index 8923589057ab..04979789e7be 100644 --- a/drivers/gpu/drm/i915/i915_globals.c +++ b/drivers/gpu/drm/i915/i915_globals.c @@ -8,7 +8,7 @@ #include #include "i915_globals.h" -#include "i915_vma.h" +#include "i915_drv.h" static LIST_HEAD(globals); @@ -28,7 +28,6 @@ static void __i915_globals_cleanup(void) } static __initconst int (* const initfn[])(void) = { - i915_global_vma_init, }; int __init i915_globals_init(void) diff --git a/drivers/gpu/drm/i915/i915_globals.h b/drivers/gpu/drm/i915/i915_globals.h index 7a57bce1da05..57d2998bba45 100644 --- a/drivers/gpu/drm/i915/i915_globals.h +++ b/drivers/gpu/drm/i915/i915_globals.h @@ -22,7 +22,4 @@ void i915_global_register(struct i915_global *global); int i915_globals_init(void); void i915_globals_exit(void); -/* constructors */ -int i915_global_vma_init(void); - #endif /* _I915_GLOBALS_H_ */ diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c index a44318519977..0affcf33a211 100644 --- a/drivers/gpu/drm/i915/i915_pci.c +++ b/drivers/gpu/drm/i915/i915_pci.c @@ -40,6 +40,7 @@ #include "i915_globals.h" #include "i915_selftest.h" #include "i915_scheduler.h" +#include "i915_vma.h" #define PLATFORM(x) .platform = (x) #define GEN(x) \ @@ -1306,6 +1307,7 @@ static const struct { { i915_objects_module_init, i915_objects_module_exit }, { i915_request_module_init, i915_request_module_exit }, { i915_scheduler_module_init, i915_scheduler_module_exit }, + { i915_vma_module_init, i915_vma_module_exit }, { i915_globals_init, i915_globals_exit }, { i915_mock_selftests, NULL }, { i915_pmu_init, i915_pmu_exit }, diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c index 09a7c47926f7..d094e2016b93 100644 --- a/drivers/gpu/drm/i915/i915_vma.c +++ b/drivers/gpu/drm/i915/i915_vma.c @@ -34,24 +34,20 @@ #include "gt/intel_gt_requests.h" #include "i915_drv.h" -#include "i915_globals.h" #include "i915_sw_fence_work.h" #include "i915_trace.h" #include "i915_vma.h" -static struct i915_global_vma { - struct i915_global base; - struct kmem_cache *slab_vmas; -} global; +struct kmem_cache *slab_vmas; struct i915_vma *i915_vma_alloc(void) { - return kmem_cache_zalloc(global.slab_vmas, GFP_KERNEL); + return kmem_cache_zalloc(slab_vmas, GFP_KERNEL); } void i915_vma_free(struct i915_vma *vma) { - return kmem_cache_free(global.slab_vmas, vma); + return kmem_cache_free(slab_vmas, vma); } #if IS_ENABLED(CONFIG_DRM_I915_ERRLOG_GEM) && IS_ENABLED(CONFIG_DRM_DEBUG_MM) @@ -1414,21 +1410,16 @@ void i915_vma_make_purgeable(struct i915_vma *vma) #include "selftests/i915_vma.c" #endif -static void i915_global_vma_exit(void) +void i915_vma_module_exit(void) { - kmem_cache_destroy(global.slab_vmas); + kmem_cache_destroy(slab_vmas); } -static struct i915_global_vma global = { { - .exit = i915_global_vma_exit, -} }; - -int __init i915_global_vma_init(void) +int __init i915_vma_module_init(void) { - global.slab_vmas = KMEM_CACHE(i915_vma, SLAB_HWCACHE_ALIGN); - if (!global.slab_vmas) + slab_vmas = KMEM_CACHE(i915_vma, SLAB_HWCACHE_ALIGN); + if (!slab_vmas) return -ENOMEM; - i915_global_register(&global.base); return 0; } diff --git a/drivers/gpu/drm/i915/i915_vma.h b/drivers/gpu/drm/i915/i915_vma.h index eca452a9851f..ed69f66c7ab0 100644 --- a/drivers/gpu/drm/i915/i915_vma.h +++ b/drivers/gpu/drm/i915/i915_vma.h @@ -426,4 +426,7 @@ static inline int i915_vma_sync(struct i915_vma *vma) return i915_active_wait(&vma->active); } +void i915_vma_module_exit(void); +int i915_vma_module_init(void); + #endif