Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3905893imu; Mon, 28 Jan 2019 13:04:21 -0800 (PST) X-Google-Smtp-Source: ALg8bN6RKuvRuC//eGb40u46bLrmjVB+OQw58QpYZd62Li9WDJJtm7Ch6RREwLlQi5C+hUvdCRD4 X-Received: by 2002:a17:902:bb86:: with SMTP id m6mr23644188pls.315.1548709461824; Mon, 28 Jan 2019 13:04:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548709461; cv=none; d=google.com; s=arc-20160816; b=yomaOk8NhbFjXuxBeAmuul1mGuEERHlybnp8o6T+VNuWDoSdLjduNtn1WyqR2yZrQO tFst+wmharwG6pDzLbRwV+DfWjGK5JB9FR8+xmilU/2pxy6H2x1me7DrOjdRuqdTIR3T Skbndd6Z6IEEXlB6pwPnnTXTH7sFrUQEAnhAzhW9wAC3nE2OlF78pCaIx0ftdKuKGJIT eRMWmqSAhy6l4Zu9Qct125kvG5gnXXRA6pOpMECAnaG0Zt1iVeqfNbfRoYr4POG7Yxwa zwZ3f8tj0bf8RA+kMbtkpYQzT07NAqBcMXdxbg6xJQCG2LRiUkUdNxM9/kHD1f+aP6Lp UYgg== 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:dkim-signature; bh=AeYGKegqDIzCvSD4A84Dthd2QTd0+Cki5Q4rb/PhdBk=; b=HzOo7m1NAXkbc0l2qsy5Vm/wWcLkcI4qJgEwB3S6kB9q5KEBSfbP+bxngnlkc1ri1c wqTnEgVAxsHolWtO2pmGeNE07bVwOOtC7hX4bSC22Cj47UCToEWPxwyd75DnebS6g6Zd uSwKU9FBXy5IqK3Szf2sSk3U9q/vFaBFx0/7P2fLmH/bCOLsDhOfBQp6e3wLJEgS9qED ZNLoFzBO6BTYfJf18KKdpHE3ANZfDEdXBKv/GuA9te5x9tiH5pimktFnRVUZI0Gom5pZ BrDhhhp+oWIp5reI3L2UEfaMPMBTLwV/LAHd9bPCvEUyDNiVKe7/LPQR+0KRgfg4m6ak RsYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@poorly.run header.s=google header.b=AyZXgeeD; 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 bd12si5564113plb.193.2019.01.28.13.04.06; Mon, 28 Jan 2019 13:04:21 -0800 (PST) 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; dkim=pass header.i=@poorly.run header.s=google header.b=AyZXgeeD; 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 S1727156AbfA1VDo (ORCPT + 99 others); Mon, 28 Jan 2019 16:03:44 -0500 Received: from mail-yb1-f196.google.com ([209.85.219.196]:37463 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726805AbfA1VDo (ORCPT ); Mon, 28 Jan 2019 16:03:44 -0500 Received: by mail-yb1-f196.google.com with SMTP id 2so7291007ybw.4 for ; Mon, 28 Jan 2019 13:03:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=AeYGKegqDIzCvSD4A84Dthd2QTd0+Cki5Q4rb/PhdBk=; b=AyZXgeeDQ/No2hszEFvSgo3HAe8tppQLmxxpIpU/CQk0XeqRuUoToVlikGTikHRY0b BS670fAn8H7nHOZW493uNa0h7RlOcDDA3YndaUZRyl8vPT+O2JdGIbx7Wt01i6J7uz9Q LED6+Gqiop0+ST1Fxx8lrJSStbVLkheyoOs7yvLO+Dalk0BwAK5MpQmvxOb3JUvnUTVS X0O8mGskY7zp9/jt5m1lGEr+YYhyjtEoJLKIlTjRCVcZLUo6uDsaM6a83fbhiBADdnLj ANi4Zd/Q5cn8FDiO9AAj4D4/spZoXXtgz7b8lAFoEpTQXhkQZUCjL8eOHly5wRGzjZmi oP/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=AeYGKegqDIzCvSD4A84Dthd2QTd0+Cki5Q4rb/PhdBk=; b=uBEJxCEYsQJX9zdaaV2JjynkXOKBbMVGP6NDB7KRjKQd6e6jcNXzAaB/UMcmeC6XJF Vk+bDikgNFq4Yphu3fCUDADJW+FdkuNU1cDPiB/CiSGXk8pEIzhMCznglJpuPX8H+744 ryROBNPIbOin6zmoVtbt0BM4WfESR1B4UQT9b/wnbtLolFOmmgJZcpHnA2yClLzcG0DR L7wISfA1rndghiWlDP3Xyc91Y0y2/IOMra4VxTcDL+OQka5P/JKSCa38Uy0qFET1xoBP WRZSLu//ZyUHlorDrMd5vqv1vmuGPf0vPlWzCZNfK/FgZ0pzL40TBmtSHi7mapCJj79O mnMQ== X-Gm-Message-State: AJcUukeCD4ocQqFBat+Jif53qkzRCieci9/WxMKQmC6hTCWbD03tLZNa 2Kg7DHT7RuTPPI0kighLCR76Iw== X-Received: by 2002:a25:ba0a:: with SMTP id t10mr16891333ybg.442.1548709422973; Mon, 28 Jan 2019 13:03:42 -0800 (PST) Received: from localhost ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id s35sm36221664ywa.19.2019.01.28.13.03.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 13:03:42 -0800 (PST) Date: Mon, 28 Jan 2019 16:03:41 -0500 From: Sean Paul To: Sasha Levin Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Sean Paul , dri-devel@lists.freedesktop.org Subject: Re: [PATCH AUTOSEL 4.19 083/258] drm: Move drm_mode_setcrtc() local re-init to failure path Message-ID: <20190128210341.GT114153@art_vandelay> References: <20190128155924.51521-1-sashal@kernel.org> <20190128155924.51521-83-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190128155924.51521-83-sashal@kernel.org> 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 Mon, Jan 28, 2019 at 10:56:29AM -0500, Sasha Levin wrote: > From: Sean Paul > > [ Upstream commit c232e9f41b136c141df9938024e521191a7b910d ] > > Instead of always re-initializing the variables we need to clean up on > out, move the re-initialization into the branch that goes back to retry > label. > > This is a lateral move right now, but will allow us to pull out the > modeset locking into common code. I kept this change separate to make > things easier to review. > > Changes in v2: > - None > > Reviewed-by: Daniel Vetter > Signed-off-by: Sean Paul > Link: https://patchwork.freedesktop.org/patch/msgid/20181129150423.239081-2-sean@poorly.run > Signed-off-by: Sasha Levin This probably doesn't need to get pulled back to stable. It was a pre-cursor for some new helper macros that also don't need to be pulled back. (Same comment for the 4.20 version) Sean > --- > drivers/gpu/drm/drm_crtc.c | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c > index 9cbe8f5c9aca..ed9d7fc4cb2c 100644 > --- a/drivers/gpu/drm/drm_crtc.c > +++ b/drivers/gpu/drm/drm_crtc.c > @@ -567,9 +567,9 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, > struct drm_mode_crtc *crtc_req = data; > struct drm_crtc *crtc; > struct drm_plane *plane; > - struct drm_connector **connector_set, *connector; > - struct drm_framebuffer *fb; > - struct drm_display_mode *mode; > + struct drm_connector **connector_set = NULL, *connector; > + struct drm_framebuffer *fb = NULL; > + struct drm_display_mode *mode = NULL; > struct drm_mode_set set; > uint32_t __user *set_connectors_ptr; > struct drm_modeset_acquire_ctx ctx; > @@ -598,10 +598,6 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, > mutex_lock(&crtc->dev->mode_config.mutex); > drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE); > retry: > - connector_set = NULL; > - fb = NULL; > - mode = NULL; > - > ret = drm_modeset_lock_all_ctx(crtc->dev, &ctx); > if (ret) > goto out; > @@ -763,6 +759,12 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, > } > kfree(connector_set); > drm_mode_destroy(dev, mode); > + > + /* In case we need to retry... */ > + connector_set = NULL; > + fb = NULL; > + mode = NULL; > + > if (ret == -EDEADLK) { > ret = drm_modeset_backoff(&ctx); > if (!ret) > -- > 2.19.1 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Sean Paul, Software Engineer, Google / Chromium OS