From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id CE1BE10E1E9 for ; Tue, 25 Oct 2022 20:07:17 +0000 (UTC) From: Umesh Nerlige Ramappa To: igt-dev@lists.freedesktop.org Date: Tue, 25 Oct 2022 20:06:46 +0000 Message-Id: <20221025200709.83314-7-umesh.nerlige.ramappa@intel.com> In-Reply-To: <20221025200709.83314-1-umesh.nerlige.ramappa@intel.com> References: <20221025200709.83314-1-umesh.nerlige.ramappa@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [igt-dev] [PATCH 06/29] 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 Reviewed-by: Lionel Landwerlin --- 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