Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
To: Ashutosh Dixit <ashutosh.dixit@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	Matthew Brost <matthew.brost@intel.com>,
	 Lionel Landwerlin <lionel.g.landwerlin@intel.com>,
	Jose Souza <jose.souza@intel.com>
Subject: Re: [PATCH 1/3] drm/xe/oa: Allow stream enable/disable functions to return error
Date: Tue, 25 Jun 2024 14:53:14 -0700	[thread overview]
Message-ID: <Zns8SpJfUJYMSYA+@orsosgc001> (raw)
In-Reply-To: <20240625201518.766925-2-ashutosh.dixit@intel.com>

On Tue, Jun 25, 2024 at 01:15:16PM -0700, Ashutosh Dixit wrote:
>Stream enable/disable functions previously had void return because failure
>during function execution was not possible. This will change when we
>introduce functionality to disable preemption on the stream exec
>queue. Therefore, in preparation for this functionality, prepare this code
>to be able to handle error returns.
>
>Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>

lgtm

Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>

>---
> drivers/gpu/drm/xe/xe_oa.c | 38 ++++++++++++++++++++++----------------
> 1 file changed, 22 insertions(+), 16 deletions(-)
>
>diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
>index 9263ae9a864e..a68659fd5386 100644
>--- a/drivers/gpu/drm/xe/xe_oa.c
>+++ b/drivers/gpu/drm/xe/xe_oa.c
>@@ -1013,24 +1013,26 @@ static void xe_oa_stream_disable(struct xe_oa_stream *stream)
> 		hrtimer_cancel(&stream->poll_check_timer);
> }
>
>-static void xe_oa_enable_locked(struct xe_oa_stream *stream)
>+static int xe_oa_enable_locked(struct xe_oa_stream *stream)
> {
> 	if (stream->enabled)
>-		return;
>-
>-	stream->enabled = true;
>+		return 0;
>
> 	xe_oa_stream_enable(stream);
>+
>+	stream->enabled = true;
>+	return 0;
> }
>
>-static void xe_oa_disable_locked(struct xe_oa_stream *stream)
>+static int xe_oa_disable_locked(struct xe_oa_stream *stream)
> {
> 	if (!stream->enabled)
>-		return;
>-
>-	stream->enabled = false;
>+		return 0;
>
> 	xe_oa_stream_disable(stream);
>+
>+	stream->enabled = false;
>+	return 0;
> }
>
> static long xe_oa_config_locked(struct xe_oa_stream *stream, u64 arg)
>@@ -1105,11 +1107,9 @@ static long xe_oa_ioctl_locked(struct xe_oa_stream *stream,
> {
> 	switch (cmd) {
> 	case DRM_XE_PERF_IOCTL_ENABLE:
>-		xe_oa_enable_locked(stream);
>-		return 0;
>+		return xe_oa_enable_locked(stream);
> 	case DRM_XE_PERF_IOCTL_DISABLE:
>-		xe_oa_disable_locked(stream);
>-		return 0;
>+		return xe_oa_disable_locked(stream);
> 	case DRM_XE_PERF_IOCTL_CONFIG:
> 		return xe_oa_config_locked(stream, arg);
> 	case DRM_XE_PERF_IOCTL_STATUS:
>@@ -1432,19 +1432,25 @@ static int xe_oa_stream_open_ioctl_locked(struct xe_oa *oa,
> 	if (ret)
> 		goto err_free;
>
>+	if (!param->disabled) {
>+		ret = xe_oa_enable_locked(stream);
>+		if (ret)
>+			goto err_destroy;
>+	}
>+
> 	stream_fd = anon_inode_getfd("[xe_oa]", &xe_oa_fops, stream, 0);
> 	if (stream_fd < 0) {
> 		ret = stream_fd;
>-		goto err_destroy;
>+		goto err_disable;
> 	}
>
>-	if (!param->disabled)
>-		xe_oa_enable_locked(stream);
>-
> 	/* Hold a reference on the drm device till stream_fd is released */
> 	drm_dev_get(&stream->oa->xe->drm);
>
> 	return stream_fd;
>+err_disable:
>+	if (!param->disabled)
>+		xe_oa_disable_locked(stream);
> err_destroy:
> 	xe_oa_stream_destroy(stream);
> err_free:
>-- 
>2.41.0
>

  reply	other threads:[~2024-06-25 21:53 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25 20:15 [PATCH 0/3] drm/xe/oa: Add NO_PREEMPT property Ashutosh Dixit
2024-06-25 20:15 ` [PATCH 1/3] drm/xe/oa: Allow stream enable/disable functions to return error Ashutosh Dixit
2024-06-25 21:53   ` Umesh Nerlige Ramappa [this message]
2024-06-25 20:15 ` [PATCH 2/3] drm/xe: Exec queue op's to enable/disable preemption and timeslicing Ashutosh Dixit
2024-06-25 21:57   ` Umesh Nerlige Ramappa
2024-06-25 22:01     ` Matthew Brost
2024-06-26  0:24       ` Dixit, Ashutosh
2024-06-26  0:35         ` Matthew Brost
2024-06-25 20:15 ` [PATCH 3/3] drm/xe/oa: Allow preemption to be disabled on the stream exec queue Ashutosh Dixit
2024-06-25 20:49   ` Souza, Jose
2024-06-26  0:29     ` Dixit, Ashutosh
2024-06-25 21:55   ` Umesh Nerlige Ramappa
2024-06-25 22:02     ` Matthew Brost
2024-06-25 20:37 ` ✓ CI.Patch_applied: success for drm/xe/oa: Add NO_PREEMPT property (rev3) Patchwork
2024-06-25 20:37 ` ✓ CI.checkpatch: " Patchwork
2024-06-25 20:38 ` ✓ CI.KUnit: " Patchwork
2024-06-25 20:50 ` ✓ CI.Build: " Patchwork
2024-06-25 20:52 ` ✓ CI.Hooks: " Patchwork
2024-06-25 20:53 ` ✓ CI.checksparse: " Patchwork
2024-06-25 21:16 ` ✓ CI.BAT: " Patchwork
2024-06-26  1:48 ` ✗ CI.FULL: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2024-06-25 20:05 [PATCH v2 0/3] drm/xe/oa: Add NO_PREEMPT property Ashutosh Dixit
2024-06-25 20:05 ` [PATCH 1/3] drm/xe/oa: Allow stream enable/disable functions to return error Ashutosh Dixit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zns8SpJfUJYMSYA+@orsosgc001 \
    --to=umesh.nerlige.ramappa@intel.com \
    --cc=ashutosh.dixit@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jose.souza@intel.com \
    --cc=lionel.g.landwerlin@intel.com \
    --cc=matthew.brost@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox