Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp861636ybx; Fri, 1 Nov 2019 12:26:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQE8aIAjoR95inkviENyUNe79idi1aBH4aoOcuxz8Ox4D/MJT4x659jEB/1ArmDTLwK/2k X-Received: by 2002:a17:906:770c:: with SMTP id q12mr11409774ejm.75.1572636388119; Fri, 01 Nov 2019 12:26:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572636388; cv=none; d=google.com; s=arc-20160816; b=gh+3N+ih6I1zFSZUvXM/l+R0u6XNgYH7+mDZsjuiLfIMnnKaJZBEdT2ZaQsM+EMBZv InVRAY6kworMrZaLiF0oD91clG++OR2JCWiTYl4tY+7wPygMY4Dc53ww6w91lbd+jMso JAUCmC1GRW0a8n2F2UKxqI0stECBNp51PoqZC83O6QtMzFFvy748oahRfMELzCqStsY3 MExOpSqNzowYXrKTTFA4JPkfylmgpuepIcqcnQib/Lq0djADh9wU4PMB8lqZxHD+O4za 8k6k0W2Xuk2U7MG1E9xwzTgdXKomttsg/jYKes40C/P5BzQj2xfufxrc0U5OqyKacQlH Tt8w== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=yT/4JyNuTUfg7Ov7AuLMByVsqMq/D9vjEGZNs5y53mo=; b=M0zyl4rEOyiN7gjI0n5oOMyDDA7QbZuyvdCUDtYGs5byHuDJhfhFT74jXPDDz7weax jpBtNjdz2DT3qXwf/f/NPgDaEtuiHbzCbG/FbbdOpsvmNaq7egKbwLyIkvM4wmfNCt2P kiy7uGWtZ+HMf5wHuBAME0tAEUNdMYujfS8pdb36Y4aF6sq1LvAgY/uYXgPgOs+fPBa4 NJhgbwiYW2G/NA61cDzfK6mO1Fc2LZlDCEcyEuzpne0LaiGNXgEQCC3KZDbWzBd2Z7Ki dj1jdBjfgEvYw+9LynL+SoYb0RzdD4D9Zm0ENYw4rQlEs76RZSUBTijCbX/RmVa6jn6n dAtQ== 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 x5si6008767ejc.428.2019.11.01.12.26.04; Fri, 01 Nov 2019 12:26:28 -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 S1727473AbfKATZE (ORCPT + 99 others); Fri, 1 Nov 2019 15:25:04 -0400 Received: from mga06.intel.com ([134.134.136.31]:60140 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727325AbfKATZD (ORCPT ); Fri, 1 Nov 2019 15:25:03 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Nov 2019 12:25:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,256,1569308400"; d="scan'208";a="284278334" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.174]) by orsmga001.jf.intel.com with SMTP; 01 Nov 2019 12:24:59 -0700 Received: by stinkbox (sSMTP sendmail emulation); Fri, 01 Nov 2019 21:24:58 +0200 Date: Fri, 1 Nov 2019 21:24:58 +0200 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Rob Clark Cc: dri-devel@lists.freedesktop.org, Rob Clark , David Airlie , open list , Sean Paul , Sean Paul Subject: Re: [PATCH 2/2] drm/atomic: clear new_state pointers at hw_done Message-ID: <20191101192458.GI1208@intel.com> References: <20191101180713.5470-1-robdclark@gmail.com> <20191101180713.5470-2-robdclark@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20191101180713.5470-2-robdclark@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 01, 2019 at 11:07:13AM -0700, Rob Clark wrote: > 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 > --- > 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; That's going to be a real PITA when doing programming after the fact from a vblank worker. It's already a pain that the new_crtc_state->state is getting NULLed somewhere. > > commit = new_crtc_state->commit; > if (!commit) > -- > 2.21.0 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Ville Syrj?l? Intel