All of lore.kernel.org
 help / color / mirror / Atom feed
From: Harry Wentland <harry.wentland@amd.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Keith Packard <keithp@keithp.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [RFC][PATCH 11/11] drm: Sprinkle lockdep asserts for edid/display_info
Date: Tue, 6 Mar 2018 13:32:21 -0500	[thread overview]
Message-ID: <9702c1c0-00be-2c3d-3054-12eac2e8e00a@amd.com> (raw)
In-Reply-To: <20180306171309.GR22212@phenom.ffwll.local>



On 2018-03-06 12:13 PM, Daniel Vetter wrote:
> On Tue, Mar 06, 2018 at 11:23:23AM -0500, Harry Wentland wrote:
>> On 2018-03-06 07:18 AM, Ville Syrjälä wrote:
>>> On Tue, Mar 06, 2018 at 10:31:27AM +0100, Daniel Vetter wrote:
>>>> On Tue, Feb 27, 2018 at 02:57:00PM +0200, Ville Syrjala wrote:
>>>>> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>>>>>
>>>>> edid and display_info are protected by mode_config.mutex. Add lockdep
>>>>> asserts to make sure we're not accessing things w/o the lock.
>>>>>
>>>>> FIXME: pretty sure this will blow up with amdgpu as they seem
>>>>> to be doing edid updates even from the modeset path. Need to figure
>>>>> out what to do about that. Maybe protect the edid/display info with
>>>>> with connection_mutex instead of mode_config.mutex?
>>>>
>>>> Imo not doing EDID udpates from the modeset path is the right fix. I can't
>>>> think of any reasonable reason to do that at least. Can you point me at
>>>> the relevant amdgpu code pls (I'm lazy, sry)?
>>>
>>> It was some MST thing I believe... (should have written it down)
>>>
>>> amdgpu_dm_atomic_check() -> dm_update_crtcs_state() ->
>>> create_stream_for_sink() -> dm_dp_mst_dc_sink_create() ->
>>> get_edid/update_edid_property
>>>
>>
>> Yeah, it's because the dc_sink carries the EDID and is only created at
>> this point for us. It's bugged me ever since we did this. Might be time
>> to think of a solution to it now.
> 
> But how does this work? Userspace won't do a modeset without the EDID
> present and the modes listed, which means you'll never ever end up in
> atomic check. This really sounds rather wrong.
> 

Not sure if this works correctly with atomic userspace.

I think with legacy userspace we might rely on the get_connector call doing .fill_modes > drm_helper_probe_single_connector_modes > .get_modes > dm_dp_mst_get_modes > drm_dp_mst_get_edid

Harry


> Only idea I can come up with is that you're abusing the regular pageflip
> request as a worker thread, but that's some seriously backwards design.
> -Daniel
> 
>>
>> Harry
>>
>>>>
>>>> Otherwise I think this is a real good patch.
>>>>
>>>> Thanks, Daniel
>>>>
>>>>>
>>>>> Cc: Keith Packard <keithp@keithp.com>
>>>>> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
>>>>> Cc: Harry Wentland <harry.wentland@amd.com>
>>>>> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>>>>> ---
>>>>>  drivers/gpu/drm/drm_connector.c    | 4 ++++
>>>>>  drivers/gpu/drm/drm_edid.c         | 2 ++
>>>>>  drivers/gpu/drm/drm_probe_helper.c | 2 +-
>>>>>  3 files changed, 7 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
>>>>> index 122060792b6f..a9f3536f4e94 100644
>>>>> --- a/drivers/gpu/drm/drm_connector.c
>>>>> +++ b/drivers/gpu/drm/drm_connector.c
>>>>> @@ -1374,6 +1374,8 @@ int drm_mode_connector_update_edid_property(struct drm_connector *connector,
>>>>>  	size_t size = 0;
>>>>>  	int ret;
>>>>>  
>>>>> +	lockdep_assert_held(&dev->mode_config.mutex);
>>>>> +
>>>>>  	/* ignore requests to set edid when overridden */
>>>>>  	if (connector->override_edid)
>>>>>  		return 0;
>>>>> @@ -1770,6 +1772,8 @@ void drm_connector_reset_display_info(struct drm_connector *connector)
>>>>>  {
>>>>>  	struct drm_display_info *info = &connector->display_info;
>>>>>  
>>>>> +	lockdep_assert_held(&connector->dev->mode_config.mutex);
>>>>> +
>>>>>  	memset(info, 0, sizeof(*info));
>>>>>  }
>>>>>  EXPORT_SYMBOL_GPL(drm_connector_reset_display_info);
>>>>> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
>>>>> index 618093c4a039..7f9e9236114b 100644
>>>>> --- a/drivers/gpu/drm/drm_edid.c
>>>>> +++ b/drivers/gpu/drm/drm_edid.c
>>>>> @@ -4440,6 +4440,8 @@ u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edi
>>>>>  	struct drm_display_info *info = &connector->display_info;
>>>>>  	u32 quirks = edid_get_quirks(edid);
>>>>>  
>>>>> +	lockdep_assert_held(&connector->dev->mode_config.mutex);
>>>>> +
>>>>>  	info->width_mm = edid->width_cm * 10;
>>>>>  	info->height_mm = edid->height_cm * 10;
>>>>>  
>>>>> diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
>>>>> index 7dc7e635d7e4..2a2afcf72788 100644
>>>>> --- a/drivers/gpu/drm/drm_probe_helper.c
>>>>> +++ b/drivers/gpu/drm/drm_probe_helper.c
>>>>> @@ -400,7 +400,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
>>>>>  	enum drm_connector_status old_status;
>>>>>  	struct drm_modeset_acquire_ctx ctx;
>>>>>  
>>>>> -	WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
>>>>> +	lockdep_assert_held(&dev->mode_config.mutex);
>>>>>  
>>>>>  	drm_modeset_acquire_init(&ctx, 0);
>>>>>  
>>>>> -- 
>>>>> 2.13.6
>>>>>
>>>>
>>>> -- 
>>>> Daniel Vetter
>>>> Software Engineer, Intel Corporation
>>>> http://blog.ffwll.ch
>>>
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-03-06 18:32 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-27 12:56 [RFC][PATCH 00/11] drm: Try to make display info less nuts Ville Syrjala
2018-02-27 12:56 ` Ville Syrjala
2018-02-27 12:56 ` [RFC][PATCH 01/11] drm/gma500: Fill display_info.{width, height}_mm from .get_modes() Ville Syrjala
2018-02-27 12:56 ` [RFC][PATCH 02/11] drm/i915: " Ville Syrjala
2018-02-27 12:56 ` [RFC][PATCH 03/11] drm/shmobile: Don't fill display_info.{width,height}_mm at init time Ville Syrjala
2018-02-27 12:56   ` [RFC][PATCH 03/11] drm/shmobile: Don't fill display_info.{width, height}_mm " Ville Syrjala
2018-02-27 12:56 ` [RFC][PATCH 04/11] drm: Split the display info into static and dynamic parts Ville Syrjala
2018-02-27 12:56   ` Ville Syrjala
2018-02-27 13:08   ` Maxime Ripard
2018-02-27 13:08     ` Maxime Ripard
2018-02-27 13:23   ` Philipp Zabel
2018-02-27 13:23     ` Philipp Zabel
2018-02-28  4:58   ` Archit Taneja
2018-02-28  4:58     ` Archit Taneja
2018-02-28  8:46   ` Sharma, Shashank
2018-02-28  8:46     ` Sharma, Shashank
2018-02-28  9:17   ` Stefan Agner
2018-02-28  9:17     ` Stefan Agner
2018-02-28 21:11   ` Alex Deucher
2018-02-28 21:11     ` Alex Deucher
2018-03-02  7:59   ` Linus Walleij
2018-03-02  7:59     ` Linus Walleij
2018-03-06  9:41   ` Daniel Vetter
2018-03-06  9:41     ` Daniel Vetter
2018-02-27 12:56 ` [RFC][PATCH 05/11] drm/edid: Clear display info fully Ville Syrjala
2018-02-28  8:58   ` Sharma, Shashank
2018-03-06  9:33   ` Daniel Vetter
2018-03-06  9:42     ` Daniel Vetter
2018-03-06  9:52     ` Daniel Vetter
2018-02-27 12:56 ` [RFC][PATCH 06/11] drm/edid: Don't call drm_add_display_info() with an invalid EDID Ville Syrjala
2018-03-06  9:45   ` Daniel Vetter
2018-02-27 12:56 ` [RFC][PATCH 07/11] drm/probe-helper: Avoid iterating the list twice on ww backoff Ville Syrjala
2018-03-06  9:49   ` Daniel Vetter
2018-03-06 11:48     ` Ville Syrjälä
2018-02-27 12:56 ` [RFC][PATCH 08/11] drm: Add drm_connector_fill_modes() Ville Syrjala
2018-03-06 10:00   ` Daniel Vetter
2018-03-06 10:30     ` Ville Syrjälä
2018-02-27 12:56 ` [RFC][PATCH 09/11] drm: Fix getconnector locking Ville Syrjala
2018-03-06  9:55   ` Daniel Vetter
2018-02-27 12:56 ` [RFC][PATCH 10/11] drm: Fix debugfs edid_override locking Ville Syrjala
2018-03-06  9:56   ` Daniel Vetter
2018-02-27 12:57 ` [RFC][PATCH 11/11] drm: Sprinkle lockdep asserts for edid/display_info Ville Syrjala
2018-03-06  9:31   ` Daniel Vetter
2018-03-06 12:18     ` Ville Syrjälä
2018-03-06 16:23       ` Harry Wentland
2018-03-06 17:13         ` Daniel Vetter
2018-03-06 18:32           ` Harry Wentland [this message]
2018-03-07 16:26             ` Daniel Vetter
2018-02-27 14:06 ` ✓ Fi.CI.BAT: success for drm: Try to make display info less nuts Patchwork
2018-02-27 20:14 ` ✗ Fi.CI.IGT: failure " 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=9702c1c0-00be-2c3d-3054-12eac2e8e00a@amd.com \
    --to=harry.wentland@amd.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=keithp@keithp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.