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 6B37AC3600B for ; Fri, 28 Mar 2025 03:03:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1D51910E972; Fri, 28 Mar 2025 03:03:09 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="koboWK8T"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2DE3410E972 for ; Fri, 28 Mar 2025 03:03:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1743130988; x=1774666988; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=E14YRqbuSMpmGZv+xQt/g4WX/MGZho0zhBRwy5a1wzw=; b=koboWK8TvxpcewB9Qy4+KvzEqFVdC4YExIM2EzMNNi7TWQiAjA59STjd tzmuxBaw/qBgyxzIrSfPoPuj5qytM1d9FU3ziYDdnVdYrEeAyoiWw6pAs I2lqG394izMrF3RaJMWFLAzjqdTjCQgB/GujbuVikqnKjlLwDw+TYcAMP pH0eeYSYRjrvznQiIlEVp9I3LZuhTWgJZj/cBxszT7YyBg3qwipnMmGts ZkRYshhiFBALrsgJVbiAERWfhz/JhIeuX8rPMvf4lns8l8myBfLH7sshT 2RecaOkMlv1sU411hJlmFcktcUbz/7SBTNDjXYuA+8n96KCs2r1GqB20O A==; X-CSE-ConnectionGUID: 1NAlOeGKQuKLOHOrwTsnkw== X-CSE-MsgGUID: +BvRZvL0T+KM8UWDgF9GbA== X-IronPort-AV: E=McAfee;i="6700,10204,11385"; a="48358702" X-IronPort-AV: E=Sophos;i="6.14,282,1736841600"; d="scan'208";a="48358702" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2025 20:03:07 -0700 X-CSE-ConnectionGUID: OCjgWfCRQse7A4I0sJvAXQ== X-CSE-MsgGUID: OCQKaDtLQSSPzhLooH03EQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,282,1736841600"; d="scan'208";a="130384226" Received: from orsosgc001.jf.intel.com (HELO orsosgc001.intel.com) ([10.165.21.142]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2025 20:03:07 -0700 Date: Thu, 27 Mar 2025 20:03:06 -0700 Message-ID: <85h63dsvpx.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Harish Chegondi Cc: Subject: Re: [PATCH i-g-t v2 1/1] tests/intel/xe_eu_stall: Add invalid input tests for EU stall sampling In-Reply-To: References: 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-redhat-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, 27 Mar 2025 18:23:19 -0700, Harish Chegondi wrote: > > Add tests to verify that invalid inputs fail the tests > > v2: Fix alignment, change SUBSLICES to XECORES, remove unnecessary brackets Looks good now, thanks for the changes: Reviewed-by: Ashutosh Dixit > > Signed-off-by: Harish Chegondi > --- > tests/intel/xe_eu_stall.c | 59 +++++++++++++++++++++++++++++++++++++++ > 1 file changed, 59 insertions(+) > > diff --git a/tests/intel/xe_eu_stall.c b/tests/intel/xe_eu_stall.c > index 964bb7c91..da9bd7843 100644 > --- a/tests/intel/xe_eu_stall.c > +++ b/tests/intel/xe_eu_stall.c > @@ -19,6 +19,15 @@ > * > * SUBTEST: unprivileged-access > * Description: Verify unprivileged open of a EU stall data stream fd > + * > + * SUBTEST: invalid-gt-id > + * Description: Verify that invalid input GT ID fails the test > + * > + * SUBTEST: invalid-sampling-rate > + * Description: Verify that invalid input sampling rate fails the test > + * > + * SUBTEST: invalid-event-report-count > + * Description: Verify that invalid input event report count fails the test > */ > > #include > @@ -33,6 +42,9 @@ > > #define OBSERVATION_PARANOID "/proc/sys/dev/xe/observation_paranoid" > > +#define NUM_DATA_ROWS(size) ((size) >> 6) > + > +#define MAX_XECORES 64 > #define NUM_ITERS_GPGPU_FILL 100 > #define DEFAULT_NUM_REPORTS 1 > #define DEFAULT_SAMPLE_RATE (251 * 4) > @@ -283,6 +295,41 @@ static void set_fd_flags(int fd, int flags) > igt_assert_eq(0, fcntl(fd, F_SETFL, old | flags)); > } > > +/* > + * Verify that tests with invalid arguments fail. > + */ > +static void test_invalid_arguments(int drm_fd, uint8_t gt_id, uint32_t rate, uint32_t num_reports) > +{ > + uint64_t properties[] = { > + DRM_XE_EU_STALL_PROP_GT_ID, gt_id, > + DRM_XE_EU_STALL_PROP_SAMPLE_RATE, rate, > + DRM_XE_EU_STALL_PROP_WAIT_NUM_REPORTS, num_reports, > + }; > + > + struct xe_eu_stall_open_prop props = { > + .num_properties = ARRAY_SIZE(properties) / 2, > + .properties_ptr = to_user_pointer(properties), > + }; > + > + xe_eu_stall_ioctl_err(drm_fd, DRM_XE_OBSERVATION_OP_STREAM_OPEN, &props, EINVAL); > +} > + > +static void test_invalid_gt_id(int fd) > +{ > + test_invalid_arguments(fd, 255, DEFAULT_SAMPLE_RATE, DEFAULT_NUM_REPORTS); > +} > + > +static void test_invalid_sampling_rate(int fd) > +{ > + test_invalid_arguments(fd, 0, 251 * 10, DEFAULT_NUM_REPORTS); > +} > + > +static void test_invalid_event_report_count(int fd) > +{ > + test_invalid_arguments(fd, 0, DEFAULT_SAMPLE_RATE, > + NUM_DATA_ROWS(512 * 1024) * MAX_XECORES + 1); > +} > + > static inline void enable_paranoid(void) > { > write_u64_file(OBSERVATION_PARANOID, 1); > @@ -615,6 +662,18 @@ igt_main_args("e:g:o:r:u:w:", long_options, help_str, opt_handler, NULL) > igt_subtest("unprivileged-access") > test_non_privileged_access(drm_fd); > > + igt_describe("Verify that invalid input GT ID fails the test"); > + igt_subtest("invalid-gt-id") > + test_invalid_gt_id(drm_fd); > + > + igt_describe("Verify that invalid input sampling rate fails the test"); > + igt_subtest("invalid-sampling-rate") > + test_invalid_sampling_rate(drm_fd); > + > + igt_describe("Verify that invalid input event report count fails the test"); > + igt_subtest("invalid-event-report-count") > + test_invalid_event_report_count(drm_fd); > + > igt_fixture { > if (output) > fclose(output); > -- > 2.48.1 >