drm/vc4: Binner BO management improvements

Submitted by Paul Kocialkowski on March 20, 2019, 3:48 p.m.

Details

Reviewer None
Submitted March 20, 2019, 3:48 p.m.
Last Updated May 16, 2019, 2:56 p.m.
Revision 8

Cover Letter(s)

Revision 1
      Changes since v1:
* Squashed the two final patches into one.

Paul Kocialkowski (2):
  drm/file: Rehabilitate the firstopen hook for non-legacy drivers
  drm/vc4: Allocated/liberate the binner BO at firstopen/lastclose

 drivers/gpu/drm/drm_file.c    |  3 +--
 drivers/gpu/drm/vc4/vc4_drv.c | 26 ++++++++++++++++++++++++++
 drivers/gpu/drm/vc4/vc4_drv.h |  1 +
 drivers/gpu/drm/vc4/vc4_irq.c |  3 +++
 drivers/gpu/drm/vc4/vc4_v3d.c | 15 +--------------
 include/drm/drm_drv.h         |  2 +-
 6 files changed, 33 insertions(+), 17 deletions(-)
    
Revision 2
      Changes since v2:
* Removed deprecated sentence about fristopen;
* Added collected Reviewed-By tags.

Changes since v1:
* Squashed the two final patches into one.

Paul Kocialkowski (2):
  drm/file: Rehabilitate the firstopen hook for non-legacy drivers
  drm/vc4: Allocated/liberate the binner BO at firstopen/lastclose

 drivers/gpu/drm/drm_file.c    |  3 +--
 drivers/gpu/drm/vc4/vc4_drv.c | 26 ++++++++++++++++++++++++++
 drivers/gpu/drm/vc4/vc4_drv.h |  1 +
 drivers/gpu/drm/vc4/vc4_irq.c |  3 +++
 drivers/gpu/drm/vc4/vc4_v3d.c | 15 +--------------
 include/drm/drm_drv.h         |  3 ---
 6 files changed, 32 insertions(+), 19 deletions(-)
    
Revision 3
      Changes since v3:
* Split changes into more commits when possible;
* Reworked binner bo alloc condition as discussed.

Changes since v2:
* Removed deprecated sentence about fristopen;
* Added collected Reviewed-By tags.

Changes since v1:
* Squashed the two final patches into one.

Paul Kocialkowski (4):
  drm/vc4: Reformat and export binner bo allocation helper
  drm/vc4: Check for V3D before binner bo alloc
  drm/vc4: Check for the binner bo before handling OOM interrupt
  drm/vc4: Allocate binner bo when starting to use the V3D

 drivers/gpu/drm/vc4/vc4_bo.c  | 32 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/vc4/vc4_drv.c |  9 +++++++++
 drivers/gpu/drm/vc4/vc4_drv.h |  5 +++++
 drivers/gpu/drm/vc4/vc4_irq.c |  3 +++
 drivers/gpu/drm/vc4/vc4_v3d.c | 23 ++++++-----------------
 5 files changed, 55 insertions(+), 17 deletions(-)
    
Revision 4
      Changes since v4:
* Used a kref on the binner bo instead of firstopen/lastclose;
* Added a mutex to prevent race conditions;
* Took care of enabling the OOM interrupt when we have a binner BO allocated.

Changes since v3:
* Split changes into more commits when possible;
* Reworked binner bo alloc condition as discussed.

Changes since v2:
* Removed deprecated sentence about fristopen;
* Added collected Reviewed-By tags.

Changes since v1:
* Squashed the two final patches into one.

Paul Kocialkowski (4):
  drm/vc4: Reformat and export binner bo allocation helper
  drm/vc4: Check for V3D before binner bo alloc
  drm/vc4: Check for the binner bo before handling OOM interrupt
  drm/vc4: Allocate binner bo when starting to use the V3D

 drivers/gpu/drm/vc4/vc4_bo.c  | 30 ++++++++++++++++++
 drivers/gpu/drm/vc4/vc4_drv.c | 17 +++++++++++
 drivers/gpu/drm/vc4/vc4_drv.h | 10 ++++++
 drivers/gpu/drm/vc4/vc4_irq.c |  9 ++++--
 drivers/gpu/drm/vc4/vc4_v3d.c | 57 ++++++++++++++++++++++++-----------
 5 files changed, 104 insertions(+), 19 deletions(-)
    
Revision 5
      Changes since v5:
* Fix more locking mistakes;
* Introduce get/put helpers;
* Grabbed a reference when submitting an exec job with a binner slot.
* Addressed misc comments.

Changes since v4:
* Used a kref on the binner bo instead of firstopen/lastclose;
* Added a mutex to prevent race conditions;
* Took care of enabling the OOM interrupt when we have a binner BO allocated.

Changes since v3:
* Split changes into more commits when possible;
* Reworked binner bo alloc condition as discussed.

Changes since v2:
* Removed deprecated sentence about fristopen;
* Added collected Reviewed-By tags.

Changes since v1:
* Squashed the two final patches into one.

Paul Kocialkowski (4):
  drm/vc4: Reformat and the binner bo allocation helper
  drm/vc4: Check for V3D before binner bo alloc
  drm/vc4: Check for the binner bo before handling OOM interrupt
  drm/vc4: Allocate binner bo when starting to use the V3D

 drivers/gpu/drm/vc4/vc4_bo.c  | 45 +++++++++++++++++++++--
 drivers/gpu/drm/vc4/vc4_drv.c |  6 ++++
 drivers/gpu/drm/vc4/vc4_drv.h | 14 ++++++++
 drivers/gpu/drm/vc4/vc4_gem.c | 13 +++++++
 drivers/gpu/drm/vc4/vc4_irq.c | 20 ++++++++---
 drivers/gpu/drm/vc4/vc4_v3d.c | 68 ++++++++++++++++++++++++++---------
 6 files changed, 142 insertions(+), 24 deletions(-)
    
