From patchwork Fri Dec 9 14:19:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 9468323 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C718F607DA for ; Fri, 9 Dec 2016 14:20:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA0CA2861C for ; Fri, 9 Dec 2016 14:20:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF2022861F; Fri, 9 Dec 2016 14:20:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 76F6428624 for ; Fri, 9 Dec 2016 14:20:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 032026EA07; Fri, 9 Dec 2016 14:19:51 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 91F5E6E9F5 for ; Fri, 9 Dec 2016 14:19:44 +0000 (UTC) Received: by mail-wm0-x241.google.com with SMTP id a20so4313460wme.2 for ; Fri, 09 Dec 2016 06:19:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rchFmbV/3rE6aU5cifg3BI3xxRwVfUqevNaZagcs6wk=; b=TzqyCar1NHDGNa5ujDoPcU1EDomJIC3aYVLU0wc6zVoY+EAC55ZSL4piUm4oCRTGz+ oLJorl2bj4aF4K4Wwunl44Ekbkkcs5sM0R0g0JHpE/0UliAs5QI6GLVlcqNrn/4xtAYN KqNHcjhPr6zhaG7JL7/a6Z8EupjddC6PKQ/54= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rchFmbV/3rE6aU5cifg3BI3xxRwVfUqevNaZagcs6wk=; b=G/yvJttG4oOw0hU1VoRBSZDuiHnjksS06fzEzMPr32DB6Bg71bxFE7G1JGivrUeI1y N/S3uQszGWownx1YyOTL2z48qidpeAfy8z4WowlScdwlJr2gEBUG44hkHMRgy+sS/CYs R8sHcmEKvZ/2fR2CAX9AQ6PCiqwuXSBSKsMGaxB+Mh71osK8cEBD+y5AWBJGGPTIgakQ vR6apjlbSPlhBMYg1BL/pF88wqOzJQpnxywD/C3Q7bKuIyM/Ozs615AAX0pzvE+mbDwR Gk60o7CScWQpv/BIK4kuaMIAaGBUfsN5DjONgrBczcDGdDNRE16oElsL1davmAZyMfjr KefQ== X-Gm-Message-State: AKaTC022PwD9zykTUsqsulWlcU/QnHSCMkSRaA7d0GnyBHVmDMg0mnRUl5uBffWKiyudvg== X-Received: by 10.28.31.65 with SMTP id f62mr7587276wmf.108.1481293182803; Fri, 09 Dec 2016 06:19:42 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:56b5:0:ac27:b86c:7764:9429]) by smtp.gmail.com with ESMTPSA id y4sm42573752wjp.0.2016.12.09.06.19.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Dec 2016 06:19:42 -0800 (PST) From: Daniel Vetter To: DRI Development Subject: [PATCH 4/7] drm: Enforce BKL-less ioctls for modern drivers Date: Fri, 9 Dec 2016 15:19:41 +0100 Message-Id: <20161209141944.22121-4-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161209141944.22121-1-daniel.vetter@ffwll.ch> References: <20161209141944.22121-1-daniel.vetter@ffwll.ch> Cc: Daniel Vetter , Intel Graphics Development , Daniel Vetter X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP With the last round of changes all ioctls called by modern drivers now have their own locking. Everything else is only allowed for legacy drivers and hence the lack of locking doesn't matter. One exception is nouveau, due to the DRIVER_KMS_LEGACY_CONTEXT flag. But that only works its magic on the context and bufs ioctls. And drm_bufs.c is protected with dev->struct_mutex, and drm_context.c by the same and dev->ctxlist_mutex. That should be all safe, and we can finally mandata drm-bkl-less ioctls for everyone! Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_ioctl.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index e1b2c372f021..e21a18ac968e 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -735,9 +735,8 @@ long drm_ioctl(struct file *filp, if (ksize > in_size) memset(kdata + in_size, 0, ksize - in_size); - /* Enforce sane locking for modern driver ioctls. Core ioctls are - * too messy still. */ - if ((!drm_core_check_feature(dev, DRIVER_LEGACY) && is_driver_ioctl) || + /* Enforce sane locking for modern driver ioctls. */ + if (!drm_core_check_feature(dev, DRIVER_LEGACY) || (ioctl->flags & DRM_UNLOCKED)) retcode = func(dev, kdata, file_priv); else {