lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190923072419.GA17006@jamwan02-TSP300>
Date:   Mon, 23 Sep 2019 07:24:26 +0000
From:   "james qian wang (Arm Technology China)" <james.qian.wang@....com>
To:     "Lowry Li (Arm Technology China)" <Lowry.Li@....com>
CC:     Liviu Dudau <Liviu.Dudau@....com>,
        "maarten.lankhorst@...ux.intel.com" 
        <maarten.lankhorst@...ux.intel.com>,
        "seanpaul@...omium.org" <seanpaul@...omium.org>,
        "airlied@...ux.ie" <airlied@...ux.ie>,
        "daniel@...ll.ch" <daniel@...ll.ch>,
        Brian Starkey <Brian.Starkey@....com>,
        "linux-renesas-soc@...r.kernel.org" 
        <linux-renesas-soc@...r.kernel.org>, nd <nd@....com>,
        "maxime.ripard@...tlin.com" <maxime.ripard@...tlin.com>,
        "Jonathan Chai (Arm Technology China)" <Jonathan.Chai@....com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
        "Julien Yin (Arm Technology China)" <Julien.Yin@....com>,
        "kieran.bingham+renesas@...asonboard.com" 
        <kieran.bingham+renesas@...asonboard.com>,
        "laurent.pinchart@...asonboard.com" 
        <laurent.pinchart@...asonboard.com>,
        Ayan Halder <Ayan.Halder@....com>,
        "sean@...rly.run" <sean@...rly.run>
Subject: Re: [v1,1/2] drm: Free the writeback_job when it with an empty fb

On Wed, Jul 31, 2019 at 11:04:38AM +0000, Lowry Li (Arm Technology China) wrote:
> From: "Lowry Li (Arm Technology China)" <Lowry.Li@....com>
> 
> Adds the check if the writeback_job with an empty fb, then it should
> be freed in atomic_check phase.
> 
> With this change, the driver users will not check empty fb case any more.
> So refined accordingly.
> 
> Signed-off-by: Lowry Li (Arm Technology China) <lowry.li@....com>
> Reviewed-by: Liviu Dudau <liviu.dudau@....com>

Looks good to me.

Reviewed-by: James Qian Wang (Arm Technology China) <james.qian.wang@....com>

And will push it to drm-misc-fixes

James

> ---
>  drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c |  3 +--
>  drivers/gpu/drm/arm/malidp_mw.c                          |  4 ++--
>  drivers/gpu/drm/drm_atomic.c                             | 13 +++++++++----
>  drivers/gpu/drm/rcar-du/rcar_du_writeback.c              |  4 ++--
>  drivers/gpu/drm/vc4/vc4_txp.c                            |  5 ++---
>  5 files changed, 16 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c
> index 617e1f7..d6103dd 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c
> @@ -43,9 +43,8 @@
>  	struct komeda_data_flow_cfg dflow;
>  	int err;
>  
> -	if (!writeback_job || !writeback_job->fb) {
> +	if (!writeback_job)
>  		return 0;
> -	}
>  
>  	if (!crtc_st->active) {
>  		DRM_DEBUG_ATOMIC("Cannot write the composition result out on a inactive CRTC.\n");
> diff --git a/drivers/gpu/drm/arm/malidp_mw.c b/drivers/gpu/drm/arm/malidp_mw.c
> index 2e81252..a59227b 100644
> --- a/drivers/gpu/drm/arm/malidp_mw.c
> +++ b/drivers/gpu/drm/arm/malidp_mw.c
> @@ -130,7 +130,7 @@ static void malidp_mw_connector_destroy(struct drm_connector *connector)
>  	struct drm_framebuffer *fb;
>  	int i, n_planes;
>  
> -	if (!conn_state->writeback_job || !conn_state->writeback_job->fb)
> +	if (!conn_state->writeback_job)
>  		return 0;
>  
>  	fb = conn_state->writeback_job->fb;
> @@ -247,7 +247,7 @@ void malidp_mw_atomic_commit(struct drm_device *drm,
>  
>  	mw_state = to_mw_state(conn_state);
>  
> -	if (conn_state->writeback_job && conn_state->writeback_job->fb) {
> +	if (conn_state->writeback_job) {
>  		struct drm_framebuffer *fb = conn_state->writeback_job->fb;
>  
>  		DRM_DEV_DEBUG_DRIVER(drm->dev,
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 419381a..14aeaf7 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -430,10 +430,15 @@ static int drm_atomic_connector_check(struct drm_connector *connector,
>  		return -EINVAL;
>  	}
>  
> -	if (writeback_job->out_fence && !writeback_job->fb) {
> -		DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] requesting out-fence without framebuffer\n",
> -				 connector->base.id, connector->name);
> -		return -EINVAL;
> +	if (!writeback_job->fb) {
> +		if (writeback_job->out_fence) {
> +			DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] requesting out-fence without framebuffer\n",
> +					 connector->base.id, connector->name);
> +			return -EINVAL;
> +		}
> +
> +		drm_writeback_cleanup_job(writeback_job);
> +		state->writeback_job = NULL;
>  	}
>  
>  	return 0;
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_writeback.c b/drivers/gpu/drm/rcar-du/rcar_du_writeback.c
> index ae07290..04efa78d 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_writeback.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_writeback.c
> @@ -147,7 +147,7 @@ static int rcar_du_wb_enc_atomic_check(struct drm_encoder *encoder,
>  	struct drm_device *dev = encoder->dev;
>  	struct drm_framebuffer *fb;
>  
> -	if (!conn_state->writeback_job || !conn_state->writeback_job->fb)
> +	if (!conn_state->writeback_job)
>  		return 0;
>  
>  	fb = conn_state->writeback_job->fb;
> @@ -221,7 +221,7 @@ void rcar_du_writeback_setup(struct rcar_du_crtc *rcrtc,
>  	unsigned int i;
>  
>  	state = rcrtc->writeback.base.state;
> -	if (!state || !state->writeback_job || !state->writeback_job->fb)
> +	if (!state || !state->writeback_job)
>  		return;
>  
>  	fb = state->writeback_job->fb;
> diff --git a/drivers/gpu/drm/vc4/vc4_txp.c b/drivers/gpu/drm/vc4/vc4_txp.c
> index 96f91c1..e92fa12 100644
> --- a/drivers/gpu/drm/vc4/vc4_txp.c
> +++ b/drivers/gpu/drm/vc4/vc4_txp.c
> @@ -229,7 +229,7 @@ static int vc4_txp_connector_atomic_check(struct drm_connector *conn,
>  	int i;
>  
>  	conn_state = drm_atomic_get_new_connector_state(state, conn);
> -	if (!conn_state->writeback_job || !conn_state->writeback_job->fb)
> +	if (!conn_state->writeback_job)
>  		return 0;
>  
>  	crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
> @@ -269,8 +269,7 @@ static void vc4_txp_connector_atomic_commit(struct drm_connector *conn,
>  	u32 ctrl;
>  	int i;
>  
> -	if (WARN_ON(!conn_state->writeback_job ||
> -		    !conn_state->writeback_job->fb))
> +	if (WARN_ON(!conn_state->writeback_job))
>  		return;
>  
>  	mode = &conn_state->crtc->state->adjusted_mode;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