Revision 6
      Changes since v6:
* Removed vc4_v3d_bin_bo_put from error paths;
* Added WARN_ON_ONCE when no bin BO at refcount release.

Changes since v5:
* Fix more locking mistakes;
* Introduce get/put helpers;
* Grabbed a reference when submitting an exec job with a binner slot.
* Addressed misc comments.

Changes since v4:
* Used a kref on the binner bo instead of firstopen/lastclose;
* Added a mutex to prevent race conditions;
* Took care of enabling the OOM interrupt when we have a binner BO allocated.

Changes since v3:
* Split changes into more commits when possible;
* Reworked binner bo alloc condition as discussed.

Changes since v2:
* Removed deprecated sentence about fristopen;
* Added collected Reviewed-By tags.

Changes since v1:
* Squashed the two final patches into one.

Paul Kocialkowski (4):
  drm/vc4: Reformat and the binner bo allocation helper
  drm/vc4: Check for V3D before binner bo alloc
  drm/vc4: Check for the binner bo before handling OOM interrupt
  drm/vc4: Allocate binner bo when starting to use the V3D

 drivers/gpu/drm/vc4/vc4_bo.c  | 33 ++++++++++++++++-
 drivers/gpu/drm/vc4/vc4_drv.c |  6 ++++
 drivers/gpu/drm/vc4/vc4_drv.h | 14 ++++++++
 drivers/gpu/drm/vc4/vc4_gem.c | 13 +++++++
 drivers/gpu/drm/vc4/vc4_irq.c | 20 ++++++++---
 drivers/gpu/drm/vc4/vc4_v3d.c | 68 ++++++++++++++++++++++++++---------
 6 files changed, 132 insertions(+), 22 deletions(-)
    
Revision 7
      Changes since v7:
* Moved the used bool to vc4_v3d_bin_bo_get in order to check it locked and
  avoid a possible race condition;

Changes since v6:
* Removed vc4_v3d_bin_bo_put from error paths;
* Added WARN_ON_ONCE when no bin BO at refcount release.

Changes since v5:
* Fix more locking mistakes;
* Introduce get/put helpers;
* Grabbed a reference when submitting an exec job with a binner slot.
* Addressed misc comments.

Changes since v4:
* Used a kref on the binner bo instead of firstopen/lastclose;
* Added a mutex to prevent race conditions;
* Took care of enabling the OOM interrupt when we have a binner BO allocated.

Changes since v3:
* Split changes into more commits when possible;
* Reworked binner bo alloc condition as discussed.

Changes since v2:
* Removed deprecated sentence about fristopen;
* Added collected Reviewed-By tags.

Changes since v1:
* Squashed the two final patches into one.

Paul Kocialkowski (4):
  drm/vc4: Reformat and the binner bo allocation helper
  drm/vc4: Check for V3D before binner bo alloc
  drm/vc4: Check for the binner bo before handling OOM interrupt
  drm/vc4: Allocate binner bo when starting to use the V3D

 drivers/gpu/drm/vc4/vc4_bo.c  | 31 ++++++++++++++-
 drivers/gpu/drm/vc4/vc4_drv.c |  6 +++
 drivers/gpu/drm/vc4/vc4_drv.h | 14 +++++++
 drivers/gpu/drm/vc4/vc4_gem.c | 11 ++++++
 drivers/gpu/drm/vc4/vc4_irq.c | 20 ++++++++--
 drivers/gpu/drm/vc4/vc4_v3d.c | 74 +++++++++++++++++++++++++++--------
 6 files changed, 134 insertions(+), 22 deletions(-)
    
Revision 8
      Changes sinve v8:
* Added collected Reviewed-by;
* Fixed up another problematic case as discussed on v8.

Changes since v7:
* Moved the used bool to vc4_v3d_bin_bo_get in order to check it locked and
  avoid a possible race condition;

Changes since v6:
* Removed vc4_v3d_bin_bo_put from error paths;
* Added WARN_ON_ONCE when no bin BO at refcount release.

Changes since v5:
* Fix more locking mistakes;
* Introduce get/put helpers;
* Grabbed a reference when submitting an exec job with a binner slot.
* Addressed misc comments.

Changes since v4:
* Used a kref on the binner bo instead of firstopen/lastclose;
* Added a mutex to prevent race conditions;
* Took care of enabling the OOM interrupt when we have a binner BO allocated.

Changes since v3:
* Split changes into more commits when possible;
* Reworked binner bo alloc condition as discussed.

Changes since v2:
* Removed deprecated sentence about fristopen;
* Added collected Reviewed-By tags.

Changes since v1:
* Squashed the two final patches into one.

Paul Kocialkowski (4):
  drm/vc4: Reformat and the binner bo allocation helper
  drm/vc4: Check for V3D before binner bo alloc
  drm/vc4: Check for the binner bo before handling OOM interrupt
  drm/vc4: Allocate binner bo when starting to use the V3D

 drivers/gpu/drm/vc4/vc4_bo.c  | 31 ++++++++++++++-
 drivers/gpu/drm/vc4/vc4_drv.c |  6 +++
 drivers/gpu/drm/vc4/vc4_drv.h | 14 +++++++
 drivers/gpu/drm/vc4/vc4_gem.c | 11 ++++++
 drivers/gpu/drm/vc4/vc4_irq.c | 20 ++++++++--
 drivers/gpu/drm/vc4/vc4_v3d.c | 72 ++++++++++++++++++++++++++---------
 6 files changed, 132 insertions(+), 22 deletions(-)
    

Revisions