Re: [Intel-gfx] [PATCH 2/6] drm/i915/gem: Almagamate clflushes on freeze

2021-01-23 Thread Chris Wilson
Quoting Guenter Roeck (2021-01-23 14:46:33)
> On Tue, Jan 19, 2021 at 02:49:08PM +, Chris Wilson wrote:
> > When flushing objects larger than the CPU cache it is preferrable to use
> > a single wbinvd() rather than overlapping clflush(). At runtime, we
> > avoid wbinvd() due to its system-wide latencies, but during
> > singlethreaded suspend, no one will observe the imposed latency and we
> > can opt for the faster wbinvd to clear all objects in a single hit.
> > 
> > Signed-off-by: Chris Wilson 
> > Reviewed-by: Matthew Auld 
> > ---
> >  drivers/gpu/drm/i915/i915_gem.c | 16 +---
> >  1 file changed, 5 insertions(+), 11 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_gem.c 
> > b/drivers/gpu/drm/i915/i915_gem.c
> > index c013148835e6..d3a287bf56c5 100644
> > --- a/drivers/gpu/drm/i915/i915_gem.c
> > +++ b/drivers/gpu/drm/i915/i915_gem.c
> > @@ -1175,19 +1175,13 @@ int i915_gem_freeze_late(struct drm_i915_private 
> > *i915)
> >* the objects as well, see i915_gem_freeze()
> >*/
> >  
> > - wakeref = intel_runtime_pm_get(&i915->runtime_pm);
> > -
> > - i915_gem_shrink(i915, -1UL, NULL, ~0);
> > + with_intel_runtime_pm(&i915->runtime_pm, wakeref)
> > + i915_gem_shrink(i915, -1UL, NULL, ~0);
> >   i915_gem_drain_freed_objects(i915);
> >  
> > - list_for_each_entry(obj, &i915->mm.shrink_list, mm.link) {
> > - i915_gem_object_lock(obj, NULL);
> > - drm_WARN_ON(&i915->drm,
> > - i915_gem_object_set_to_cpu_domain(obj, true));
> > - i915_gem_object_unlock(obj);
> > - }
> > -
> > - intel_runtime_pm_put(&i915->runtime_pm, wakeref);
> > + wbinvd_on_all_cpus();
> 
> with CONFIG_SMP=n, this results in:
> 
> drivers/gpu/drm/i915/i915_gem.c: In function 'i915_gem_freeze_late':
> drivers/gpu/drm/i915/i915_gem.c:1182:2: error: implicit declaration of 
> function 'wbinvd_on_all_cpus'
> 
> Other drivers calling this function include .

I mistakenly thought this was next to i915_gem_suspend...
-Chris
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 2/6] drm/i915/gem: Almagamate clflushes on freeze

2021-01-23 Thread Guenter Roeck
On Tue, Jan 19, 2021 at 02:49:08PM +, Chris Wilson wrote:
> When flushing objects larger than the CPU cache it is preferrable to use
> a single wbinvd() rather than overlapping clflush(). At runtime, we
> avoid wbinvd() due to its system-wide latencies, but during
> singlethreaded suspend, no one will observe the imposed latency and we
> can opt for the faster wbinvd to clear all objects in a single hit.
> 
> Signed-off-by: Chris Wilson 
> Reviewed-by: Matthew Auld 
> ---
>  drivers/gpu/drm/i915/i915_gem.c | 16 +---
>  1 file changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index c013148835e6..d3a287bf56c5 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1175,19 +1175,13 @@ int i915_gem_freeze_late(struct drm_i915_private 
> *i915)
>* the objects as well, see i915_gem_freeze()
>*/
>  
> - wakeref = intel_runtime_pm_get(&i915->runtime_pm);
> -
> - i915_gem_shrink(i915, -1UL, NULL, ~0);
> + with_intel_runtime_pm(&i915->runtime_pm, wakeref)
> + i915_gem_shrink(i915, -1UL, NULL, ~0);
>   i915_gem_drain_freed_objects(i915);
>  
> - list_for_each_entry(obj, &i915->mm.shrink_list, mm.link) {
> - i915_gem_object_lock(obj, NULL);
> - drm_WARN_ON(&i915->drm,
> - i915_gem_object_set_to_cpu_domain(obj, true));
> - i915_gem_object_unlock(obj);
> - }
> -
> - intel_runtime_pm_put(&i915->runtime_pm, wakeref);
> + wbinvd_on_all_cpus();

with CONFIG_SMP=n, this results in:

drivers/gpu/drm/i915/i915_gem.c: In function 'i915_gem_freeze_late':
drivers/gpu/drm/i915/i915_gem.c:1182:2: error: implicit declaration of function 
'wbinvd_on_all_cpus'

Other drivers calling this function include .

Guenter

> + list_for_each_entry(obj, &i915->mm.shrink_list, mm.link)
> + __start_cpu_write(obj);
>  
>   return 0;
>  }
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 2/6] drm/i915/gem: Almagamate clflushes on freeze

2021-01-19 Thread Matthew Auld
On Tue, 19 Jan 2021 at 14:49, Chris Wilson  wrote:
>
> When flushing objects larger than the CPU cache it is preferrable to use
> a single wbinvd() rather than overlapping clflush(). At runtime, we
> avoid wbinvd() due to its system-wide latencies, but during
> singlethreaded suspend, no one will observe the imposed latency and we
> can opt for the faster wbinvd to clear all objects in a single hit.
>
> Signed-off-by: Chris Wilson 
Reviewed-by: Matthew Auld 
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 2/6] drm/i915/gem: Almagamate clflushes on freeze

2021-01-19 Thread Chris Wilson
When flushing objects larger than the CPU cache it is preferrable to use
a single wbinvd() rather than overlapping clflush(). At runtime, we
avoid wbinvd() due to its system-wide latencies, but during
singlethreaded suspend, no one will observe the imposed latency and we
can opt for the faster wbinvd to clear all objects in a single hit.

Signed-off-by: Chris Wilson 
---
 drivers/gpu/drm/i915/i915_gem.c | 16 +---
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index c013148835e6..d3a287bf56c5 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1175,19 +1175,13 @@ int i915_gem_freeze_late(struct drm_i915_private *i915)
 * the objects as well, see i915_gem_freeze()
 */
 
-   wakeref = intel_runtime_pm_get(&i915->runtime_pm);
-
-   i915_gem_shrink(i915, -1UL, NULL, ~0);
+   with_intel_runtime_pm(&i915->runtime_pm, wakeref)
+   i915_gem_shrink(i915, -1UL, NULL, ~0);
i915_gem_drain_freed_objects(i915);
 
-   list_for_each_entry(obj, &i915->mm.shrink_list, mm.link) {
-   i915_gem_object_lock(obj, NULL);
-   drm_WARN_ON(&i915->drm,
-   i915_gem_object_set_to_cpu_domain(obj, true));
-   i915_gem_object_unlock(obj);
-   }
-
-   intel_runtime_pm_put(&i915->runtime_pm, wakeref);
+   wbinvd_on_all_cpus();
+   list_for_each_entry(obj, &i915->mm.shrink_list, mm.link)
+   __start_cpu_write(obj);
 
return 0;
 }
-- 
2.20.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx