[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2dbed6e5-2244-2de3-ad1a-9d010fa94b5e@gmail.com>
Date: Mon, 9 Apr 2018 15:39:36 -0400
From: Alex Bounine <alex.bou9@...il.com>
To: Ioan Nicu <ioan.nicu.ext@...ia.com>,
Andrew Morton <akpm@...uxfoundation.org>,
Barry Wood <barry.wood@....com>,
Matt Porter <mporter@...nel.crashing.org>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Al Viro <viro@...iv.linux.org.uk>,
Logan Gunthorpe <logang@...tatee.com>,
Chris Wilson <chris@...is-wilson.co.uk>,
Tvrtko Ursulin <tvrtko.ursulin@...el.com>,
Frank Kunz <frank.kunz@...ia.com>,
Alexander Sverdlin <alexander.sverdlin@...ia.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rapidio: use a reference count for struct mport_dma_req
On 2018-04-05 04:33 PM, Ioan Nicu wrote:
> Once the dma request is passed to the DMA engine, the DMA
> subsystem would hold a pointer to this structure and could
> call the completion callback after do_dma_request() has
> timed out.
>
> The current code deals with this by putting timed out SYNC
> requests to a pending list and freeing them later, when the
> mport cdev device is released. But this still does not
> guarantee that the DMA subsystem is really done with those
> transfers, so in theory dma_xfer_callback/dma_req_free
> could be called after mport_cdev_release_dma and could
> potentially access already freed memory.
>
> This patch simplifies the current handling by using a kref
> in the mport dma request structure, so that it gets freed
> only when nobody uses it anymore.
>
> This also simplifies the code a bit, as FAF transfers are
> now handled in the same way as SYNC and ASYNC transfers.
> There is no need anymore for the pending list and for the
> dma workqueue which was used in case of FAF transfers, so
> we remove them both.
>
> Signed-off-by: Ioan Nicu <ioan.nicu.ext@...ia.com>
> ---
> drivers/rapidio/devices/rio_mport_cdev.c | 122 +++++--------------------------
> 1 file changed, 18 insertions(+), 104 deletions(-)
Acked-by: Alexandre Bounine <alex.bou9@...il.com>
Powered by blists - more mailing lists