Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id 147E96EC1B for ; Thu, 14 Oct 2021 07:47:45 +0000 (UTC) Date: Thu, 14 Oct 2021 09:47:39 +0200 From: Zbigniew =?utf-8?Q?Kempczy=C5=84ski?= Message-ID: <20211014074739.GD3617@zkempczy-mobl2> References: <20211008065432.15482-1-zbigniew.kempczynski@intel.com> <20211008065432.15482-7-zbigniew.kempczynski@intel.com> <8735p4i68d.wl-ashutosh.dixit@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <8735p4i68d.wl-ashutosh.dixit@intel.com> Subject: Re: [igt-dev] [PATCH i-g-t 6/7] benchmarks/gem_exec_fault: Add timeout argument List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" To: "Dixit, Ashutosh" Cc: igt-dev@lists.freedesktop.org, Petri Latvala List-ID: On Wed, Oct 13, 2021 at 09:24:18PM -0700, Dixit, Ashutosh wrote: > On Thu, 07 Oct 2021 23:54:31 -0700, Zbigniew KempczyƄski wrote: > > > > +static int loop(uint64_t size, unsigned ring, int reps, int ncpus, > > + unsigned flags, float timeout) > > { > > struct drm_i915_gem_execbuffer2 execbuf; > > struct drm_i915_gem_exec_object2 obj; > > @@ -128,10 +130,14 @@ static int loop(uint64_t size, unsigned ring, int reps, int ncpus, unsigned flag > > /* fault out */ > > obj.alignment = 1ull << 63; > > __gem_execbuf(fd, &execbuf); > > - } > > > > - clock_gettime(CLOCK_MONOTONIC, &end); > > - } while (elapsed(&start, &end) < 2.); > > + clock_gettime(CLOCK_MONOTONIC, &end); > > + if (elapsed(&start, &end) >= timeout) { > > + timeout = -1.0; > > Just a small nit, I don't think we need to set it to -1 here. We can just > leave the "while (elapsed(&start, &end) < timeout);" check in the outer loop > too. So please change if you agree. Otherwise: I just wanted to avoid calling elapsed() twice, that's why I changed to simpler expression. Timeout cannot be negative so it is good as stop condition to outer loop. I dare get your r-b here. -- Zbigniew > > Reviewed-by: Ashutosh Dixit > > > + break; > > + } > > + } > > + } while (timeout > 0); > > > > gem_sync(fd, obj.handle); > > clock_gettime(CLOCK_MONOTONIC, &end);