Re: [PATCH] dma-buf: fix locking in sync_print_obj()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 24, 2020 at 10:20:56AM +0000, Chris Wilson wrote:
> Quoting Dan Carpenter (2020-01-24 10:13:12)
> > This is always called with IRQs disabled and we don't actually want to
> > enable IRQs at the end.
> > 
> > Fixes: a6aa8fca4d79 ("dma-buf/sw-sync: Reduce irqsave/irqrestore from known context")
> > Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> > ---
> >  drivers/dma-buf/sync_debug.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/dma-buf/sync_debug.c b/drivers/dma-buf/sync_debug.c
> > index 101394f16930..952331344b1c 100644
> > --- a/drivers/dma-buf/sync_debug.c
> > +++ b/drivers/dma-buf/sync_debug.c
> > @@ -107,15 +107,16 @@ static void sync_print_fence(struct seq_file *s,
> >  static void sync_print_obj(struct seq_file *s, struct sync_timeline *obj)
> >  {
> >         struct list_head *pos;
> > +       unsigned long flags;
> >  
> >         seq_printf(s, "%s: %d\n", obj->name, obj->value);
> >  
> > -       spin_lock_irq(&obj->lock);
> > +       spin_lock_irqsave(&obj->lock, flags);
> 
> Exactly, it can be just spin_lock() as the irq state is known.
> 

I did consider that but I wasn't sure how this is going to be used in
the future so I took a conservative approach.

> Once again I question why this [sync_debug.c] code even exists.

No idea.

regards,
dan carpenter

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



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux