[igt-dev] [PATCH igt] lib: Avoid rcu_barrier() for gem_quiescent_gpu()
Antonio Argenziano
antonio.argenziano at intel.com
Thu Feb 1 17:23:45 UTC 2018
On 31/01/18 01:35, Chris Wilson wrote:
> Using DROP_FREED invokes an rcu_barrier() to ensure that all RCU
> protected objects are freed before it returns. rcu_barrier() is a very
> high latency operation (~50ms at best) which is only required under
> specific circumstances such as when we need a stable object count. By
Do we expect those specific circumstances to be of interest in our
testing? Or better, do we need a gem_quiescent_gpu that waits on all RCU
protected objects?
> removing it from gem_quiescent_gpu() we can save over 10s across a BAT
> run.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
> lib/drmtest.c | 3 +--
> lib/igt_debugfs.c | 14 ++++++++------
> lib/intel_os.c | 15 +++++++++------
> 3 files changed, 18 insertions(+), 14 deletions(-)
>
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index fd11f5f58..40bd6fec8 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -163,8 +163,7 @@ void gem_quiescent_gpu(int fd)
> {
> igt_terminate_spin_batches();
>
> - igt_drop_caches_set(fd,
> - DROP_ACTIVE | DROP_RETIRE | DROP_IDLE | DROP_FREED);
> + igt_drop_caches_set(fd, DROP_ACTIVE | DROP_RETIRE | DROP_IDLE);
> }
>
> /**
> diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> index 1aec079c5..6d9d27d9c 100644
> --- a/lib/igt_debugfs.c
> +++ b/lib/igt_debugfs.c
> @@ -977,13 +977,15 @@ static int get_object_count(int fd)
> */
> int igt_get_stable_obj_count(int driver)
> {
> - int obj_count;
> - gem_quiescent_gpu(driver);
> - obj_count = get_object_count(driver);
> - /* The test relies on the system being in the same state before and
> + /*
> + * The test relies on the system being in the same state before and
> * after the test so any difference in the object count is a result of
> - * leaks during the test. */
> - return obj_count;
> + * leaks during the test.
> + * */
> + igt_drop_caches_set(driver,
> + DROP_ACTIVE | DROP_RETIRE | DROP_IDLE | DROP_FREED);
> +
> + return get_object_count(driver);
> }
>
Split the next bit in a separate commit?
Thanks,
Antonio
> void igt_debugfs_dump(int device, const char *filename)
> diff --git a/lib/intel_os.c b/lib/intel_os.c
> index bb2c16bf3..b5d9888d8 100644
> --- a/lib/intel_os.c
> +++ b/lib/intel_os.c
> @@ -96,11 +96,6 @@ intel_get_avail_ram_mb(void)
>
> #ifdef HAVE_STRUCT_SYSINFO_TOTALRAM /* Linux */
> struct sysinfo sysinf;
> - int fd;
> -
> - fd = drm_open_driver(DRIVER_INTEL);
> - intel_purge_vm_caches(fd);
> - close(fd);
>
> igt_assert(sysinfo(&sysinf) == 0);
> retval = sysinf.freeram;
> @@ -281,6 +276,12 @@ void intel_require_memory(uint64_t count, uint64_t size, unsigned mode)
> {
> uint64_t required, total;
>
> + if (!__intel_check_memory(count, size, mode, &required, &total)) {
> + int fd = drm_open_driver(DRIVER_INTEL);
> + intel_purge_vm_caches(fd);
> + close(fd);
> + }
> +
> igt_require_f(__intel_check_memory(count, size, mode,
> &required, &total),
> "Estimated that we need %'llu objects and %'llu MiB for the test, but only have %'llu MiB available (%s%s) and a maximum of %'llu objects\n",
> @@ -298,7 +299,9 @@ void intel_purge_vm_caches(int drm_fd)
> {
> int fd;
>
> - igt_drop_caches_set(drm_fd, DROP_SHRINK_ALL | DROP_IDLE | DROP_FREED);
> + igt_drop_caches_set(drm_fd,
> + DROP_ACTIVE | DROP_RETIRE | DROP_IDLE |
> + DROP_SHRINK_ALL | DROP_FREED);
>
> fd = open("/proc/sys/vm/drop_caches", O_WRONLY);
> if (fd >= 0) {
>
More information about the igt-dev
mailing list