From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Jani Nikula <jani.nikula@intel.com>
Subject: [Intel-gfx] [PATCH v2 4/4] drm/i915: Fix locking in DRRS debugfs
Date: Sat, 1 Oct 2022 21:25:05 +0300 [thread overview]
Message-ID: <20221001182505.3675-5-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20221001182505.3675-1-ville.syrjala@linux.intel.com>
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Grab the crtc mutex so that looking at the crtc state is
actually safe.
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/display/intel_drrs.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_drrs.c b/drivers/gpu/drm/i915/display/intel_drrs.c
index a5d6682475d1..2b94a62ef65a 100644
--- a/drivers/gpu/drm/i915/display/intel_drrs.c
+++ b/drivers/gpu/drm/i915/display/intel_drrs.c
@@ -301,8 +301,14 @@ void intel_crtc_drrs_init(struct intel_crtc *crtc)
static int intel_drrs_debugfs_status_show(struct seq_file *m, void *unused)
{
struct intel_crtc *crtc = m->private;
- const struct intel_crtc_state *crtc_state =
- to_intel_crtc_state(crtc->base.state);
+ const struct intel_crtc_state *crtc_state;
+ int ret;
+
+ ret = drm_modeset_lock_single_interruptible(&crtc->base.mutex);
+ if (ret)
+ return ret;
+
+ crtc_state = to_intel_crtc_state(crtc->base.state);
mutex_lock(&crtc->drrs.mutex);
@@ -321,6 +327,8 @@ static int intel_drrs_debugfs_status_show(struct seq_file *m, void *unused)
mutex_unlock(&crtc->drrs.mutex);
+ drm_modeset_unlock(&crtc->base.mutex);
+
return 0;
}
--
2.35.1
next prev parent reply other threads:[~2022-10-01 18:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-01 18:25 [Intel-gfx] [PATCH v2 0/4] drm/i915: Per-crtc/connector DRRS debugfs Ville Syrjala
2022-10-01 18:25 ` [Intel-gfx] [PATCH v2 1/4] drm/i915: Move DRRS debugfs next to the implementation Ville Syrjala
2022-10-01 18:25 ` [Intel-gfx] [PATCH v2 2/4] drm/i915: Make the DRRS debugfs contents more consistent Ville Syrjala
2022-10-01 18:25 ` [Intel-gfx] [PATCH v2 3/4] drm/i915: Make DRRS debugfs per-crtc/connector Ville Syrjala
2022-10-01 18:25 ` Ville Syrjala [this message]
2022-10-01 19:02 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915: Per-crtc/connector DRRS debugfs (rev2) Patchwork
2022-10-01 19:26 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-10-01 23:23 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-10-03 8:37 ` Ville Syrjälä
2022-10-03 8:44 ` Sarvela, Tomi P
2022-10-03 8:48 ` Ville Syrjälä
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=20221001182505.3675-5-ville.syrjala@linux.intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@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