Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp812546ybx; Fri, 1 Nov 2019 11:37:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9DYKxT69JF3Wn1O8wrVRJt8l+D9ce9IhIFM7Cb1Oceax/eTxyvih5vr2WrhwIFzUBwSuW X-Received: by 2002:a50:ab50:: with SMTP id t16mr14405788edc.171.1572633447224; Fri, 01 Nov 2019 11:37:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572633447; cv=none; d=google.com; s=arc-20160816; b=L84s1MrcDgZMRbousOBcGUq9Ed/3kM5ayY5fQPerIF9LygoTtbW1ppD8uNDLA/a4I8 u6ojq8ndrTneU/fGfutBbKAP4aLvyMiVmrySEAbhKli/S10ZWzya0zNp5bmjyz0TYy5T 3JtmaFjOPQzfSt4rbhph2KOKBKeTaeKJe63Zayd1zSY6JF0rvs142Gg7R4XrIYQBCD02 zsfX8m7QqsqgyTleFmIn0YTvLy0F346G3+OCtnPf2uPMB+XKthFB0XyvHXEZoMTpJtRE CjZcQhnwrDTp8Yxvd/qgpX/pv5Wo221oypxXYFP9wojI7hYplXkrOXVuVcCi5158jgrS GKsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=6hslD8Ct9W+Mmyli8vGt9h2RGXHL55UchrJa+gcB8qE=; b=xR+66PA0Sp1NdUWaPSX143ko2IC7FFp4bi9xEvFau5XPdS4kLNKELnyUhuYYC8v6K7 2lV8rZVKt1ds7a4qDPhrxda/VdsIMZPvHKqfgSaMuAXkhYyhYv8VnjtxipmlgkFDIU9G LB+OAl2aDiNSw1MwDwKidAIxkSIKxeVGTQrIWApV6FAIY3Vq1cSz5oRbIKpMEKtcUs4Q qswKDxlXIt2A87J5HosBOJ36Y1WTop3AI3QYRvrrBmcFOpuWrhOxSF+Vd+RDMzlIn2lX fkSbOxywkOyAq5MAe0AUx88vYmHoF0Y6+9HDZYXz7KjeA3KJhbGI6/iggWZGQLIbg435 jMGw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w30si1022265edd.137.2019.11.01.11.37.03; Fri, 01 Nov 2019 11:37:27 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727279AbfKASdR (ORCPT + 99 others); Fri, 1 Nov 2019 14:33:17 -0400 Received: from mga06.intel.com ([134.134.136.31]:56627 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726671AbfKASdR (ORCPT ); Fri, 1 Nov 2019 14:33:17 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Nov 2019 11:33:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,256,1569308400"; d="scan'208";a="352026410" Received: from cepartan-mobl3.ger.corp.intel.com (HELO [10.249.40.248]) ([10.249.40.248]) by orsmga004.jf.intel.com with ESMTP; 01 Nov 2019 11:33:12 -0700 Subject: Re: [PATCH 2/2] drm/atomic: clear new_state pointers at hw_done To: Rob Clark , dri-devel@lists.freedesktop.org Cc: Sean Paul , Rob Clark , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , open list References: <20191101180713.5470-1-robdclark@gmail.com> <20191101180713.5470-2-robdclark@gmail.com> From: Maarten Lankhorst Message-ID: Date: Fri, 1 Nov 2019 19:33:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191101180713.5470-2-robdclark@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Op 01-11-2019 om 19:07 schreef Rob Clark: > From: Rob Clark > > The new state should not be accessed after this point. Clear the > pointers to make that explicit. > > This makes the error corrected in the previous patch more obvious. > > Signed-off-by: Rob Clark Would be nice if you could cc intel-gfx@lists.freedesktop.org next time, so I know our CI infrastructure is happy; It wouldn't surprise me if it catches 1 or 2 abuses in i915. Otherwise Reviewed-by: Maarten Lankhorst Perhaps you could mail this to version to intel-gfx-trybot@lists.freedesktop.org using git-send-email so we at least get i915 results? > --- > drivers/gpu/drm/drm_atomic_helper.c | 29 +++++++++++++++++++++++++++++ > 1 file changed, 29 insertions(+) > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c > index 732bd0ce9241..176831df8163 100644 > --- a/drivers/gpu/drm/drm_atomic_helper.c > +++ b/drivers/gpu/drm/drm_atomic_helper.c > @@ -2234,13 +2234,42 @@ EXPORT_SYMBOL(drm_atomic_helper_fake_vblank); > */ > void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state) > { > + struct drm_connector *connector; > + struct drm_connector_state *old_conn_state, *new_conn_state; > struct drm_crtc *crtc; > struct drm_crtc_state *old_crtc_state, *new_crtc_state; > + struct drm_plane *plane; > + struct drm_plane_state *old_plane_state, *new_plane_state; > struct drm_crtc_commit *commit; > + struct drm_private_obj *obj; > + struct drm_private_state *old_obj_state, *new_obj_state; > int i; > > + /* > + * After this point, drivers should not access the permanent modeset > + * state, so we also clear the new_state pointers to make this > + * restriction explicit. > + * > + * For the CRTC state, we do this in the same loop where we signal > + * hw_done, since we still need to new_crtc_state to fish out the > + * commit. > + */ > + > + for_each_oldnew_connector_in_state(old_state, connector, old_conn_state, new_conn_state, i) { > + old_state->connectors[i].new_state = NULL; > + } > + > + for_each_oldnew_plane_in_state(old_state, plane, old_plane_state, new_plane_state, i) { > + old_state->planes[i].new_state = NULL; > + } > + > + for_each_oldnew_private_obj_in_state(old_state, obj, old_obj_state, new_obj_state, i) { > + old_state->private_objs[i].new_state = NULL; > + } > + > for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { > old_state->crtcs[i].new_self_refresh_active = new_crtc_state->self_refresh_active; > + old_state->crtcs[i].new_state = NULL; > > commit = new_crtc_state->commit; > if (!commit)