From patchwork Thu Feb 28 17:00:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10833487 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AE96915AC for ; Thu, 28 Feb 2019 17:00:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B2022F4E7 for ; Thu, 28 Feb 2019 17:00:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F6A82F4FD; Thu, 28 Feb 2019 17:00:59 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 55C1A2F4E7 for ; Thu, 28 Feb 2019 17:00:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 915936E229; Thu, 28 Feb 2019 17:00:51 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id 279186E223 for ; Thu, 28 Feb 2019 17:00:47 +0000 (UTC) Received: by mail-ed1-x543.google.com with SMTP id j89so17567612edb.9 for ; Thu, 28 Feb 2019 09:00:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jci4Ps+gTPeFmhpRvIYngaB4Uucez94AZsmk62dpft4=; b=leRCgciHrT3D83E03MhisvJKR5lqjRpc4gXqEHD9nErvAX4OoN9zMsOdzNKmfhRLnI We2yk1SLxYvAg9wPqzP8FVXB3gpZ7gkvb3SRX/SQYiopJ3uqLZTtiql3eshO+jSvVP8d UrIHiU5wW6QxKJcn7+jamKP0eGQzXcc/Sog2CdeKX8/wmVGYI5c/SOspUDNK68KMfB1g dxs973DZg36LQHxOT/pTrqhutiwUtgF2YO8/zu1VofU40TUnRvlTJy0cQdPMoIOW0Y3I cSmKta5dQjbIJJQbNvR+7somCxKmsj3myhvteVt/YIn+gxhBAu2EIWaKTSUfdvx0wbc6 9Uxg== X-Gm-Message-State: APjAAAXeh50pwH82Fgw1eiT7dTH7HBRg2WqzSL2sJXSubofPcF0e8H6U PyYBhY4jstR6aBVNeNcnpo1sP5Nodm0apA== X-Google-Smtp-Source: APXvYqwhXnq1js12kXJjZmnYlquKWDVPlRTyy7uOV+K1fpN3XaA7HlZ6aebNzCtF6mNnqmL1QpBPSw== X-Received: by 2002:a50:b515:: with SMTP id y21mr528305edd.112.1551373245473; Thu, 28 Feb 2019 09:00:45 -0800 (PST) Received: from wespe.ffwll.local ([2a02:168:569e:0:7e01:304d:1991:69d]) by smtp.gmail.com with ESMTPSA id k26sm2070910edd.16.2019.02.28.09.00.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Feb 2019 09:00:44 -0800 (PST) From: Daniel Vetter To: DRI Development Subject: [PATCH 4/7] drm/lease: Check for lessor outside of locks Date: Thu, 28 Feb 2019 18:00:31 +0100 Message-Id: <20190228170034.27660-5-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20190228170034.27660-1-daniel.vetter@ffwll.ch> References: <20190228170034.27660-1-daniel.vetter@ffwll.ch> X-Mailman-Original-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=jci4Ps+gTPeFmhpRvIYngaB4Uucez94AZsmk62dpft4=; b=FYO9OUPMsQtnN6mBRxPm5C5RftjR/hpy0RJYNJ8CKx5BqOJ/FAELBRDPP/iP6Y5ARB H5lXGuK4z4iJFD5rmWEmMOWdpWWWp6I3fbMXLNL6Ut2gnDELSuwvHgKLALPqzzZL8vKQ 4x5DEevnMdddUFWNccQJq3fN1aoKVQPMbyYnM= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Intel Graphics Development , Keith Packard MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The lessor is invariant over a lifetime of a lease, we don't have to grab any locks for that. Speeds up the common case of not being a lease. Cc: Keith Packard Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_lease.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c index cce5d9dd52ff..694ff363a90b 100644 --- a/drivers/gpu/drm/drm_lease.c +++ b/drivers/gpu/drm/drm_lease.c @@ -111,7 +111,7 @@ static bool _drm_has_leased(struct drm_master *master, int id) */ bool _drm_lease_held(struct drm_file *file_priv, int id) { - if (file_priv == NULL || file_priv->master == NULL) + if (!file_priv || !file_priv->master) return true; return _drm_lease_held_master(file_priv->master, id); @@ -133,7 +133,7 @@ bool drm_lease_held(struct drm_file *file_priv, int id) struct drm_master *master; bool ret; - if (file_priv == NULL || file_priv->master == NULL) + if (!file_priv || !file_priv->master || !file_priv->master->lessor) return true; master = file_priv->master; @@ -159,7 +159,7 @@ uint32_t drm_lease_filter_crtcs(struct drm_file *file_priv, uint32_t crtcs_in) int count_in, count_out; uint32_t crtcs_out = 0; - if (file_priv == NULL || file_priv->master == NULL) + if (!file_priv || !file_priv->master || !file_priv->master->lessor) return crtcs_in; master = file_priv->master;