From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id A833C10E5D1 for ; Fri, 23 Sep 2022 19:52:30 +0000 (UTC) From: Umesh Nerlige Ramappa To: igt-dev@lists.freedesktop.org, Lionel G Landwerlin , Ashutosh Dixit Date: Fri, 23 Sep 2022 19:52:12 +0000 Message-Id: <20220923195224.283045-6-umesh.nerlige.ramappa@intel.com> In-Reply-To: <20220923195224.283045-1-umesh.nerlige.ramappa@intel.com> References: <20220923195224.283045-1-umesh.nerlige.ramappa@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [igt-dev] [PATCH i-g-t v4 05/17] i915/perf: Account for OA sampling interval in polling test List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: The polling test reads all the reports and then expects EAGAIN on a subsequent read since it has consumed all available data. This works well for OA sampling periods in the order of 10s of ms. For smaller sampling periods like 500 us, we end up reading valid data and the test fails. Fix the check to account for the OA sampling period. Signed-off-by: Umesh Nerlige Ramappa --- tests/i915/perf.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/i915/perf.c b/tests/i915/perf.c index ca3ccc17..5fe874c1 100644 --- a/tests/i915/perf.c +++ b/tests/i915/perf.c @@ -2220,14 +2220,22 @@ test_polling(uint64_t requested_oa_period, bool set_kernel_hrtimer, uint64_t ker n_extra_iterations++; /* At this point, after consuming pending reports (and hoping - * the scheduler hasn't stopped us for too long we now - * expect EAGAIN on read. + * the scheduler hasn't stopped us for too long) we now expect + * EAGAIN on read. While this works most of the times, there are + * some rare failures when the OA period passed to this test is + * very small (say 500 us) and that results in some valid + * reports here. To weed out those rare occurences we assert + * only if the OA period is >= 40 ms because 40 ms has withstood + * the test of time on most platforms (ref: subtest: polling). */ while ((ret = read(stream_fd, buf, sizeof(buf))) < 0 && errno == EINTR) ; - igt_assert_eq(ret, -1); - igt_assert_eq(errno, EAGAIN); + + if (requested_oa_period >= 40000000) { + igt_assert_eq(ret, -1); + igt_assert_eq(errno, EAGAIN); + } n++; } -- 2.25.1