diff mbox series

[09/15] drm/i915: do more in i915_gpu_coredump_alloc()

Message ID d5f8aab89835a70c0af741e7f5765fc2c4875bf7.1695924021.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: i915_drv.h and i915_gpu_error.h include diet | expand

Commit Message

Jani Nikula Sept. 28, 2023, 6:08 p.m. UTC
Reduce gpu error interface further by doing more in
i915_gpu_coredump_alloc().

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 .../drm/i915/gt/intel_execlists_submission.c  | 16 +-------
 drivers/gpu/drm/i915/i915_gpu_error.c         | 38 +++++++++++++++++--
 drivers/gpu/drm/i915/i915_gpu_error.h         | 20 +---------
 3 files changed, 37 insertions(+), 37 deletions(-)

Comments

kernel test robot Sept. 29, 2023, 4:42 a.m. UTC | #1
Hi Jani,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-tip/drm-tip]

url:    https://github.com/intel-lab-lkp/linux/commits/Jani-Nikula/drm-i915-stop-including-i915_utils-h-from-intel_runtime_pm-h/20230929-021205
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
patch link:    https://lore.kernel.org/r/d5f8aab89835a70c0af741e7f5765fc2c4875bf7.1695924021.git.jani.nikula%40intel.com
patch subject: [Intel-gfx] [PATCH 09/15] drm/i915: do more in i915_gpu_coredump_alloc()
config: i386-buildonly-randconfig-005-20230929 (https://download.01.org/0day-ci/archive/20230929/202309291218.f8Nhsloo-lkp@intel.com/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230929/202309291218.f8Nhsloo-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309291218.f8Nhsloo-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/gpu/drm/i915/gt/intel_execlists_submission.c: In function 'capture_regs':
>> drivers/gpu/drm/i915/gt/intel_execlists_submission.c:2264:39: error: passing argument 1 of 'i915_gpu_coredump_alloc' from incompatible pointer type [-Werror=incompatible-pointer-types]
     cap->error = i915_gpu_coredump_alloc(engine, gfp);
                                          ^~~~~~
   In file included from drivers/gpu/drm/i915/i915_drv.h:56:0,
                    from drivers/gpu/drm/i915/gt/intel_execlists_submission.c:112:
   drivers/gpu/drm/i915/i915_gpu_error.h:329:1: note: expected 'struct drm_i915_private *' but argument is of type 'struct intel_engine_cs *'
    i915_gpu_coredump_alloc(struct drm_i915_private *i915, gfp_t gfp)
    ^~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +/i915_gpu_coredump_alloc +2264 drivers/gpu/drm/i915/gt/intel_execlists_submission.c

  2254	
  2255	static struct execlists_capture *capture_regs(struct intel_engine_cs *engine)
  2256	{
  2257		const gfp_t gfp = GFP_ATOMIC | __GFP_NOWARN;
  2258		struct execlists_capture *cap;
  2259	
  2260		cap = kmalloc(sizeof(*cap), gfp);
  2261		if (!cap)
  2262			return NULL;
  2263	
> 2264		cap->error = i915_gpu_coredump_alloc(engine, gfp);
  2265		if (!cap->error)
  2266			goto err_cap;
  2267	
  2268		return cap;
  2269	
  2270	err_cap:
  2271		kfree(cap);
  2272		return NULL;
  2273	}
  2274
kernel test robot Sept. 29, 2023, 6:18 a.m. UTC | #2
Hi Jani,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-tip/drm-tip]

