Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4560930pxv; Tue, 29 Jun 2021 09:49:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwY7/0Hh7/WBCGn1Nr33F1OeZ//PikTvQOzw+7eFnae2YZZR41p4sPzMuPfWYBmMTitX5A4 X-Received: by 2002:a05:6402:2ce:: with SMTP id b14mr41378500edx.23.1624985356983; Tue, 29 Jun 2021 09:49:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624985356; cv=none; d=google.com; s=arc-20160816; b=SOQd3+kDtEvI13voDgKxdGcuaBp4+m/lYgtZ7pyhlSroAViHDe4tiQik0sc80v8h3C ZG68jdEkcNHMOc0QzniWcMOuJ+t5vU85fPTAhKGe9qSLrwZnNCM9mxVvT1nsfs8aCH52 gYHAsUbmytQxf1wFvI8uLnrxJNxkRkQH6M7SdX6bRvtms0vWDohplkcXL/hK6EOpgkHq 33qVGFcuSUX+h6DzOHaIlarY1w8uhXUDsZvmkFJ0iv9cZh2Uh8fK9Agknd6xBWcndlQo yUbVuEsNOQzp90BYi1+2K5RUjowYJiZMK7rGTMIKkkqjbIW5n8tFtWS6LjuJISibT0eV MLyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Lcpz31AOMsK8A7FjlCsJyTnEiQjJRh6/8b8zkHaRep8=; b=yjT3lck1vkbt5B08pZe1Fp0/MJWNqguwvl7kenWYt4eL5ObTd1ZUPU52NA7vwCdVnY 7tHy3w1OVA+9AWnzOeaK15TyikQGxbxEK0p5b1mhuMBMr7sgXkTIEICNQa18VAhy5A1l K1cpfdHhtgN9Xsfu34Vs2vl7DUsjtJugCyxT1wf0YbtB7x1ODKzD0MufYmFE0BEPAnUA +ZBsL9jy+Sjgqtxm+Tni6XaivvLU5DwHNjzGN6eus33HSRjieJr7a2wJ908Ryx0X9g+E 82KBhG3U7UQ9ltcrePd5IhMfMuSNvsaAwPQo5qpH+qgMJiOHCzzkYlj08T/6kZOV4nNL qw4w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u19si19787593edo.356.2021.06.29.09.48.50; Tue, 29 Jun 2021 09:49:16 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234009AbhF2P6K (ORCPT + 99 others); Tue, 29 Jun 2021 11:58:10 -0400 Received: from mga03.intel.com ([134.134.136.65]:7434 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233754AbhF2P6J (ORCPT ); Tue, 29 Jun 2021 11:58:09 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10030"; a="208213869" X-IronPort-AV: E=Sophos;i="5.83,309,1616482800"; d="scan'208";a="208213869" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2021 08:55:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,309,1616482800"; d="scan'208";a="489297301" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.171]) by orsmga001.jf.intel.com with SMTP; 29 Jun 2021 08:55:28 -0700 Received: by stinkbox (sSMTP sendmail emulation); Tue, 29 Jun 2021 18:55:27 +0300 Date: Tue, 29 Jun 2021 18:55:27 +0300 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Hamza Mahfooz Cc: linux-kernel@vger.kernel.org, Sean Paul , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , Manasi Navare , =?iso-8859-1?Q?Jos=E9?= Roberto de Souza , Imre Deak , Dave Airlie , Maarten Lankhorst , Karthik B S , Matt Roper , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH v2] drm/i915/display: replace boilerplate code with helper macros Message-ID: References: <20210626073230.41803-1-someguy@effective-light.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210626073230.41803-1-someguy@effective-light.com> X-Patchwork-Hint: comment Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 26, 2021 at 03:32:27AM -0400, Hamza Mahfooz wrote: > As per commit 22be87401289 ("drm: TODO: Add DRM_MODESET_LOCK_ALL* > conversion to todo.rst"), > drm_modeset_lock_all()/drm_modeset_unlock_all() and boilerplate code > surrounding instances of drm_modeset_lock_all_ctx() with a local acquire > context should be replaced with the relevant helper macros. > > Signed-off-by: Hamza Mahfooz > --- > drivers/gpu/drm/i915/display/intel_display.c | 20 +++++++------------- > 1 file changed, 7 insertions(+), 13 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c > index 64e9107d70f7..e8cb2881d2b4 100644 > --- a/drivers/gpu/drm/i915/display/intel_display.c > +++ b/drivers/gpu/drm/i915/display/intel_display.c > @@ -40,6 +40,7 @@ > #include > #include > #include > +#include "drm/drm_modeset_lock.h" > #include > #include > #include > @@ -11836,6 +11837,7 @@ int intel_modeset_init_nogem(struct drm_i915_private *i915) > struct drm_device *dev = &i915->drm; > enum pipe pipe; > struct intel_crtc *crtc; > + struct drm_modeset_acquire_ctx ctx; > int ret; > > intel_init_pm(i915); > @@ -11884,9 +11886,9 @@ int intel_modeset_init_nogem(struct drm_i915_private *i915) > intel_vga_disable(i915); > intel_setup_outputs(i915); > > - drm_modeset_lock_all(dev); > + DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret); > intel_modeset_setup_hw_state(dev, dev->mode_config.acquire_ctx); > - drm_modeset_unlock_all(dev); > + DRM_MODESET_LOCK_ALL_END(dev, ctx, ret); That looks wrong. You're using a private ctx here, but still passing dev->mode_config.acquire_ctx to the lower level stuff. Also DRM_MODESET_LOCK_ALL_{BEGIN,END}() do not seem to be equivalent to drm_modeset_{lock,unlock}_all() when it comes to mode_config.mutex. So would need a proper review whether we actually need that lock or not. -- Ville Syrj?l? Intel