Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6635813pxv; Thu, 29 Jul 2021 21:17:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzB5XXMQO2VjV6S05dRkqH+lYc2wCnHdMxG/4wIw6e1ZAKHZLiVPolXEeBVej7Zc7rFe4kc X-Received: by 2002:a05:6638:3708:: with SMTP id k8mr525591jav.58.1627618659885; Thu, 29 Jul 2021 21:17:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627618659; cv=none; d=google.com; s=arc-20160816; b=M7QsI3at2pheRIO6sIpkhIvWedzSG2OZRWkvaaWmOnB4U2MDo+gQlGGyEsHN6xFUxT cqC/Ds3CvasgB1QfkQF4DSwFQzmLwn5qVdQ5STj+CmETedU0HaJ4kz8bRBmS2G4Ao6W1 yqyJDR/tiZzN0J9Qxf24CSlNGdLwp68rLvXJAv/P1rFSj2+fzanc4qPq/zeOHLr0z9fT SZ/8nM1vG8nC9mUUyml3AJYAD5riUFjFn22JWlzGDJCs57VtAcqrL8QXvSfOjOessIlR ktsAyQz6od3JkFlFmhyyHvWJDqhl8C5D0IeaD1FdSxcD4Ri1gtub0/L2wGy4IZiZPsVK wAVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RTjOUqNyS9qJHqvoohAwX/XHxdbP/hKwu8NmsnUvkUk=; b=G0Q9ejPwgHKluHBQtrHDuswLNHeqo5X8F22R/wdGHtdrG/TsC13IWwkzHqDCxYazE5 H8dqVyPWExxdVO3fXH5S9Fce6pvEUQFCrntQR4yrSOg3wG1Kvp8miNUFGqKp5GwDIxkG iiI6cymWplXkrQ7mdju6PuMopV8cLpuqj45rlvWkpiYLs5PDw68yh+PuWUll+5hAx4Jh q94ydyyPH48CC2ifINDimyHhJc27J5PKDJ1H7xTUl0YTIwmLb20/tQF0n//B9g6C2DHO deZ+Uzqr5WaeLi7MRRcxnhe2D1Nalfye0UknmpC9Rpn4kFcWPMZ6Elv2uvBSlVZpJye6 k8vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ItslYacy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s22si488555iow.33.2021.07.29.21.17.28; Thu, 29 Jul 2021 21:17:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ItslYacy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233620AbhG3EQp (ORCPT + 99 others); Fri, 30 Jul 2021 00:16:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231509AbhG3EQa (ORCPT ); Fri, 30 Jul 2021 00:16:30 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 320D7C061798 for ; Thu, 29 Jul 2021 21:16:15 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id j1so13281454pjv.3 for ; Thu, 29 Jul 2021 21:16:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RTjOUqNyS9qJHqvoohAwX/XHxdbP/hKwu8NmsnUvkUk=; b=ItslYacy27SJ4b7GiYhiajuZEYDADEadcPkuVsgi5WwJUhoyfK0Fl2xViA03tu0kop YdJ0lTZBf+On7uMIIM+OHbuG9nZnIlLenhsE/iUM8XkK53u9wqJdWCDVg46dSeIngd1X RstZYnskselzkrui5eZNfmEWGgWx4WBFYPxMsXP8D4Ur1kB9Y4G7Lc277PPWCzdflaoD Hxhm7XmzD7MMuvNdefGKbIBEWlvC/j5kvm2e+qnktZoFc61TY5xvkU+OGjC66YyUzlC6 VvOqZyQM0KN4tEz9HvpWC9HqPOppbLQOinWaUFMzeIAlFkgfClRV1Xnr4vTzp6r09Sap EOoA== 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:mime-version:content-transfer-encoding; bh=RTjOUqNyS9qJHqvoohAwX/XHxdbP/hKwu8NmsnUvkUk=; b=Nap6F7gPTR7Q8FVbhjm86xSkF1TN5WexDDIwCgCefRxJJHKRmBb2Etzj7IedJ8Navp ADBGxCR7xRyoDpSB4uh15p4lTu+lEUiEAALFZ2o8MtNQNpWbi+1y5Er1VcRT4NLvvB/X jpFEca6IyJcvm836KTG4eMits3L81wWxWFMKyEd5Ka2L74jL2QVvur3ihVlzTriN036+ wEWa9bysC9KC/ADl8biPoDX2l/T2QqRQT4BqWD2WlkYSlI69z+uLXt9SHiE19XN9b8JO Q1CP5PTFz4+aqRkohFONLnz5KBImgG+wZmg1yMVveKX1QkUe/wsQWgpz89rCoWrQIsMz Ydkg== X-Gm-Message-State: AOAM530LCqi4g5HD22lk6NLu/79hR8f4FNw6h8b1IKRhIBDqh6qj5KDu bPTnNA4p8quOplU+bIHxrkM= X-Received: by 2002:a17:90b:1645:: with SMTP id il5mr878098pjb.113.1627618574806; Thu, 29 Jul 2021 21:16:14 -0700 (PDT) Received: from localhost.localdomain ([118.200.190.93]) by smtp.gmail.com with ESMTPSA id t19sm439322pfg.216.2021.07.29.21.16.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 21:16:14 -0700 (PDT) From: Desmond Cheong Zhi Xi To: maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@linux.ie, daniel@ffwll.ch, peterz@infradead.org, mingo@redhat.com, will@kernel.org, longman@redhat.com, boqun.feng@gmail.com Cc: Desmond Cheong Zhi Xi , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, skhan@linuxfoundation.org, gregkh@linuxfoundation.org, linux-kernel-mentees@lists.linuxfoundation.org Subject: [PATCH 2/2] drm: add lockdep assert to drm_is_current_master_locked Date: Fri, 30 Jul 2021 12:15:15 +0800 Message-Id: <20210730041515.1430237-3-desmondcheongzx@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210730041515.1430237-1-desmondcheongzx@gmail.com> References: <20210730041515.1430237-1-desmondcheongzx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In drm_is_current_master_locked, accessing drm_file.master should be protected by either drm_file.master_lookup_lock or drm_device.master_mutex. This was previously awkward to assert with lockdep. Following patch ("locking/lockdep: Provide lockdep_assert{,_once}() helpers"), this assertion is now convenient so we add it in. Signed-off-by: Desmond Cheong Zhi Xi --- drivers/gpu/drm/drm_auth.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c index 9c24b8cc8e36..6f4d7ff23c80 100644 --- a/drivers/gpu/drm/drm_auth.c +++ b/drivers/gpu/drm/drm_auth.c @@ -63,9 +63,9 @@ static bool drm_is_current_master_locked(struct drm_file *fpriv) { - /* Either drm_device.master_mutex or drm_file.master_lookup_lock - * should be held here. - */ + lockdep_assert_once(lockdep_is_held(&fpriv->master_lookup_lock) || + lockdep_is_held(&fpriv->minor->dev->master_mutex)); + return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master; } -- 2.25.1