From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Subject: Re: [PATCH 08/18] drm: Rip out totally bogus vga_switcheroo->can_switch locking Date: Thu, 17 Apr 2014 16:56:04 +0200 Message-ID: <20140417145600.GH550@ulmo> References: <1397252175-14227-1-git-send-email-daniel.vetter@ffwll.ch> <1397252175-14227-9-git-send-email-daniel.vetter@ffwll.ch> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0166575160==" Return-path: Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com [74.125.83.53]) by gabe.freedesktop.org (Postfix) with ESMTP id DB3EF6EB9A for ; Thu, 17 Apr 2014 07:57:13 -0700 (PDT) Received: by mail-ee0-f53.google.com with SMTP id b57so776868eek.12 for ; Thu, 17 Apr 2014 07:57:12 -0700 (PDT) In-Reply-To: <1397252175-14227-9-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: DRI Development List-Id: dri-devel@lists.freedesktop.org --===============0166575160== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="MP5ln1Rcf9Bvi+ZW" Content-Disposition: inline --MP5ln1Rcf9Bvi+ZW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 11, 2014 at 11:36:05PM +0200, Daniel Vetter wrote: [...] > diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_= dma.c > index 4dff829c2d89..dcb67c6564dd 100644 > --- a/drivers/gpu/drm/i915/i915_dma.c > +++ b/drivers/gpu/drm/i915/i915_dma.c > @@ -1286,9 +1286,12 @@ static bool i915_switcheroo_can_switch(struct pci_= dev *pdev) > struct drm_device *dev =3D pci_get_drvdata(pdev); > bool can_switch; > =20 > - spin_lock(&dev->count_lock); > + /* > + * FIXME: open_count is protected by drm_global_mutex but that would le= ad to > + * locking inversion with the driver load path. And the access here is > + * completely racy anyway. So don't bother with locking for now. > + */ > can_switch =3D (dev->open_count =3D=3D 0); > - spin_unlock(&dev->count_lock); > return can_switch; > } Couldn't this now be shortened to: return (dev->open_count =3D=3D 0); ? Similarily for the other drivers. > diff --git a/include/drm/drmP.h b/include/drm/drmP.h > index 9f1fb8d36b67..bd16a4c8ece4 100644 > --- a/include/drm/drmP.h > +++ b/include/drm/drmP.h > @@ -1076,7 +1076,7 @@ struct drm_device { > =20 > /** \name Usage Counters */ > /*@{ */ > - int open_count; /**< Outstanding files open */ > + int open_count; /**< Outstanding files open, protected by drm_global_= lock. */ s/drm_global_lock/drm_global_mutex/? Thierry --MP5ln1Rcf9Bvi+ZW Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJTT+uAAAoJEN0jrNd/PrOhJZEP/2/XD3CUS10SUHI2YJnFLtzj 0RSwcq5PgLXa4BNDM6ARKMrzUH2WNX6Jp6cqPoRLliINMCREhTuCNXJQXuPucpZD bGpLQALdMBEtn3ewYii0IaEEWM9YQpD2jTua/BDOXlW74w7aU08YCqeiXL7sEHZk 7EEA5Xg4RtK2Re4mz+2RN6CR2EB4jp3Bu7ct+yp7e7VwY9n75McO4+SSjscg5BBk cWzX24F4Ly8KMuy/BMjnYlpfy039YY0p78CF/SpQwuXHFFm6oRoJ29cR3N3BR9vL 07Uhtz58qHZigoYqkfcWQFscsDtwtoVN9x5IFU0FtDUjpbUiC+F2iETLixxrXZPS votUWp+7CSRfZyQU3TiftYsREg/K8ZKzGwYkvEAhx04cmVAy2nYQLPb3qlaQ2P+9 5Bunh8WfPrXtndV4YXDXfjWvHx6JBvwsIwTGUAXfX9Nnj/RCttlr/pmHaGrfJxmM pYkx1mPNQTf1t7CZpA517LF2npa9Y2eRyRT7B6BNDxmfa9Q/3XZCnzG/AZfVasWZ aJBhm+eINXCZP5C32I9VmAuDXsW3cxUu0whmuFghGYbj3anee/Ybmz8Hu9scHc5U j/dL5S+wuPFUMTDK/yGNtXQj82oomTMVYONH9AGAUQI691iJhMB1ehfItXlDwWpe +FQ5+JReCuOvfllorGBq =1uBj -----END PGP SIGNATURE----- --MP5ln1Rcf9Bvi+ZW-- --===============0166575160== 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 --===============0166575160==--