Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3214741imm; Tue, 17 Jul 2018 00:34:59 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfjRrSLzRP55jvMNxvwyIfpx9D9rpTEZhOsLPfV6n3W3C8U1IuE9bu0VbNu2eu5S0eSYHBz X-Received: by 2002:a17:902:a989:: with SMTP id bh9-v6mr520432plb.245.1531812899877; Tue, 17 Jul 2018 00:34:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531812899; cv=none; d=google.com; s=arc-20160816; b=c5P8KfUV/C9rfVlDKGx5LpNI5NR3gf7O5T/6q2DT3J/z0IAC7ezCd8/3w0t4HmpVpl Y2I0JKBcUjvhAgnG1V+HUTM4LWFR5LmWjrkZlDTYuzP+ZULpY65Cy1rYjamhH0/GStFo fORggUn+8vesLRoLSExCPwCdZdrck9E/v0/YMg3DG1iJv8oftQzQxmUIQX7jIm9FjPcf Pv/qy9Hv6H1BozLHiH5ZzXszkkFtGb6ornvv1tz8vy1TXPQJeXhHP951gqsm05e5Te2N 5vXPPuRC2a+f8UYUPQbxDICKUfJKSTFv7EtYaJchahzEra6V/Qox+mMEaX5rK/THdwj3 G2Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=IfhWQAxTdsB7udAqIc0RClv2XWn7kHkw+dplCXxkMDY=; b=aLhjYxi7YxkKOoUZGlf9Z8cjC36Xx7+udFid8a2rlCBFA70cs7jSaS4YA9FhhjCoBt EFl7tLWPyn+kxsSdszCFQAM79TWKxRALrsoec/exkmwAv67DueEfsL1gBFgmELGgG/+k kA7zrmmNhVjAR7mGBsVP1SKHyyKhKRfC+3jfzfD8Dpglq1TIVHhUyduEWHrL+3eUrt2v VZGD771vCnrx3WUsjTVrSD9A+zUlhdMiMozXxGhRBGKFCGYDs2LMrt+Myx2eSuxoDf2H QSBvbQuFuD8O0tZiLDSTdai+W1nZr2SRAWEzk8gTEasCvLyjFxC/uHbjyWX9ZJGKEnHs Lmcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s3-v6si266343plb.394.2018.07.17.00.34.45; Tue, 17 Jul 2018 00:34:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729710AbeGQIFI (ORCPT + 99 others); Tue, 17 Jul 2018 04:05:08 -0400 Received: from bmailout2.hostsharing.net ([83.223.90.240]:57783 "EHLO bmailout2.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728031AbeGQIFH (ORCPT ); Tue, 17 Jul 2018 04:05:07 -0400 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by bmailout2.hostsharing.net (Postfix) with ESMTPS id BA97F2801088B; Tue, 17 Jul 2018 09:33:52 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 655726F3B3; Tue, 17 Jul 2018 09:33:52 +0200 (CEST) Date: Tue, 17 Jul 2018 09:33:52 +0200 From: Lukas Wunner To: Lyude Paul Cc: nouveau@lists.freedesktop.org, Archit Taneja , David Airlie , dri-devel@lists.freedesktop.org, Maarten Lankhorst , linux-kernel@vger.kernel.org, Ben Skeggs , Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Subject: Re: [Nouveau] [PATCH v2 2/3] drm/nouveau: Fix runtime PM leak in nv50_disp_atomic_commit() Message-ID: <20180717073352.GA17459@wunner.de> References: <20180712170256.13018-1-lyude@redhat.com> <20180712170256.13018-3-lyude@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180712170256.13018-3-lyude@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 12, 2018 at 01:02:53PM -0400, Lyude Paul wrote: > --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c > +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c > @@ -1878,7 +1878,7 @@ nv50_disp_atomic_commit(struct drm_device *dev, > nv50_disp_atomic_commit_tail(state); > > drm_for_each_crtc(crtc, dev) { > - if (crtc->state->enable) { > + if (crtc->state->active) { > if (!drm->have_disp_power_ref) { > drm->have_disp_power_ref = true; > return 0; Somewhat tangential comment on this older patch, since you continue to dig around in the runtime PM area: Whenever a crtc is activated or deactivated in nouveau, we iterate over all crtcs and acquire a runtime PM if a crtc is active and previously there was no active one, or we drop a ref if none is active and previously there was an active one. For a while now I've been thinking that it would be more straightforward to acquire a ref whenever a crtc is activated and drop one when a crtc is deactivated, i.e. hold one ref for every active crtc. That way the have_disp_power_ref variable as well as the iteration logic could be removed, leading to a simplification. Just a suggestion anyway. Thanks, Lukas