Re: [Intel-gfx] [PATCH v2 07/15] drm/i915/guc: Flush directly in log unregister
On 3/8/2018 9:16 PM, Michał Winiarski wrote: Having both guc_flush_logs and guc_log_flush functions is confusing. While we could just rename things, guc_flush_logs implementation is quite simple. Let's get rid of it and move its content to unregister. v2: s/dev_priv/i915 (Sagar) Signed-off-by: Michał Winiarski Cc: Chris Wilson Cc: Daniele Ceraolo Spurio Cc: Sagar Arun Kamble Cc: Michal Wajdeczko Reviewed-by: Sagar Arun Kamble --- drivers/gpu/drm/i915/intel_guc_log.c | 34 ++ 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_guc_log.c b/drivers/gpu/drm/i915/intel_guc_log.c index ee0981f5a208..5ff4b510569a 100644 --- a/drivers/gpu/drm/i915/intel_guc_log.c +++ b/drivers/gpu/drm/i915/intel_guc_log.c @@ -443,25 +443,6 @@ static void guc_log_capture_logs(struct intel_guc *guc) intel_runtime_pm_put(dev_priv); } -static void guc_flush_logs(struct intel_guc *guc) -{ - struct drm_i915_private *dev_priv = guc_to_i915(guc); - - /* -* Before initiating the forceful flush, wait for any pending/ongoing -* flush to complete otherwise forceful flush may not actually happen. -*/ - flush_work(&guc->log.runtime.flush_work); - - /* Ask GuC to update the log buffer state */ - intel_runtime_pm_get(dev_priv); - guc_log_flush(guc); - intel_runtime_pm_put(dev_priv); - - /* GuC would have updated log buffer by now, so capture it */ - guc_log_capture_logs(guc); -} - int intel_guc_log_create(struct intel_guc *guc) { struct i915_vma *vma; @@ -630,15 +611,28 @@ int intel_guc_log_register(struct intel_guc *guc) void intel_guc_log_unregister(struct intel_guc *guc) { + struct drm_i915_private *i915 = guc_to_i915(guc); + guc_log_flush_irq_disable(guc); + /* +* Before initiating the forceful flush, wait for any pending/ongoing +* flush to complete otherwise forceful flush may not actually happen. +*/ + flush_work(&guc->log.runtime.flush_work); + /* * Once logging is disabled, GuC won't generate logs & send an * interrupt. But there could be some data in the log buffer * which is yet to be captured. So request GuC to update the log * buffer state and then collect the left over logs. */ - guc_flush_logs(guc); + intel_runtime_pm_get(i915); + guc_log_flush(guc); + intel_runtime_pm_put(i915); + + /* GuC would have updated log buffer by now, so capture it */ + guc_log_capture_logs(guc); mutex_lock(&guc->log.runtime.lock); -- Thanks, Sagar ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH v2 07/15] drm/i915/guc: Flush directly in log unregister
Having both guc_flush_logs and guc_log_flush functions is confusing. While we could just rename things, guc_flush_logs implementation is quite simple. Let's get rid of it and move its content to unregister. v2: s/dev_priv/i915 (Sagar) Signed-off-by: Michał Winiarski Cc: Chris Wilson Cc: Daniele Ceraolo Spurio Cc: Sagar Arun Kamble Cc: Michal Wajdeczko --- drivers/gpu/drm/i915/intel_guc_log.c | 34 ++ 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_guc_log.c b/drivers/gpu/drm/i915/intel_guc_log.c index ee0981f5a208..5ff4b510569a 100644 --- a/drivers/gpu/drm/i915/intel_guc_log.c +++ b/drivers/gpu/drm/i915/intel_guc_log.c @@ -443,25 +443,6 @@ static void guc_log_capture_logs(struct intel_guc *guc) intel_runtime_pm_put(dev_priv); } -static void guc_flush_logs(struct intel_guc *guc) -{ - struct drm_i915_private *dev_priv = guc_to_i915(guc); - - /* -* Before initiating the forceful flush, wait for any pending/ongoing -* flush to complete otherwise forceful flush may not actually happen. -*/ - flush_work(&guc->log.runtime.flush_work); - - /* Ask GuC to update the log buffer state */ - intel_runtime_pm_get(dev_priv); - guc_log_flush(guc); - intel_runtime_pm_put(dev_priv); - - /* GuC would have updated log buffer by now, so capture it */ - guc_log_capture_logs(guc); -} - int intel_guc_log_create(struct intel_guc *guc) { struct i915_vma *vma; @@ -630,15 +611,28 @@ int intel_guc_log_register(struct intel_guc *guc) void intel_guc_log_unregister(struct intel_guc *guc) { + struct drm_i915_private *i915 = guc_to_i915(guc); + guc_log_flush_irq_disable(guc); + /* +* Before initiating the forceful flush, wait for any pending/ongoing +* flush to complete otherwise forceful flush may not actually happen. +*/ + flush_work(&guc->log.runtime.flush_work); + /* * Once logging is disabled, GuC won't generate logs & send an * interrupt. But there could be some data in the log buffer * which is yet to be captured. So request GuC to update the log * buffer state and then collect the left over logs. */ - guc_flush_logs(guc); + intel_runtime_pm_get(i915); + guc_log_flush(guc); + intel_runtime_pm_put(i915); + + /* GuC would have updated log buffer by now, so capture it */ + guc_log_capture_logs(guc); mutex_lock(&guc->log.runtime.lock); -- 2.14.3 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx