Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-xe] [PATCH 0/1] Remove uses of BUG_ON
@ 2023-07-21 13:20 Francois Dugast
  2023-07-21 13:20 ` [Intel-xe] [PATCH 1/1] drm/xe: " Francois Dugast
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Francois Dugast @ 2023-07-21 13:20 UTC (permalink / raw)
  To: intel-xe; +Cc: Francois Dugast

This is a first pass on removing BUG_ON. It is replaced with a call to
drm_err() and a return. Feedback on this is welcome before removing
remaining uses of BUG_ON, which will require more manual and specific
work.

For this pass, most of the changes were automated with coccinelle using:

	@notpossible@
	@@

	- XE_BUG_ON("NOT POSSIBLE");
	+ drm_err(&vm->xe->drm, "NOT POSSIBLE");
	+ return -EINVAL;

	@e@
	identifier macro =~ "^XE_BUG_ON$";
	expression cond;
	@@
	macro(cond)

	@script : python q@
	cond << e.cond;
	cond_expr;
	@@
	coccinelle.cond_expr = cocci.make_expr("\""+cond.replace(" ", "")+"\"");

	@replace_in_func_return_struct@
	identifier e.macro;
	expression e.cond;
	expression q.cond_expr;
	identifier func;
	identifier a;
	@@

	struct a *func(...) {
	...
	- macro(cond);
	+ if (cond) {
	+ drm_err(&xe->drm, cond_expr);
	+ return NULL;
	+ }
	...
	}

	@replace_in_func_return_void@
	identifier e.macro;
	expression e.cond;
	expression q.cond_expr;
	identifier func;
	@@

	void func(...) {
	...
	- macro(cond);
	+ if (cond) {
	+ drm_err(&xe->drm, cond_expr);
	+ return;
	+ }
	...
	}

	@replace_in_func_return_other@
	identifier e.macro;
	expression e.cond;
	expression q.cond_expr;
	@@

	- macro(cond);
	+ if (cond) {
	+ drm_err(&xe->drm, cond_expr);
	+ return -EINVAL;
	+ }

Francois Dugast (1):
  drm/xe: Remove uses of BUG_ON

 drivers/gpu/drm/xe/xe_bo.c                  | 105 ++++++++++++----
 drivers/gpu/drm/xe/xe_bo_evict.c            |  10 +-
 drivers/gpu/drm/xe/xe_execlist.c            |  22 +++-
 drivers/gpu/drm/xe/xe_force_wake.c          |  10 +-
 drivers/gpu/drm/xe/xe_gt_clock.c            |   5 +-
 drivers/gpu/drm/xe/xe_gt_debugfs.c          |   5 +-
 drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c |  31 ++++-
 drivers/gpu/drm/xe/xe_guc.c                 |  32 +++--
 drivers/gpu/drm/xe/xe_guc_ads.c             |  35 ++++--
 drivers/gpu/drm/xe/xe_guc_hwconfig.c        |   5 +-
 drivers/gpu/drm/xe/xe_guc_submit.c          |  95 +++++++++++----
 drivers/gpu/drm/xe/xe_huc.c                 |   5 +-
 drivers/gpu/drm/xe/xe_migrate.c             |  61 ++++++++--
 drivers/gpu/drm/xe/xe_sched_job.c           |   9 +-
 drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c      |  10 +-
 drivers/gpu/drm/xe/xe_vm.c                  | 125 +++++++++++++++-----
 drivers/gpu/drm/xe/xe_wopcm.c               |  45 +++++--
 17 files changed, 482 insertions(+), 128 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-07-24 18:27 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-21 13:20 [Intel-xe] [PATCH 0/1] Remove uses of BUG_ON Francois Dugast
2023-07-21 13:20 ` [Intel-xe] [PATCH 1/1] drm/xe: " Francois Dugast
2023-07-24 18:26   ` Rodrigo Vivi
2023-07-21 13:34 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
2023-07-21 13:34 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-07-21 13:35 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-07-21 13:39 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-07-21 13:39 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-07-21 13:40 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-07-21 14:08 ` [Intel-xe] ○ CI.BAT: info " Patchwork
2023-07-21 15:50 ` [Intel-xe] [PATCH 0/1] " Matthew Brost
2023-07-24 18:24   ` Rodrigo Vivi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox