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 ABDC3C83F22 for ; Wed, 16 Jul 2025 15:47:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 624F310E293; Wed, 16 Jul 2025 15:47:35 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="i8iHhPti"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id B52F410E293 for ; Wed, 16 Jul 2025 15:47:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1752680854; x=1784216854; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=6pEY+kELMKC9sCbpjesc6J/67T0L1lGEKgVQdHWyFr8=; b=i8iHhPtieIJ52oE9fqcFUHQ5coLShwm8hVoAi1b2QBtC9cdl0eA5rtjt epC962RJ2DXZDxQh4kG0CXqoglHBXxUV9jChVKxXKuav0Al9+AqwC0Apq BO2udTrMSBQ7bIqtQcrlshFy29dHRvsCGNoMrHXVGFK/xQlS8qJP7nE6Q Z+46VgbIn2x/MwoHd2pkWylenKSpQfLyPK9hNdYayGIrlp6SqzUsKr9lm I9KuqUy51ACqQ+JOsF24jwM3grkcY1SVgyw/Bs/iUZ48pr1IG/qSwxy2/ kSAHsOC/v17tBW4RrFo5PopUBjq9O41i6/jOs67sHPeiDgBpY782RnADd g==; X-CSE-ConnectionGUID: V2mXz5YzSfesotrWrbHgjQ== X-CSE-MsgGUID: MSMs5M6SSyu9+ycyykQOGQ== X-IronPort-AV: E=McAfee;i="6800,10657,11493"; a="66286194" X-IronPort-AV: E=Sophos;i="6.16,316,1744095600"; d="scan'208";a="66286194" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2025 08:47:33 -0700 X-CSE-ConnectionGUID: ed7DO4+nQkCm5yaxuMNysw== X-CSE-MsgGUID: rbsBXE9hReqjtn8JIcPm+A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,316,1744095600"; d="scan'208";a="157349144" Received: from nekeane-mobl.amr.corp.intel.com (HELO adixit-MOBL3.intel.com) ([10.125.192.9]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2025 08:47:33 -0700 Date: Wed, 16 Jul 2025 08:47:32 -0700 Message-ID: <87v7nscf3f.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Harish Chegondi Cc: Subject: Re: [PATCH i-g-t 1/1] lib/xe/xe_query: Add EU stall info to xe_device In-Reply-To: <6d41938517a3ab1b79e105c89af1ed74b1beeceb.1752647058.git.harish.chegondi@intel.com> References: <6d41938517a3ab1b79e105c89af1ed74b1beeceb.1752647058.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, 15 Jul 2025 23:25:58 -0700, Harish Chegondi wrote: > > Add EU stall data information obtained through the EU stall > query IOCTL to xe_device. > > Cc: Ashutosh Dixit > Signed-off-by: Harish Chegondi LGTM, Reviewed-by: Ashutosh Dixit > --- > lib/xe/xe_query.c | 28 ++++++++++++++++++++++++++++ > lib/xe/xe_query.h | 3 +++ > tests/intel/xe_eu_stall.c | 26 ++++++-------------------- > 3 files changed, 37 insertions(+), 20 deletions(-) > > diff --git a/lib/xe/xe_query.c b/lib/xe/xe_query.c > index c0dba0182..3b8a682f8 100644 > --- a/lib/xe/xe_query.c > +++ b/lib/xe/xe_query.c > @@ -160,6 +160,32 @@ static struct drm_xe_query_mem_regions *xe_query_mem_regions_new(int fd) > return mem_regions; > } > > +static struct drm_xe_query_eu_stall *xe_query_eu_stall_new(int fd) > +{ > + struct drm_xe_query_eu_stall *query_eu_stall; > + struct drm_xe_device_query query = { > + .extensions = 0, > + .query = DRM_XE_DEVICE_QUERY_EU_STALL, > + .size = 0, > + .data = 0, > + }; > + > + /* Support older kernels where this uapi is not yet available */ > + if (igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query)) > + return NULL; > + igt_assert_neq(query.size, 0); > + > + query_eu_stall = malloc(query.size); > + igt_assert(query_eu_stall); > + > + query.data = to_user_pointer(query_eu_stall); > + igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0); > + > + VG(VALGRIND_MAKE_MEM_DEFINED(query_eu_stall, query.size)); > + > + return query_eu_stall; > +} > + > static struct drm_xe_query_oa_units *xe_query_oa_units_new(int fd) > { > struct drm_xe_query_oa_units *oa_units; > @@ -317,6 +343,7 @@ static void xe_device_free(struct xe_device *xe_dev) > free(xe_dev->engines); > free(xe_dev->mem_regions); > free(xe_dev->vram_size); > + free(xe_dev->eu_stall); > free(xe_dev); > } > > @@ -355,6 +382,7 @@ struct xe_device *xe_device_get(int fd) > xe_dev->memory_regions = __memory_regions(xe_dev->gt_list); > xe_dev->engines = xe_query_engines(fd); > xe_dev->mem_regions = xe_query_mem_regions_new(fd); > + xe_dev->eu_stall = xe_query_eu_stall_new(fd); > xe_dev->oa_units = xe_query_oa_units_new(fd); > > /* > diff --git a/lib/xe/xe_query.h b/lib/xe/xe_query.h > index ca0b3235e..cc54ec956 100644 > --- a/lib/xe/xe_query.h > +++ b/lib/xe/xe_query.h > @@ -45,6 +45,9 @@ struct xe_device { > /** @engines: hardware engines */ > struct drm_xe_query_engines *engines; > > + /** @eu_stall: information about EU stall data */ > + struct drm_xe_query_eu_stall *eu_stall; > + > /** @mem_regions: regions memory information and usage */ > struct drm_xe_query_mem_regions *mem_regions; > > diff --git a/tests/intel/xe_eu_stall.c b/tests/intel/xe_eu_stall.c > index 88202488c..f09e525eb 100644 > --- a/tests/intel/xe_eu_stall.c > +++ b/tests/intel/xe_eu_stall.c > @@ -46,6 +46,7 @@ > #include "igt_core.h" > #include "xe_drm.h" > #include "xe/xe_ioctl.h" > +#include "xe/xe_query.h" > > #define OBSERVATION_PARANOID "/proc/sys/dev/xe/observation_paranoid" > > @@ -646,15 +647,10 @@ static struct option long_options[] = { > igt_main_args("e:g:o:r:u:w:", long_options, help_str, opt_handler, NULL) > { > bool blocking_read = true; > - int drm_fd, ret, idx; > + struct xe_device *xe_dev; > + int drm_fd, idx; > uint32_t devid; > struct stat sb; > - struct drm_xe_device_query query = { > - .extensions = 0, > - .query = DRM_XE_DEVICE_QUERY_EU_STALL, > - .size = 0, > - .data = 0, > - }; > > igt_fixture { > drm_fd = drm_open_driver(DRIVER_XE); > @@ -663,20 +659,10 @@ igt_main_args("e:g:o:r:u:w:", long_options, help_str, opt_handler, NULL) > > igt_require_f(igt_get_gpgpu_fillfunc(devid), "no gpgpu-fill function\n"); > igt_require_f(!stat(OBSERVATION_PARANOID, &sb), "no observation_paranoid file\n"); > + xe_dev = xe_device_get(drm_fd); > + igt_require_f(xe_dev->eu_stall, "EU stall monitoring is not available/supported\n"); > > - ret = igt_ioctl(drm_fd, DRM_IOCTL_XE_DEVICE_QUERY, &query); > - igt_skip_on_f(ret == -1 && errno == ENODEV, > - "EU stall monitoring is not available on this platform\n"); > - igt_skip_on_f(ret == -1 && errno == EINVAL, > - "EU stall monitoring is not supported in the driver\n"); > - igt_assert_neq(query.size, 0); > - > - query_eu_stall_data = malloc(query.size); > - igt_assert(query_eu_stall_data); > - > - query.data = to_user_pointer(query_eu_stall_data); > - igt_assert_eq(igt_ioctl(drm_fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0); > - > + query_eu_stall_data = xe_dev->eu_stall; > igt_assert(query_eu_stall_data->num_sampling_rates > 0); > /* If the user doesn't pass a sampling rate, use a mid sampling rate */ > if (p_rate == 0) { > -- > 2.48.1 >