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 2643CC3DA4A for ; Tue, 20 Aug 2024 01:40:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E6C8610E396; Tue, 20 Aug 2024 01:40:55 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="EvR9DkZI"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id D2FD810E396 for ; Tue, 20 Aug 2024 01:40:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724118055; x=1755654055; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=7aw1y402z2CPqi9kcFEx5c9/g4DLBVHtuyejtZHa0W0=; b=EvR9DkZIMjCfMwMPkn4Ufy7DasEkGn5HalkE+j3Gv9JGgWxsMgX05mFL 6e6eALJuESXo1Fq/tLN8wDt4vBoEehsD2+Vv5k+lfsuDpmgrEbG3UMF/p g5+O5yTB5B7afGVHVctMQvn+GSrL339p5KvO8i0SqXtFne2Msn3lPoBx0 2VYYirtJMncLo2PMXGFFXfddh3HR+RntN3Thb/lQxgc6yT8oGF/GpYwHb JJygSAsZEUi2dzpKy8YNYBtii6cnSwC7PPeeSwhF0Woz/CqCwfUx8tHzl O04mBL6V1lk+V7eCX81RmT8oNvMa97Lr0jx0tYm+0MW46mfFq8JMPO/+C w==; X-CSE-ConnectionGUID: 5iGlHAtdSFqb8fSTZ61q4A== X-CSE-MsgGUID: jty5WnGsRzuMcKfKvSUBrQ== X-IronPort-AV: E=McAfee;i="6700,10204,11169"; a="22276535" X-IronPort-AV: E=Sophos;i="6.10,160,1719903600"; d="scan'208";a="22276535" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Aug 2024 18:40:54 -0700 X-CSE-ConnectionGUID: PNFIYwh6TYGLzJWyLLFFwQ== X-CSE-MsgGUID: IOLJD9abRyK75AlhqT7AEA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,160,1719903600"; d="scan'208";a="98021644" Received: from orsosgc001.jf.intel.com (HELO orsosgc001.intel.com) ([10.165.21.138]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Aug 2024 18:40:54 -0700 Date: Mon, 19 Aug 2024 18:40:54 -0700 Message-ID: <85v7zw6kex.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: "Cavitt, Jonathan" Cc: "intel-xe@lists.freedesktop.org" , "Nerlige Ramappa, Umesh" , "Souza, Jose" , "Landwerlin, Lionel G" Subject: Re: [PATCH 7/8] drm/xe/oa: Add syncs support to OA config ioctl In-Reply-To: References: <20240808174139.4027534-1-ashutosh.dixit@intel.com> <20240808174139.4027534-8-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/28.2 (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: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" On Thu, 08 Aug 2024 14:39:12 -0700, Cavitt, Jonathan wrote: > > -----Original Message----- > From: Intel-xe On Behalf Of Ashutosh Dixit > Sent: Thursday, August 8, 2024 10:42 AM > To: intel-xe@lists.freedesktop.org > Cc: Nerlige Ramappa, Umesh ; Souza, Jose ; Landwerlin, Lionel G > Subject: [PATCH 7/8] drm/xe/oa: Add syncs support to OA config ioctl > > > > In addition to stream open, add xe_sync support to the OA config ioctl, > > where it is even more useful. This allows e.g. Mesa to replay a workload > > repeatedly on the GPU, each time with a different OA configuration, while > > precisely controlling (at batch buffer granularity) the workload segment > > for which a particular OA configuration is active, without introducing > > stalls in the userspace pipeline. > > > > Signed-off-by: Ashutosh Dixit > > --- > > drivers/gpu/drm/xe/xe_oa.c | 32 ++++++++++++++++++-------------- > > drivers/gpu/drm/xe/xe_oa_types.h | 3 +++ > > 2 files changed, 21 insertions(+), 14 deletions(-) > > > > diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c > > index 5520208a46b2c..c9f77f0342b60 100644 > > --- a/drivers/gpu/drm/xe/xe_oa.c > > +++ b/drivers/gpu/drm/xe/xe_oa.c > > @@ -867,6 +867,7 @@ static void xe_oa_stream_destroy(struct xe_oa_stream *stream) > > xe_gt_WARN_ON(gt, xe_guc_pc_unset_gucrc_mode(>->uc.guc.pc)); > > > > xe_oa_free_configs(stream); > > + xe_file_put(stream->xef); > > } > > > > static int xe_oa_alloc_oa_buffer(struct xe_oa_stream *stream) > > @@ -1433,36 +1434,37 @@ static int xe_oa_disable_locked(struct xe_oa_stream *stream) > > > > static long xe_oa_config_locked(struct xe_oa_stream *stream, u64 arg) > > { > > - struct drm_xe_ext_set_property ext; > > + struct xe_oa_open_param param = {}; > > long ret = stream->oa_config->id; > > struct xe_oa_config *config; > > int err; > > > > - err = __copy_from_user(&ext, u64_to_user_ptr(arg), sizeof(ext)); > > - if (XE_IOCTL_DBG(stream->oa->xe, err)) > > - return -EFAULT; > > - > > - if (XE_IOCTL_DBG(stream->oa->xe, ext.pad) || > > - XE_IOCTL_DBG(stream->oa->xe, ext.base.name != DRM_XE_OA_EXTENSION_SET_PROPERTY) || > > - XE_IOCTL_DBG(stream->oa->xe, ext.base.next_extension) || > > - XE_IOCTL_DBG(stream->oa->xe, ext.property != DRM_XE_OA_PROPERTY_OA_METRIC_SET)) > > - return -EINVAL; > > I take it these conditions originally blocked batch buffer granular OA configuration > changes, which we now support due to xe_oa_parse_syncs down below? Yeah, previously only metric_set configuration was supported for stream reconfiguration. Now that we have introduced syncs in this series, both metric_set and xe_syncs are supported in the reconfig path. > > At any rate, this all looks fine to me. > Reviewed-by: Jonathan Cavitt Thanks. -- Ashutosh > -Jonathan Cavitt > > > + err = xe_oa_user_extensions(stream->oa, arg, 0, ¶m); > > + if (err) > > + return err; > > > > - config = xe_oa_get_oa_config(stream->oa, ext.value); > > + config = xe_oa_get_oa_config(stream->oa, param.metric_set); > > if (!config) > > return -ENODEV; > > > > if (config != stream->oa_config) { > > + param.xef = stream->xef; > > + err = xe_oa_parse_syncs(stream->oa, ¶m); > > + if (err) > > + goto err_config_put; > > + > > + stream->num_syncs = param.num_syncs; > > + stream->syncs = param.syncs; > > + > > err = xe_oa_emit_oa_config(stream, config); > > if (!err) > > config = xchg(&stream->oa_config, config); > > - else > > - ret = err; > > } > > > > +err_config_put: > > xe_oa_config_put(config); > > > > - return ret; > > + return err ?: ret; > > } > > > > static long xe_oa_status_locked(struct xe_oa_stream *stream, unsigned long arg) > > @@ -1705,6 +1707,7 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream, > > stream->period_exponent = param->period_exponent; > > stream->no_preempt = param->no_preempt; > > > > + stream->xef = xe_file_get(param->xef); > > stream->num_syncs = param->num_syncs; > > stream->syncs = param->syncs; > > > > @@ -1804,6 +1807,7 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream, > > err_free_configs: > > xe_oa_free_configs(stream); > > exit: > > + xe_file_put(stream->xef); > > return ret; > > } > > > > diff --git a/drivers/gpu/drm/xe/xe_oa_types.h b/drivers/gpu/drm/xe/xe_oa_types.h > > index c1ca960af9305..303e2e8f2a918 100644 > > --- a/drivers/gpu/drm/xe/xe_oa_types.h > > +++ b/drivers/gpu/drm/xe/xe_oa_types.h > > @@ -239,6 +239,9 @@ struct xe_oa_stream { > > /** @no_preempt: Whether preemption and timeslicing is disabled for stream exec_q */ > > u32 no_preempt; > > > > + /** @xef: xe_file with which the stream was opened */ > > + struct xe_file *xef; > > + > > /** @num_syncs: size of @syncs array */ > > u32 num_syncs; > > > > -- > > 2.41.0 > > > >