From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 06/16] drm: Protect the master management with a drm_device::master_mutex Date: Wed, 26 Mar 2014 23:38:40 +0100 Message-ID: <20140326223840.GY26878@phenom.ffwll.local> References: <1395753548-17441-1-git-send-email-thellstrom@vmware.com> <1395753548-17441-7-git-send-email-thellstrom@vmware.com> <53333B32.6090102@vmware.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ee0-f44.google.com (mail-ee0-f44.google.com [74.125.83.44]) by gabe.freedesktop.org (Postfix) with ESMTP id A23E26E7C5 for ; Wed, 26 Mar 2014 15:38:46 -0700 (PDT) Received: by mail-ee0-f44.google.com with SMTP id e49so2197540eek.31 for ; Wed, 26 Mar 2014 15:38:44 -0700 (PDT) Content-Disposition: inline In-Reply-To: <53333B32.6090102@vmware.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Thomas Hellstrom Cc: pv-drivers@vmware.com, linux-graphics-maintainer@vmware.com, "dri-devel@lists.freedesktop.org" List-Id: dri-devel@lists.freedesktop.org On Wed, Mar 26, 2014 at 09:40:18PM +0100, Thomas Hellstrom wrote: > On 03/26/2014 08:08 PM, David Herrmann wrote: > > "struct_mutex" is used to serialize all entry-points into > > the drm-device (and thus the driver) and also, often implicitly, as > > spin-lock for "struct drm_device" data protection. > > No. DRM locking was added as an after-though, and is a horrendous mess. > Nobody really knows what's protecting what, and that has caused a lot of > grief in the past. Probably most so for the Intel driver that relied > (relies?) on the struct_mutex to protect everything. The > drm_global_mutex is used to serialize the non-lock-audited entry points > into the drm device. The struct_mutex is used for data protection of > most core drm structures and serializing here and there. Modern drivers > have no locks held when entering their ioctls. Also we should not > confuse mutexes and spinlocks in this context, as they have very > different semantics. As the guy who gets to live the locking mess called dev->struct_mutex I holeheartedly welcome any efforts to split out clear subparts away from it. I actually had this very idea of adding a master-data related mutex on my todo. I'll try to review this later if I get around, but definitely Acked! -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch