Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp3986356pxy; Tue, 4 May 2021 14:53:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXHsFGl1NpSOvOqTxFvAheliQoydvjlDtbRGMxV3B8YcxkEe6XrfpUZQnIsn+Uogy3Ohe3 X-Received: by 2002:a17:906:1684:: with SMTP id s4mr23344423ejd.506.1620165210340; Tue, 04 May 2021 14:53:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620165210; cv=none; d=google.com; s=arc-20160816; b=KWE8G3eie7SvhkpZtHHb2jxyzvFv24eU34iXEhxxdmwHFklEYGvgKwsmGlzbrhie8w 0I+mg1UNPZyM3aoj+A4brs4mIDLzoZoJNyu0ZkWbKYnMCZNV7OCULwOUBl65l4m2O/eZ X4QT78ZkSFxHMhgrw2JUx8Ws74KwS00LdmoD9UcoKbAhnC8dxerOmslzIgZyEIp/HxET 5in2LDT3kDnaloNFON6hWS8HKI4xroNrW04hZQ1Us0MImdM1SK6KAXal0et+F3M1kgOq eslIV+hG21Ji3KTpcAbmLmaO2aK29tj+WKHR/y2SH+c9o6N8T6rxD2bOMgMenqVp7CG0 Osvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=l0MpBQXXQXovBmumhU+vevXuEERixPQDIBphGMJ/1Eg=; b=psMlfe+jJi0XTBujS8O0sn4+6oamSq3my+I1LDbZLIFLm69wVULTfU8TvjjiHq9nFx wQTJKX6phBuRRQKpm0pPaTJQYtJOXZoiaI5gWI0klwuOwawXn8tAujq3cnuwSnZzPuNR N8iuK/MtAElggnlKEOkqC3p5T0nWulljNOlfUI8tkBHT665DSyuhcqI16A8zKJa6gPJo XoIQWtrvPgm73ulHFLS6KTED+duuysWzt2bidH2OoZePSHvbk6+gynFVwGh7B4eEgF4N Lqen5sto4lw6Zrs1QDlCzUFMzVW85yMvOLOKAU5vQrH8EwAcdcMVdjTUaICbGYS5Lhqh mXxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=eS9ZIMjK; 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 w22si1177641edc.204.2021.05.04.14.53.06; Tue, 04 May 2021 14:53:30 -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=eS9ZIMjK; 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 S232480AbhEDTW1 (ORCPT + 99 others); Tue, 4 May 2021 15:22:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232082AbhEDTW1 (ORCPT ); Tue, 4 May 2021 15:22:27 -0400 Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F957C061574 for ; Tue, 4 May 2021 12:21:32 -0700 (PDT) Received: by mail-oi1-x236.google.com with SMTP id u16so9840728oiu.7 for ; Tue, 04 May 2021 12:21:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=l0MpBQXXQXovBmumhU+vevXuEERixPQDIBphGMJ/1Eg=; b=eS9ZIMjKfbA79gkqM/if0o/ll0b0hJg4orJQPJNRFHk7eYNAbu8O/2wS892rhv/0i0 ydt7KLieBtrj44E712kqAVQIiJ/mTOsrTzGB8ohvG6HSoZfZEs1rUyhZHv+s8On1/n9Y WUNnW8cdZzFM5sYmOR5BF+BYrCvEoH2DXPjr6p1YQmIlqypJ7w7aNwz2yjaaU+JERf9Y 8RJuZS8q69DExe7dpglbq+PIoBtNixQR88bJM7+qdO7xaXIM8N+/LZ9Tq7mukJxUrDnC nnbXiXCDvG4OhqkvobGzMduzQ/1ZlAtXUi979RvD/2Bk93iQNjNT233LXmSIDPBUPPBF qx5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=l0MpBQXXQXovBmumhU+vevXuEERixPQDIBphGMJ/1Eg=; b=pccBAlTqSRhDlgiAlEMMEcJjWDEuZ/ye7Hi9LDNtgzNClPi9UJ4aJ5DHoDRqomsx1E bzo2/28iPub1Nslxk74msv4Hy63QolQKVtrn6OaEtL3VZoRzvizvKGbqeOmnFRIgyfZD tDHzpuPLY5Jdw5TgV/vo7hnC8nzHmuP8d2wJ/N9mlo6NVIXY97Fungv6jphmargBSQcy g6K0hY4iKnh/+dj+KUfmLI2sL0M5mKDAyzTdiihjXAyrsemfzA/CQjkUNCbgwvO/+Fel TUseW4Urcm/FLv1R1L4kABAyPDJsglYBSIHkFF3TXn0bQEDIXXf2+wn1CplAbiV2iBuE EJmw== X-Gm-Message-State: AOAM531Be1Cu0ZijzWfeT7Gjvat4FAucnhLzlBk7y8/Atk8kvsn7DWMy /YMTX6G669mhyLipQ6jhYyLaGHI5srcSGhF6RPI= X-Received: by 2002:a05:6808:68a:: with SMTP id k10mr18402833oig.120.1620156090910; Tue, 04 May 2021 12:21:30 -0700 (PDT) MIME-Version: 1.0 References: <20210427094449.14730-1-fmdefrancesco@gmail.com> In-Reply-To: <20210427094449.14730-1-fmdefrancesco@gmail.com> From: Alex Deucher Date: Tue, 4 May 2021 15:21:20 -0400 Message-ID: Subject: Re: [PATCH v4] drm/amd/amdgpu/amdgpu_drv.c: Replace drm_modeset_lock_all with drm_modeset_lock To: "Fabio M. De Francesco" Cc: outreachy-kernel@googlegroups.com, Maling list - DRI developers , shaoyunl , Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= , David Airlie , Daniel Vetter , Evan Quan , Hawking Zhang , Felix Kuehling , Luben Tuikov , Aurabindo Pillai , amd-gfx list , LKML , Matthew Wilcox Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 27, 2021 at 5:45 AM Fabio M. De Francesco wrote: > > drm_modeset_lock_all() is not needed here, so it is replaced with > drm_modeset_lock(). The crtc list around which we are looping never > changes, therefore the only lock we need is to protect access to > crtc->state. > > Suggested-by: Daniel Vetter > Suggested-by: Matthew Wilcox > Signed-off-by: Fabio M. De Francesco > Reviewed-by: Matthew Wilcox (Oracle) Applied. Thanks! Alex > --- > > Changes from v3: CC'ed more (previously missing) maintainers. > Changes from v2: Drop file name from the Subject. Cc'ed all maintainers. > Changes from v1: Removed unnecessary braces around single statement > block. > > drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > index 80130c1c0c68..39204dbc168b 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > @@ -1595,17 +1595,15 @@ static int amdgpu_pmops_runtime_idle(struct device *dev) > if (amdgpu_device_has_dc_support(adev)) { > struct drm_crtc *crtc; > > - drm_modeset_lock_all(drm_dev); > - > drm_for_each_crtc(crtc, drm_dev) { > - if (crtc->state->active) { > + drm_modeset_lock(&crtc->mutex, NULL); > + if (crtc->state->active) > ret = -EBUSY; > + drm_modeset_unlock(&crtc->mutex); > + if (ret < 0) > break; > - } > } > > - drm_modeset_unlock_all(drm_dev); > - > } else { > struct drm_connector *list_connector; > struct drm_connector_list_iter iter; > -- > 2.31.1 > > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx