[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230815165225.GF907732@google.com>
Date: Wed, 16 Aug 2023 01:52:25 +0900
From: Sergey Senozhatsky <senozhatsky@...omium.org>
To: Robin Murphy <robin.murphy@....com>
Cc: Sergey Senozhatsky <senozhatsky@...omium.org>,
Christoph Hellwig <hch@....de>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Petr Mladek <pmladek@...e.com>,
Rob Clark <robdclark@...omium.org>,
John Ogness <john.ogness@...utronix.de>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] dma-debug: defer __dma_entry_alloc_check_leak() printk
output
On (23/08/15 17:42), Robin Murphy wrote:
> On 15/08/2023 4:26 pm, Sergey Senozhatsky wrote:
> > __dma_entry_alloc_check_leak() calls printk -> serial console
> > output (qcom geni) and grabs port->lock under free_entries_lock,
> > which is a conflicting locking dependency chain as qcom_geni IRQ
> > handler can call into dma-debug code and grab free_entries_lock
> > under port->lock.
> >
> > Use deferred printk in __dma_entry_alloc_check_leak() so that we
> > don't acquire serial console's port->lock under free_entries_lock.
>
> Hmm, the print really doesn't need to be under the lock anyway, it only
> needs to key off whether the "num_free_entries == 0" condition was hit or
> not.
I thought about it, briefly. __dma_entry_alloc_check_leak() reads
global nr_total_entries / nr_prealloc_entries which are updated
(inc/dec) under free_entries_lock, so I didn't want to move
__dma_entry_alloc_check_leak() outside of free_entries_lock scope.
Powered by blists - more mailing lists