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>] [day] [month] [year] [list]
Message-ID: <20190801095838.2dy4nmipct3qmohc@e110455-lin.cambridge.arm.com>
Date:   Thu, 1 Aug 2019 10:58:38 +0100
From:   Liviu Dudau <Liviu.Dudau@....com>
To:     "Lowry Li (Arm Technology China)" <Lowry.Li@....com>
Cc:     "james qian wang (Arm Technology China)" <james.qian.wang@....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>,
        "Julien Yin (Arm Technology China)" <Julien.Yin@....com>,
        "maxime.ripard@...tlin.com" <maxime.ripard@...tlin.com>,
        "eric@...olt.net" <eric@...olt.net>,
        "kieran.bingham+renesas@...asonboard.com" 
        <kieran.bingham+renesas@...asonboard.com>,
        "sean@...rly.run" <sean@...rly.run>,
        "laurent.pinchart@...asonboard.com" 
        <laurent.pinchart@...asonboard.com>,
        "Jonathan Chai (Arm Technology China)" <Jonathan.Chai@....com>,
        Ayan Halder <Ayan.Halder@....com>,
        "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-renesas-soc@...r.kernel.org" 
        <linux-renesas-soc@...r.kernel.org>, nd <nd@....com>
Subject: Re: [PATCH v1 2/2] drm: Clear the fence pointer when writeback job
 signaled

On Thu, Aug 01, 2019 at 06:31:13AM +0000, Lowry Li (Arm Technology China) wrote:
> Hi Liviu,
> 
> On Wed, Jul 31, 2019 at 01:15:25PM +0000, Liviu Dudau wrote:
> > Hi Lowry,
> > 
> > On Wed, Jul 31, 2019 at 11:04:45AM +0000, Lowry Li (Arm Technology China) wrote:
> > > During it signals the completion of a writeback job, after releasing
> > > the out_fence, we'd clear the pointer.
> > > 
> > > Check if fence left over in drm_writeback_cleanup_job(), release it.
> > > 
> > > Signed-off-by: Lowry Li (Arm Technology China) <lowry.li@....com>
> > > ---
> > >  drivers/gpu/drm/drm_writeback.c | 23 +++++++++++++++--------
> > >  1 file changed, 15 insertions(+), 8 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeback.c
> > > index ff138b6..43d9e3b 100644
> > > --- a/drivers/gpu/drm/drm_writeback.c
> > > +++ b/drivers/gpu/drm/drm_writeback.c
> > > @@ -324,6 +324,9 @@ void drm_writeback_cleanup_job(struct drm_writeback_job *job)
> > >  	if (job->fb)
> > >  		drm_framebuffer_put(job->fb);
> > >  
> > > +	if (job->out_fence)
> > > +		dma_fence_put(job->out_fence);
> > > +
> > >  	kfree(job);
> > >  }
> > 
> > This change looks good.
> > 
> > >  EXPORT_SYMBOL(drm_writeback_cleanup_job);
> > > @@ -366,25 +369,29 @@ static void cleanup_work(struct work_struct *work)
> > >  {
> > >  	unsigned long flags;
> > >  	struct drm_writeback_job *job;
> > > +	struct dma_fence *out_fence;
> > >  
> > >  	spin_lock_irqsave(&wb_connector->job_lock, flags);
> > >  	job = list_first_entry_or_null(&wb_connector->job_queue,
> > >  				       struct drm_writeback_job,
> > >  				       list_entry);
> > > -	if (job) {
> > > +	if (job)
> > >  		list_del(&job->list_entry);
> > > -		if (job->out_fence) {
> > > -			if (status)
> > > -				dma_fence_set_error(job->out_fence, status);
> > > -			dma_fence_signal(job->out_fence);
> > > -			dma_fence_put(job->out_fence);
> > 
> > *Here*
> > 
> > > -		}
> > > -	}
> > > +
> > >  	spin_unlock_irqrestore(&wb_connector->job_lock, flags);
> > >  
> > >  	if (WARN_ON(!job))
> > >  		return;
> > >  
> > > +	out_fence = job->out_fence;
> > > +	if (out_fence) {
> > > +		if (status)
> > > +			dma_fence_set_error(out_fence, status);
> > > +		dma_fence_signal(out_fence);
> > > +		dma_fence_put(out_fence);
> > > +		job->out_fence = NULL;
> > > +	}
> > > +
> > 
> > I don't get the point of this change. Why not just add job->out_fence = NULL
> > where *Here* is?
> >
> > Best regards,
> > Liviu 
> Besides setting NULL, also did a refine by moving the fence operation
> out of the lock block.

OK, now it makes sense. May I suggest you add that to the commit message?

Otherwise, Acked-by: Liviu Dudau <liviu.dudau@....com>

Best regards,
Liviu

> 
> Best regards,
> Lowry 
> > >  	INIT_WORK(&job->cleanup_work, cleanup_work);
> > >  	queue_work(system_long_wq, &job->cleanup_work);
> > >  }
> > > -- 
> > > 1.9.1
> > > 
> > 
> > -- 
> > ====================
> > | I would like to |
> > | fix the world,  |
> > | but they're not |
> > | giving me the   |
> >  \ source code!  /
> >   ---------------
> >     ¯\_(ツ)_/¯
> 
> -- 
> Regards,
> Lowry

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