From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Subject: Re: [PATCH] drm: Rip out totally bogus vga_switcheroo->can_switch locking Date: Wed, 23 Apr 2014 09:28:55 +0200 Message-ID: <20140423072853.GD31226@ulmo> References: <20140417145600.GH550@ulmo> <1398199519-21821-1-git-send-email-daniel.vetter@ffwll.ch> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1793092933==" Return-path: Received: from mail-ee0-f45.google.com (mail-ee0-f45.google.com [74.125.83.45]) by gabe.freedesktop.org (Postfix) with ESMTP id 80A866E9D9 for ; Wed, 23 Apr 2014 00:30:16 -0700 (PDT) Received: by mail-ee0-f45.google.com with SMTP id d17so403160eek.18 for ; Wed, 23 Apr 2014 00:30:15 -0700 (PDT) In-Reply-To: <1398199519-21821-1-git-send-email-daniel.vetter@ffwll.ch> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Daniel Vetter Cc: Thierry Reding , DRI Development List-Id: dri-devel@lists.freedesktop.org --===============1793092933== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PHCdUe6m4AxPMzOu" Content-Disposition: inline --PHCdUe6m4AxPMzOu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 22, 2014 at 10:45:19PM +0200, Daniel Vetter wrote: > So I just wanted to add a new field to struct drm_device and > accidentally stumbled over something. According to comments > dev->open_count is protected by dev->count_lock, but that's totally > not the case. It's protected by drm_global_mutex. >=20 > Unfortunately the vga switcheroo callbacks took this comment at face > value. The problem is that we can't just take the drm_global_mutex > because: > - It would lead to a locking inversion with the driver load/unload > paths. > - It wouldn't actually protect anything, for that we'd need to wrap > the entire vga switcheroo code in the drm_global_mutex. And I'm not > sure whether that would actually solve anything. >=20 > What we probably want is a try_to_grab_switcheroo reference kind of > thing which is used in the driver's ->open callback. Then we could > move all that ->can_switch madness into the vga switcheroo core where > it really belongs. >=20 > But since that would amount to real work take the easy way out and > just add a comment. It's definitely not going to make anything worse > since doing switcheroo state changes while restarting X just isn't > recommended. Even though the delayed switching code does exactly that. >=20 > v2: > - Simplify the ->can_switch implementations more (Thierry) > - Fix comment about the dev->open_count locking (Thierry) >=20 > Cc: Thierry Reding > Reviewed-by: Laurent Pinchart (v1) > Signed-off-by: Daniel Vetter > --- > drivers/gpu/drm/i915/i915_dma.c | 11 ++++++----- > drivers/gpu/drm/nouveau/nouveau_vga.c | 11 ++++++----- > drivers/gpu/drm/radeon/radeon_device.c | 11 ++++++----- > include/drm/drmP.h | 2 +- > 4 files changed, 19 insertions(+), 16 deletions(-) Looks good: Reviewed-by: Thierry Reding --PHCdUe6m4AxPMzOu Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJTV2u1AAoJEN0jrNd/PrOh9KgQAMLkSAW7eMOuP33rKYbv8uls klBI6KVIE9laqAr9U6BMZoIDVQ4sA0EnLxy35EhpRi7yyPRFlRy64AVATj2CimFS kXPRC02jNV55S48oDGQpO9fnsCSd7f7AHJyUlLqq8+l/mrO2FAIWuGKQLKjgatrS 7i1Nsu1LT7ymt5jTruX7hmApGDSPBPf2zp8nMBr3OL3rmeNNwJ0y9/HRJwlSkfU+ FuXUyNdvN8+5FLDH+kLdhT47kZl7P0FVN4oJYInxDZSFbIMmo/gZjRUWsnVCya8m lnAr943T8GC12o1ETZJBmIDZRa+st5E5yOUawp9pQ1wUjaH+nrO8UacwMAMCsmCN Fs7KEwMOEM+93OPOUkTxD16T3xh6DkYAGxVO1seB3U9c1kyx07QUXif0dMXnIClY GzLkCYH47IWtkfvWS6lwj4YOCg1ul4WSGa6A3bwyK3iRlWF3OZwTgjKExnv04yhP hl6jBpl1A+gkdFQR1Ez8CBP1xvGi4KTx3rO78fFxX8WhDtkMSU5dDdaSAI5dd8xB f9+GL3Imi8lgRQWxTF3wKssi4kBPKJqIIdZsoH9yE4C5nI5WymDio3x7uZNbLoYB 7VUj4eu55v2h/JjMa6cpoKRP0ihYdc/7KPrUYC4IVwX5a4X1Kf3NhB150Jwjs2Aq WBRrec1Fomf31BBEVT4R =bMm4 -----END PGP SIGNATURE----- --PHCdUe6m4AxPMzOu-- --===============1793092933== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel --===============1793092933==--