From: "José Roberto de Souza" <jose.souza@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: "Ashutosh Dixit" <ashutosh.dixit@intel.com>,
"José Roberto de Souza" <jose.souza@intel.com>
Subject: [PATCH 1/3] drm/xe/oa: Replace per GT oa mutex per a global one
Date: Thu, 15 Aug 2024 09:27:56 -0700 [thread overview]
Message-ID: <20240815162758.36495-1-jose.souza@intel.com> (raw)
This mutex is not frequently used so there is no reason to have one
per GT, also this reduce complexity.
Also it was missed the code to destroy the mutex.
Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
---
drivers/gpu/drm/xe/xe_oa.c | 13 +++++++------
drivers/gpu/drm/xe/xe_oa_types.h | 5 ++---
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
index 3ef92eb8fbb1e..d6eec8caf4c51 100644
--- a/drivers/gpu/drm/xe/xe_oa.c
+++ b/drivers/gpu/drm/xe/xe_oa.c
@@ -1205,9 +1205,9 @@ static int xe_oa_release(struct inode *inode, struct file *file)
struct xe_oa_stream *stream = file->private_data;
struct xe_gt *gt = stream->gt;
- mutex_lock(>->oa.gt_lock);
+ mutex_lock(>->tile->xe->oa.streams_lock);
xe_oa_destroy_locked(stream);
- mutex_unlock(>->oa.gt_lock);
+ mutex_unlock(>->tile->xe->oa.streams_lock);
/* Release the reference the OA stream kept on the driver */
drm_dev_put(>_to_xe(gt)->drm);
@@ -1875,9 +1875,9 @@ int xe_oa_stream_open_ioctl(struct drm_device *dev, u64 data, struct drm_file *f
drm_dbg(&oa->xe->drm, "Using periodic sampling freq %lld Hz\n", oa_freq_hz);
}
- mutex_lock(¶m.hwe->gt->oa.gt_lock);
+ mutex_lock(&xe->oa.streams_lock);
ret = xe_oa_stream_open_ioctl_locked(oa, ¶m);
- mutex_unlock(¶m.hwe->gt->oa.gt_lock);
+ mutex_unlock(&xe->oa.streams_lock);
err_exec_q:
if (ret < 0 && param.exec_q)
xe_exec_queue_put(param.exec_q);
@@ -2388,8 +2388,6 @@ static int xe_oa_init_gt(struct xe_gt *gt)
__xe_oa_init_oa_units(gt);
- drmm_mutex_init(>_to_xe(gt)->drm, >->oa.gt_lock);
-
return 0;
}
@@ -2472,6 +2470,8 @@ int xe_oa_init(struct xe_device *xe)
oa->xe = xe;
oa->oa_formats = oa_formats;
+ mutex_init(&oa->streams_lock);
+
drmm_mutex_init(&oa->xe->drm, &oa->metrics_lock);
idr_init_base(&oa->metrics_idr, 1);
@@ -2508,5 +2508,6 @@ void xe_oa_fini(struct xe_device *xe)
idr_for_each(&oa->metrics_idr, destroy_config, oa);
idr_destroy(&oa->metrics_idr);
+ mutex_destroy(&oa->streams_lock);
oa->xe = NULL;
}
diff --git a/drivers/gpu/drm/xe/xe_oa_types.h b/drivers/gpu/drm/xe/xe_oa_types.h
index 540c3ec53a6d7..17e17b5b93640 100644
--- a/drivers/gpu/drm/xe/xe_oa_types.h
+++ b/drivers/gpu/drm/xe/xe_oa_types.h
@@ -112,9 +112,6 @@ struct xe_oa_unit {
* struct xe_oa_gt - OA per-gt information
*/
struct xe_oa_gt {
- /** @gt_lock: lock protecting create/destroy OA streams */
- struct mutex gt_lock;
-
/** @num_oa_units: number of oa units for each gt */
u32 num_oa_units;
@@ -149,6 +146,8 @@ struct xe_oa {
/** @oa_unit_ids: tracks oa unit ids assigned across gt's */
u16 oa_unit_ids;
+
+ struct mutex streams_lock;
};
/** @xe_oa_buffer: State of the stream OA buffer */
--
2.46.0
next reply other threads:[~2024-08-15 16:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-15 16:27 José Roberto de Souza [this message]
2024-08-15 16:27 ` [PATCH 2/3] drm/xe/oa: Remove the drm device reference of oa_stream in xe_oa_destroy_locked() José Roberto de Souza
2024-08-15 16:27 ` [PATCH 3/3] drm/xe/oa: Destroy dangling oa streams when xe_file is removed José Roberto de Souza
2024-08-15 18:17 ` Lucas De Marchi
2024-08-15 20:40 ` Dixit, Ashutosh
2024-08-15 16:33 ` ✓ CI.Patch_applied: success for series starting with [1/3] drm/xe/oa: Replace per GT oa mutex per a global one Patchwork
2024-08-15 16:33 ` ✗ CI.checkpatch: warning " Patchwork
2024-08-15 16:34 ` ✓ CI.KUnit: success " Patchwork
2024-08-15 16:42 ` [PATCH 1/3] " Matthew Brost
2024-08-15 21:11 ` Dixit, Ashutosh
2024-08-15 16:46 ` ✓ CI.Build: success for series starting with [1/3] " Patchwork
2024-08-15 16:48 ` ✗ CI.Hooks: failure " Patchwork
2024-08-15 16:50 ` ✓ CI.checksparse: success " Patchwork
2024-08-15 17:34 ` ✗ CI.BAT: failure " Patchwork
2024-08-15 18:31 ` ✗ CI.FULL: " Patchwork
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=20240815162758.36495-1-jose.souza@intel.com \
--to=jose.souza@intel.com \
--cc=ashutosh.dixit@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/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