url:    https://github.com/intel-lab-lkp/linux/commits/Jani-Nikula/drm-i915-stop-including-i915_utils-h-from-intel_runtime_pm-h/20230929-021205
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
patch link:    https://lore.kernel.org/r/d5f8aab89835a70c0af741e7f5765fc2c4875bf7.1695924021.git.jani.nikula%40intel.com
patch subject: [Intel-gfx] [PATCH 09/15] drm/i915: do more in i915_gpu_coredump_alloc()
config: x86_64-buildonly-randconfig-005-20230929 (https://download.01.org/0day-ci/archive/20230929/202309291431.3pKN8WtO-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230929/202309291431.3pKN8WtO-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309291431.3pKN8WtO-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/i915/i915_gpu_error.c:1547:1: warning: no previous prototype for 'intel_engine_coredump_alloc' [-Wmissing-prototypes]
    1547 | intel_engine_coredump_alloc(struct intel_engine_cs *engine, gfp_t gfp, u32 dump_flags)
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/intel_engine_coredump_alloc +1547 drivers/gpu/drm/i915/i915_gpu_error.c

ff20afc4cee7b6 Thomas Hellström 2021-11-29  1545  
742379c0c4001f Chris Wilson     2020-01-10  1546  struct intel_engine_coredump *
a6f0f9cf330a86 Alan Previn      2022-03-21 @1547  intel_engine_coredump_alloc(struct intel_engine_cs *engine, gfp_t gfp, u32 dump_flags)
742379c0c4001f Chris Wilson     2020-01-10  1548  {
742379c0c4001f Chris Wilson     2020-01-10  1549  	struct intel_engine_coredump *ee;
742379c0c4001f Chris Wilson     2020-01-10  1550  
742379c0c4001f Chris Wilson     2020-01-10  1551  	ee = kzalloc(sizeof(*ee), gfp);
c990b4c3597d6c Chris Wilson     2019-08-08  1552  	if (!ee)
742379c0c4001f Chris Wilson     2020-01-10  1553  		return NULL;
c990b4c3597d6c Chris Wilson     2019-08-08  1554  
742379c0c4001f Chris Wilson     2020-01-10  1555  	ee->engine = engine;
372fbb8e3927fc Chris Wilson     2014-01-27  1556  
a6f0f9cf330a86 Alan Previn      2022-03-21  1557  	if (!(dump_flags & CORE_DUMP_FLAG_IS_GUC_CAPTURE)) {
742379c0c4001f Chris Wilson     2020-01-10  1558  		engine_record_registers(ee);
742379c0c4001f Chris Wilson     2020-01-10  1559  		engine_record_execlists(ee);
a6f0f9cf330a86 Alan Previn      2022-03-21  1560  	}
3bdd4f84853106 Chris Wilson     2019-07-22  1561  
742379c0c4001f Chris Wilson     2020-01-10  1562  	return ee;
c990b4c3597d6c Chris Wilson     2019-08-08  1563  }
ae6c4806927b8b Daniel Vetter    2014-08-06  1564
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
index e8f42ec6b1b4..7c7e8c3a12e0 100644
--- a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
+++ b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
@@ -2261,26 +2261,12 @@  static struct execlists_capture *capture_regs(struct intel_engine_cs *engine)
 	if (!cap)
 		return NULL;
 
-	cap->error = i915_gpu_coredump_alloc(engine->i915, gfp);
+	cap->error = i915_gpu_coredump_alloc(engine, gfp);
 	if (!cap->error)
 		goto err_cap;
 
-	cap->error->gt = intel_gt_coredump_alloc(engine->gt, gfp, CORE_DUMP_FLAG_NONE);
-	if (!cap->error->gt)
-		goto err_gpu;
-
-	cap->error->gt->engine = intel_engine_coredump_alloc(engine, gfp, CORE_DUMP_FLAG_NONE);
-	if (!cap->error->gt->engine)
-		goto err_gt;
-
-	cap->error->gt->engine->hung = true;
-
 	return cap;
 
-err_gt:
-	kfree(cap->error->gt);
-err_gpu:
-	kfree(cap->error);
 err_cap:
 	kfree(cap);
 	return NULL;
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 9b1bb5aeec11..e4185f30f07c 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -63,6 +63,9 @@ 
 #define ALLOW_FAIL (__GFP_KSWAPD_RECLAIM | __GFP_RETRY_MAYFAIL | __GFP_NOWARN)
 #define ATOMIC_MAYFAIL (GFP_ATOMIC | __GFP_NOWARN)
 
+struct intel_gt_coredump *
+intel_gt_coredump_alloc(struct intel_gt *gt, gfp_t gfp, u32 dump_flags);
+
 static void __sg_set_buf(struct scatterlist *sg,
 			 void *addr, unsigned int len, loff_t it)
 {
@@ -2005,8 +2008,8 @@  static void capture_gen(struct i915_gpu_coredump *error)
 	error->driver_caps = i915->caps;
 }
 
-struct i915_gpu_coredump *
-i915_gpu_coredump_alloc(struct drm_i915_private *i915, gfp_t gfp)
+static struct i915_gpu_coredump *
+__i915_gpu_coredump_alloc(struct drm_i915_private *i915, gfp_t gfp)
 {
 	struct i915_gpu_coredump *error;
 
@@ -2030,6 +2033,35 @@  i915_gpu_coredump_alloc(struct drm_i915_private *i915, gfp_t gfp)
 	return error;
 }
 
+struct i915_gpu_coredump *
+i915_gpu_coredump_alloc(struct intel_engine_cs *engine, gfp_t gfp)
+{
+	struct i915_gpu_coredump *error;
+
+	error = __i915_gpu_coredump_alloc(engine->i915, gfp);
+	if (!error)
+		return NULL;
+
+	error->gt = intel_gt_coredump_alloc(engine->gt, gfp, CORE_DUMP_FLAG_NONE);
+	if (!error->gt)
+		goto err_gpu;
+
+	error->gt->engine = intel_engine_coredump_alloc(engine, gfp, CORE_DUMP_FLAG_NONE);
+	if (!error->gt->engine)
+		goto err_gt;
+
+	error->gt->engine->hung = true;
+
+	return error;
+
+err_gt:
+	kfree(error->gt);
+err_gpu:
+	kfree(error);
+
+	return NULL;
+}
+
 #define DAY_AS_SECONDS(x) (24 * 60 * 60 * (x))
 
 struct intel_gt_coredump *
@@ -2102,7 +2134,7 @@  __i915_gpu_coredump(struct intel_gt *gt, intel_engine_mask_t engine_mask, u32 du
 	if (IS_ERR(error))
 		return error;
 
-	error = i915_gpu_coredump_alloc(i915, ALLOW_FAIL);
+	error = __i915_gpu_coredump_alloc(i915, ALLOW_FAIL);
 	if (!error)
 		return ERR_PTR(-ENOMEM);
 
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.h b/drivers/gpu/drm/i915/i915_gpu_error.h
index f6f8d284a07d..0439dde95344 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.h
+++ b/drivers/gpu/drm/i915/i915_gpu_error.h
@@ -280,13 +280,7 @@  void i915_capture_error_state(struct intel_gt *gt,
 			      intel_engine_mask_t engine_mask, u32 dump_flags);
 
 struct i915_gpu_coredump *
-i915_gpu_coredump_alloc(struct drm_i915_private *i915, gfp_t gfp);
-
-struct intel_gt_coredump *
-intel_gt_coredump_alloc(struct intel_gt *gt, gfp_t gfp, u32 dump_flags);
-
-struct intel_engine_coredump *
-intel_engine_coredump_alloc(struct intel_engine_cs *engine, gfp_t gfp, u32 dump_flags);
+i915_gpu_coredump_alloc(struct intel_engine_cs *engine, gfp_t gfp);
 
 struct intel_engine_capture_vma *
 intel_engine_coredump_add_request(struct intel_engine_coredump *ee,
@@ -337,18 +331,6 @@  i915_gpu_coredump_alloc(struct drm_i915_private *i915, gfp_t gfp)
 	return NULL;
 }
 
-static inline struct intel_gt_coredump *
-intel_gt_coredump_alloc(struct intel_gt *gt, gfp_t gfp, u32 dump_flags)
-{
-	return NULL;
-}
-
-static inline struct intel_engine_coredump *
-intel_engine_coredump_alloc(struct intel_engine_cs *engine, gfp_t gfp, u32 dump_flags)
-{
-	return NULL;
-}
-
 static inline struct intel_engine_capture_vma *
 intel_engine_coredump_add_request(struct intel_engine_coredump *ee,
 				  struct i915_request *rq,