Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1D622CA0EED for ; Thu, 28 Aug 2025 22:56:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D306710EAF2; Thu, 28 Aug 2025 22:56:30 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="LKq1wDMw"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id B93BC10EAF2 for ; Thu, 28 Aug 2025 22:56:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1756421790; x=1787957790; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=62tphjGpUvREzl7J7KdfPXi1o1G5BJEpvoH6axpADF8=; b=LKq1wDMwqOZkvEzWWyT8PnZMcLtAAXMcELjJHxsP6FrRqTSBeRSxCtf2 0oretoT9LZZ+T2RK5Y18AzJW278eLlfl3musCCJKLxETpfpoOD2j51aDf GtFl9xZwOzKoNpbHqGPQCjzv3xvDTb7lYcGiqUiJKJlnF/9dvL1ouc1KC NDMZYUi2KW9YrKheLTFCUBflpk/a8OLmNZjrwnq28qN9Dqg9gxHwS3Wzr wUs5DwYrjweHwq/pvB0BhP0g7gLS62q0sdMDacvlH0MnoFWSMo+GwzpxU B9+wmsa5+L3GDUB8Nn385/YI1BMu7JEF9f0Okur5jxougbg/CNpVX2RUV Q==; X-CSE-ConnectionGUID: 8HXjNkrIQf+XGV6XdPYCDA== X-CSE-MsgGUID: 8PNbrPqvS5yhnoPlfmamYg== X-IronPort-AV: E=McAfee;i="6800,10657,11536"; a="58808220" X-IronPort-AV: E=Sophos;i="6.18,221,1751266800"; d="scan'208";a="58808220" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Aug 2025 15:56:29 -0700 X-CSE-ConnectionGUID: wyoloNWFRzWrfKyhrEl5ew== X-CSE-MsgGUID: KjE17eKCTXGOeV27FQJKGg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,221,1751266800"; d="scan'208";a="174610442" Received: from nmou-mobl5.amr.corp.intel.com (HELO adixit-MOBL3.intel.com) ([10.125.214.109]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Aug 2025 15:56:30 -0700 Date: Thu, 28 Aug 2025 15:56:28 -0700 Message-ID: <87bjnzm4wz.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Umesh Nerlige Ramappa Cc: Subject: Re: [PATCH i-g-t v3 1/2] tests/intel/xe_oa: Clean up buffer-fill test In-Reply-To: <20250828214907.94311-2-umesh.nerlige.ramappa@intel.com> References: <20250828214907.94311-1-umesh.nerlige.ramappa@intel.com> <20250828214907.94311-2-umesh.nerlige.ramappa@intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.4 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" On Thu, 28 Aug 2025 14:49:06 -0700, Umesh Nerlige Ramappa wrote: > > Checking for overflow status before enabling the OA buffer is always > going to return false. Drop the logic. > > Move out core buffer overflow check to a helper for reuse by other tests > when needed. > > Signed-off-by: Umesh Nerlige Ramappa > --- > tests/intel/xe_oa.c | 36 ++++++++++++++++++++---------------- > 1 file changed, 20 insertions(+), 16 deletions(-) > > diff --git a/tests/intel/xe_oa.c b/tests/intel/xe_oa.c > index 1826623ab864..3b3cdf9314c2 100644 > --- a/tests/intel/xe_oa.c > +++ b/tests/intel/xe_oa.c > @@ -2488,6 +2488,25 @@ test_oa_tlb_invalidate(const struct drm_xe_engine_class_instance *hwe) > igt_assert(num_reports2 > 0.95 * num_expected_reports); > } > > +/* > + * This is a blocking read trying to read 0 bytes, so it will return ENOSPC > + * until there is data available. Once the OA buffer overflows, we should see an What does it mean "until there is data available"? Won't reading 0 bytes always return ENOSPC? Or you mean until it returns EIO instead of ENOSPC? > + * EIO with the oevrflow status set. s/oevrflow/overflow/ > + */ > +static void > +wait_for_oa_buffer_overflow(int fd, int poll_period_us) > +{ > + char buf; > + > + while (-1 == read(fd, &buf, 0)) { > + if (errno == EIO && > + get_stream_status(fd) & DRM_XE_OASTATUS_BUFFER_OVERFLOW) > + return; > + > + usleep(poll_period_us); > + } > +} > + > /** > * SUBTEST: buffer-fill > * Description: Test filling and overflow of OA buffer > @@ -2526,24 +2545,9 @@ test_buffer_fill(const struct drm_xe_engine_class_instance *hwe) > stream_fd = __perf_open(drm_fd, ¶m, true /* prevent_pm */); > set_fd_flags(stream_fd, O_CLOEXEC); > > - /* OA buffer is disabled, we do not expect any error status */ > - oa_status = get_stream_status(stream_fd); > - overflow_seen = oa_status & DRM_XE_OASTATUS_BUFFER_OVERFLOW; > - igt_assert_eq(overflow_seen, 0); > - > do_ioctl(stream_fd, DRM_XE_OBSERVATION_IOCTL_ENABLE, 0); > > - /* Read 0 bytes repeatedly until you see an EIO */ > - while (-1 == read(stream_fd, buf, 0)) { > - if (errno == EIO) { > - oa_status = get_stream_status(stream_fd); > - overflow_seen = oa_status & DRM_XE_OASTATUS_BUFFER_OVERFLOW; > - if (overflow_seen) > - break; > - } > - usleep(100); > - } > - igt_assert(overflow_seen); > + wait_for_oa_buffer_overflow(stream_fd, 100); > > /* Make sure the buffer overflow is cleared */ > read(stream_fd, buf, 0); > -- > 2.43.0 > Also the ftrace patch is not merged so maybe add that to the series too. Otherwise this is: Reviewed-by: Ashutosh Dixit