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 59DD0C5B549 for ; Thu, 5 Jun 2025 00:10:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0D4AE10E89F; Thu, 5 Jun 2025 00:10:57 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="YhVoSMfw"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8217C10E89F for ; Thu, 5 Jun 2025 00:10:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1749082255; x=1780618255; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=X4aN87L/76pD1uoAZcqWdt6U8jCAjx8/6RmtmD44Qh0=; b=YhVoSMfwcAJxYrKC/PFHWQ8lTEoVt8AmxYWM5dTpWxubmGqH+qDNbtEG sArtJWjt/eGUIsXqiwG32/Xmuy3XYODw8+311/CaiC66YDup5XqnmXFpo FF5YyzeIvJQvIQGSTAMkyeIvE6BjqZf06/raK/2i1wGAGhrbu5QvbbZkV yhr94khXecK/vutz6XEuAb1/x2SjQfKsStqIxIrkumw+O9KnaXgN7Hi95 RayUyaEQukGkFdbf9TI2d9mcs8ili9uad+OcHLBjEODT48qY1DzjPdtDv 52U3/QSCjG5l6IowwayLFXjMoAjLg+r9peZAEtJk+3TZHiIyGPX19lMfw Q==; X-CSE-ConnectionGUID: M/lfwgwaRxaXxY3z03Ogjw== X-CSE-MsgGUID: SdcREDYTQLKIMjm8HwfnoQ== X-IronPort-AV: E=McAfee;i="6800,10657,11454"; a="73719355" X-IronPort-AV: E=Sophos;i="6.16,210,1744095600"; d="scan'208";a="73719355" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2025 17:10:55 -0700 X-CSE-ConnectionGUID: b0g5P7DGQ2eOUnextJYlIA== X-CSE-MsgGUID: r2DXsecqRqmvb3xMZpZLrw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,210,1744095600"; d="scan'208";a="145377333" Received: from adixit-mobl3.clients.intel.com (HELO adixit-MOBL3.intel.com) ([10.24.12.163]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2025 17:10:39 -0700 Date: Wed, 04 Jun 2025 17:10:37 -0700 Message-ID: <8734cfujya.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Harish Chegondi Cc: Subject: Re: [PATCH i-g-t 2/3] tests/intel/xe_eu_stall: Do not check for presence of data on simulation In-Reply-To: <37ab7f14480edb308e152d1a9088394407b031e8.1748994982.git.harish.chegondi@intel.com> References: <37ab7f14480edb308e152d1a9088394407b031e8.1748994982.git.harish.chegondi@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 Tue, 03 Jun 2025 16:57:35 -0700, Harish Chegondi wrote: > > Some simulation models may not have full EU stall sampling support. > > v2: 1. Make EU stall fd global and close any open fd before open (Ashutosh) This is probably patch 1/3, so no need to mention here I think. > 2. Move disable IOCTL call to before the assert. > 3. Allocate and free the user buffer in the main routine to prevent > any memory leak due to an assert. 3 is probably not worth it since any allocated memory will be freed when the process exits, so the memory "leak" is only for the duration the process is running after the assert. Generally multiple changes like these should be sent in separate patches to make review easier, but in any case, here it is obvious what's happening so this is: Reviewed-by: Ashutosh Dixit > > Cc: Ashutosh Dixit > Signed-off-by: Harish Chegondi > --- > tests/intel/xe_eu_stall.c | 19 ++++++++++--------- > 1 file changed, 10 insertions(+), 9 deletions(-) > > diff --git a/tests/intel/xe_eu_stall.c b/tests/intel/xe_eu_stall.c > index 1499ec4b4..b3a0ee742 100644 > --- a/tests/intel/xe_eu_stall.c > +++ b/tests/intel/xe_eu_stall.c > @@ -65,6 +65,7 @@ > static FILE *output; > static char *p_args[8]; > static char *output_file; > +static uint8_t *user_buf; > static uint8_t p_gt_id; > static uint32_t p_rate; > static uint32_t p_user = DEFAULT_USER_BUF_SIZE; > @@ -493,7 +494,6 @@ static void test_eustall(int drm_fd, uint32_t devid, bool blocking_read, int ite > struct sigaction sa = { 0 }; > int ret, flags; > uint64_t total_size; > - uint8_t *buf; > > uint64_t properties[] = { > DRM_XE_EU_STALL_PROP_GT_ID, p_gt_id, > @@ -520,9 +520,6 @@ static void test_eustall(int drm_fd, uint32_t devid, bool blocking_read, int ite > else > igt_info("Workload: GPGPU fill\n"); > > - buf = malloc(p_user); > - igt_assert(buf); > - > igt_assert_eq(igt_ioctl(drm_fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0); > igt_assert_neq(query.size, 0); > > @@ -579,11 +576,11 @@ enable: > igt_assert_eq(ret, 1); > igt_assert(pollfd.revents & POLLIN); > } > - ret = read(stream_fd, buf, p_user); > + ret = read(stream_fd, user_buf, p_user); > if (ret > 0) { > total_size += ret; > if (output) > - print_eu_stall_data(devid, buf, ret); > + print_eu_stall_data(devid, user_buf, ret); > num_samples += ret / query_eu_stall_data->record_size; > } else if ((ret < 0) && (errno != EAGAIN)) { > if (errno == EINTR) > @@ -598,20 +595,21 @@ enable: > } > } while (child_is_running); > > + do_ioctl(stream_fd, DRM_XE_OBSERVATION_IOCTL_DISABLE, 0); > + > igt_info("Total size read: %lu\n", total_size); > igt_info("Number of samples: %u\n", num_samples); > igt_info("Number of drops reported: %u\n", num_drops); > > ret = wait_child(&work_load); > igt_assert_f(ret == 0, "waitpid() - ret: %d, errno: %d\n", ret, errno); > - igt_assert_f(num_samples, "No EU stalls detected during the workload\n"); > + if (!igt_run_in_simulation()) > + igt_assert_f(num_samples, "No EU stalls detected during the workload\n"); > > - do_ioctl(stream_fd, DRM_XE_OBSERVATION_IOCTL_DISABLE, 0); > if (--iter) > goto enable; > > eu_stall_close(stream_fd); > - free(buf); > } > > static int opt_handler(int opt, int opt_index, void *data) > @@ -678,6 +676,8 @@ igt_main_args("e:g:o:r:u:w:", long_options, help_str, opt_handler, NULL) > output = fopen(output_file, "w"); > igt_require(output); > } > + user_buf = malloc(p_user); > + igt_assert(user_buf); > } > > igt_describe("Verify non-blocking read of EU stall data during a workload run"); > @@ -717,6 +717,7 @@ igt_main_args("e:g:o:r:u:w:", long_options, help_str, opt_handler, NULL) > test_invalid_event_report_count(drm_fd); > > igt_fixture { > + free(user_buf); > if (output) > fclose(output); > drm_close_driver(drm_fd); > -- > 2.48.1 >