Re: [PATCH v2 2/2] dma-buf/sw_sync: force signal all unsignaled fences on dying timeline

2017-09-08 Thread Chris Wilson
Quoting Gustavo Padovan (2017-09-08 14:03:00)
> Hi Chris,
> 
> 2017-09-07 Chris Wilson :
> 
> > Quoting Gustavo Padovan (2017-09-07 20:02:46)
> > > From: Dominik Behr 
> > > 
> > > To avoid hanging userspace components that might have been waiting on the
> > > active fences of the destroyed timeline we need to signal with error all
> > > remaining fences on such timeline.
> > > 
> > > This restore the default behaviour of the Android sw_sync framework, which
> > > Android still relies on. It was broken on the dma fence conversion a few
> > > years ago and never fixed.
> > > 
> > > v2: Do not bother with cleanup do the list (Chris Wilson)
> > > 
> > > Signed-off-by: Dominik Behr 
> > > Signed-off-by: Gustavo Padovan 
> > Reviewed-by: Chris Wilson 
> > 
> > > ---
> > >  drivers/dma-buf/sw_sync.c | 10 ++
> > >  1 file changed, 10 insertions(+)
> > > 
> > > diff --git a/drivers/dma-buf/sw_sync.c b/drivers/dma-buf/sw_sync.c
> > > index 38cc7389a6c1..f183eef074fd 100644
> > > --- a/drivers/dma-buf/sw_sync.c
> > > +++ b/drivers/dma-buf/sw_sync.c
> > > @@ -321,9 +321,19 @@ static int sw_sync_debugfs_open(struct inode *inode, 
> > > struct file *file)
> > >  static int sw_sync_debugfs_release(struct inode *inode, struct file 
> > > *file)
> > >  {
> > > struct sync_timeline *obj = file->private_data;
> > > +   struct sync_pt *pt, *next;
> > >  
> > > smp_wmb();
> > >  
> > > +   spin_lock_irq(>lock);
> > 
> > Given the spinlock, that uncommented barrier (what is it paired with?)
> > above is redundant.
> 
> Okay, I'll remove the barrier and push that patch, I assume your r-b
> will comtemplate that as well?

No worries, either as one patch or two, slap my r-b on it.
-Chris
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 2/2] dma-buf/sw_sync: force signal all unsignaled fences on dying timeline

2017-09-08 Thread Gustavo Padovan
Hi Chris,

2017-09-07 Chris Wilson :

> Quoting Gustavo Padovan (2017-09-07 20:02:46)
> > From: Dominik Behr 
> > 
> > To avoid hanging userspace components that might have been waiting on the
> > active fences of the destroyed timeline we need to signal with error all
> > remaining fences on such timeline.
> > 
> > This restore the default behaviour of the Android sw_sync framework, which
> > Android still relies on. It was broken on the dma fence conversion a few
> > years ago and never fixed.
> > 
> > v2: Do not bother with cleanup do the list (Chris Wilson)
> > 
> > Signed-off-by: Dominik Behr 
> > Signed-off-by: Gustavo Padovan 
> Reviewed-by: Chris Wilson 
> 
> > ---
> >  drivers/dma-buf/sw_sync.c | 10 ++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/drivers/dma-buf/sw_sync.c b/drivers/dma-buf/sw_sync.c
> > index 38cc7389a6c1..f183eef074fd 100644
> > --- a/drivers/dma-buf/sw_sync.c
> > +++ b/drivers/dma-buf/sw_sync.c
> > @@ -321,9 +321,19 @@ static int sw_sync_debugfs_open(struct inode *inode, 
> > struct file *file)
> >  static int sw_sync_debugfs_release(struct inode *inode, struct file *file)
> >  {
> > struct sync_timeline *obj = file->private_data;
> > +   struct sync_pt *pt, *next;
> >  
> > smp_wmb();
> >  
> > +   spin_lock_irq(>lock);
> 
> Given the spinlock, that uncommented barrier (what is it paired with?)
> above is redundant.

Okay, I'll remove the barrier and push that patch, I assume your r-b
will comtemplate that as well?

Gustavo
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 2/2] dma-buf/sw_sync: force signal all unsignaled fences on dying timeline

2017-09-07 Thread Chris Wilson
Quoting Gustavo Padovan (2017-09-07 20:02:46)
> From: Dominik Behr 
> 
> To avoid hanging userspace components that might have been waiting on the
> active fences of the destroyed timeline we need to signal with error all
> remaining fences on such timeline.
> 
> This restore the default behaviour of the Android sw_sync framework, which
> Android still relies on. It was broken on the dma fence conversion a few
> years ago and never fixed.
> 
> v2: Do not bother with cleanup do the list (Chris Wilson)
> 
> Signed-off-by: Dominik Behr 
> Signed-off-by: Gustavo Padovan 
Reviewed-by: Chris Wilson 

> ---
>  drivers/dma-buf/sw_sync.c | 10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/dma-buf/sw_sync.c b/drivers/dma-buf/sw_sync.c
> index 38cc7389a6c1..f183eef074fd 100644
> --- a/drivers/dma-buf/sw_sync.c
> +++ b/drivers/dma-buf/sw_sync.c
> @@ -321,9 +321,19 @@ static int sw_sync_debugfs_open(struct inode *inode, 
> struct file *file)
>  static int sw_sync_debugfs_release(struct inode *inode, struct file *file)
>  {
> struct sync_timeline *obj = file->private_data;
> +   struct sync_pt *pt, *next;
>  
> smp_wmb();
>  
> +   spin_lock_irq(>lock);

Given the spinlock, that uncommented barrier (what is it paired with?)
above is redundant.
-Chris
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 2/2] dma-buf/sw_sync: force signal all unsignaled fences on dying timeline

2017-09-07 Thread Gustavo Padovan
From: Dominik Behr 

To avoid hanging userspace components that might have been waiting on the
active fences of the destroyed timeline we need to signal with error all
remaining fences on such timeline.

This restore the default behaviour of the Android sw_sync framework, which
Android still relies on. It was broken on the dma fence conversion a few
years ago and never fixed.

v2: Do not bother with cleanup do the list (Chris Wilson)

Signed-off-by: Dominik Behr 
Signed-off-by: Gustavo Padovan 
---
 drivers/dma-buf/sw_sync.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/dma-buf/sw_sync.c b/drivers/dma-buf/sw_sync.c
index 38cc7389a6c1..f183eef074fd 100644
--- a/drivers/dma-buf/sw_sync.c
+++ b/drivers/dma-buf/sw_sync.c
@@ -321,9 +321,19 @@ static int sw_sync_debugfs_open(struct inode *inode, 
struct file *file)
 static int sw_sync_debugfs_release(struct inode *inode, struct file *file)
 {
struct sync_timeline *obj = file->private_data;
+   struct sync_pt *pt, *next;
 
smp_wmb();
 
+   spin_lock_irq(>lock);
+
+   list_for_each_entry_safe(pt, next, >pt_list, link) {
+   dma_fence_set_error(>base, -ENOENT);
+   dma_fence_signal_locked(>base);
+   }
+
+   spin_unlock_irq(>lock);
+
sync_timeline_put(obj);
return 0;
 }
-- 
2.13.5

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel