From mboxrd@z Thu Jan 1 00:00:00 1970 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 80A0EC369C9 for ; Thu, 17 Apr 2025 19:16:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 58D7D10E072; Thu, 17 Apr 2025 19:16:38 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="LiHRNLcG"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 72FE010E072 for ; Thu, 17 Apr 2025 19:16:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1744917396; x=1776453396; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=RVrbKRqvINQDvsOKc7qndLws3y4+tEHlRZnXy5OYkKg=; b=LiHRNLcGjal0J70EYIzccgnSfLeUUD9uVj/c8NQ1eag2UnGtsZ6IhQzs +61BBwxfgDbR+6oiLvmZQEtoGb2Jo7D4NezYRXM6F9W1cB2gMl8I8LRSa wBvrN+T6wMhMos8/uKXzRgaoRNSmB6+g11qakb1WDMfL29ytAS7VJC22X bEebJFYhh2q3gL3KKgY6hg1jEToV4+xQ1xK5Ung72LDhYWfBa58Mcwq+w l/SkyiaKuwHE6DE5hAG27W1+hszIXFQRQUt6sL3Y+CI4aVTJv0erATe1D gMuyPjXbTxeNFu+LVbplilfiQ1JNg/jI+fpQtjFQpXV/kwQa17zE+88yR A==; X-CSE-ConnectionGUID: 0KnLHjs2RB+F91t4JUDiSQ== X-CSE-MsgGUID: Rf2NrQeQT9CIx41mzC1sdg== X-IronPort-AV: E=McAfee;i="6700,10204,11406"; a="46243466" X-IronPort-AV: E=Sophos;i="6.15,219,1739865600"; d="scan'208";a="46243466" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2025 12:16:36 -0700 X-CSE-ConnectionGUID: NriPygJBQ2CKgJdmvj716Q== X-CSE-MsgGUID: d72/C6d/RBahCqyF0jNmVg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,219,1739865600"; d="scan'208";a="130867241" Received: from rsgollap-mobl.amr.corp.intel.com (HELO adixit-MOBL3.intel.com) ([10.125.180.11]) by orviesa010-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2025 12:16:36 -0700 Date: Thu, 17 Apr 2025 12:16:35 -0700 Message-ID: <87a58eha3w.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Umesh Nerlige Ramappa Cc: Subject: Re: [PATCH i-g-t] tests/intel/xe_oa: Call get_stream_status only on EIO In-Reply-To: References: <20250416231203.13916-1-umesh.nerlige.ramappa@intel.com> <87cydbhf3b.wl-ashutosh.dixit@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, 17 Apr 2025 12:00:39 -0700, Umesh Nerlige Ramappa wrote: > > On Wed, Apr 16, 2025 at 04:16:40PM -0700, Dixit, Ashutosh wrote: > > On Wed, 16 Apr 2025 16:12:02 -0700, Umesh Nerlige Ramappa wrote: > >> > >> Turns out that get_stream_status resets errno and anything that checks > >> errno afterwards fails. This resulted in a bunch of test failures. Fix > >> it by calling get_stream_status only if errno is EIO and also save and > >> restore errno within get_stream_status. > >> > >> Closes: https://gitlab.freedesktop.org/drm/xe/kernel/issues/4804 > >> Signed-off-by: Umesh Nerlige Ramappa > >> --- > >> tests/intel/xe_oa.c | 20 ++++++++++++++------ > >> 1 file changed, 14 insertions(+), 6 deletions(-) > >> > >> diff --git a/tests/intel/xe_oa.c b/tests/intel/xe_oa.c > >> index 1fc8bfaafee2..360dd8ba00d9 100644 > >> --- a/tests/intel/xe_oa.c > >> +++ b/tests/intel/xe_oa.c > >> @@ -380,9 +380,11 @@ static void set_fd_flags(int fd, int flags) > >> static u32 get_stream_status(int fd) > >> { > >> struct drm_xe_oa_stream_status status; > >> + int _e = errno; > >> > >> do_ioctl(fd, DRM_XE_OBSERVATION_IOCTL_STATUS, &status); > >> igt_debug("oa status %llx\n", status.oa_status); > >> + errno = _e; > >> > >> return status.oa_status; > >> } > >> @@ -2294,7 +2296,8 @@ static void test_polling_small_buf(void) > >> errno = 0; > >> ret = read(stream_fd, buf, sizeof(buf)); > >> igt_assert_eq(ret, -1); > >> - get_stream_status(stream_fd); > >> + if (errno == EIO) > >> + get_stream_status(stream_fd); > > > > Hi Umesh, if we are saving/restoring errno in get_stream_status(), do we > > still need to check for EIO? Or you just want to check for EIO anyhow? > > I wanted to make sure of both actually. Ideally, we get the stream status > only on EIO. In future if anyone does not follow that and just calls the > get_stream_status, then preserve the errno to avoid strange issues. Maybe > should update the commit then? By "commit" you mean this patch? Yes I think the original intent of 'db9eca9df70f ("tests/intel/xe_oa: Get stream status on read error")' was to get the stream status unconditionally, so maybe stick to that? Thanks. -- Ashutosh