linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Starkey <Brian.Starkey@arm.com>
To: John Stultz <john.stultz@linaro.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Laura Abbott <labbott@redhat.com>,
	Benjamin Gaignard <benjamin.gaignard@linaro.org>,
	Sumit Semwal <sumit.semwal@linaro.org>,
	Liam Mark <lmark@codeaurora.org>,
	Pratik Patel <pratikp@codeaurora.org>,
	"Andrew F . Davis" <afd@ti.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"huyue2@yulong.com" <huyue2@yulong.com>,
	Mike Rapoport <rppt@linux.ibm.com>,
	Chenbo Feng <fengc@google.com>,
	Alistair Strachan <astrachan@google.com>,
	Sandeep Patil <sspatil@google.com>,
	Hridya Valsaraju <hridya@google.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>, nd <nd@arm.com>
Subject: Re: [RFC][PATCH 2/2] dma-buf: heaps: Allow system & cma heaps to be configured as a modules
Date: Mon, 4 Nov 2019 09:45:42 +0000	[thread overview]
Message-ID: <20191104094533.zal4sjexrmtgaacn@DESKTOP-E1NTVVP.localdomain> (raw)
In-Reply-To: <20191025234834.28214-3-john.stultz@linaro.org>

Hi John,

On Fri, Oct 25, 2019 at 11:48:34PM +0000, John Stultz wrote:
> Allow loading system and cma heap as a module instead of just as
> a statically built in heap.
> 
> Since there isn't a good mechanism for dmabuf lifetime tracking
> it isn't safe to allow the heap drivers to be unloaded, so these
> drivers do not implement any module unloading functionality and
> will show up in lsmod as "[permanent]".

Cool, that alleviates my concerns :-)

> 
> This patch also exports key functions from dmabuf heaps core and
> the heap helper functions so they can be accessed by the module.
> 
> Cc: Laura Abbott <labbott@redhat.com>
> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Cc: Sumit Semwal <sumit.semwal@linaro.org>
> Cc: Liam Mark <lmark@codeaurora.org>
> Cc: Pratik Patel <pratikp@codeaurora.org>
> Cc: Brian Starkey <Brian.Starkey@arm.com>
> Cc: Andrew F. Davis <afd@ti.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Yue Hu <huyue2@yulong.com>
> Cc: Mike Rapoport <rppt@linux.ibm.com>
> Cc: Chenbo Feng <fengc@google.com>
> Cc: Alistair Strachan <astrachan@google.com>
> Cc: Sandeep Patil <sspatil@google.com>
> Cc: Hridya Valsaraju <hridya@google.com>
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: John Stultz <john.stultz@linaro.org>
> ---
>  drivers/dma-buf/dma-heap.c           | 2 ++
>  drivers/dma-buf/heaps/Kconfig        | 4 ++--
>  drivers/dma-buf/heaps/heap-helpers.c | 2 ++
>  3 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c
> index 9a41b73e54b4..2c4ac71a715b 100644
> --- a/drivers/dma-buf/dma-heap.c
> +++ b/drivers/dma-buf/dma-heap.c
> @@ -161,6 +161,7 @@ void *dma_heap_get_drvdata(struct dma_heap *heap)
>  {
>  	return heap->priv;
>  }
> +EXPORT_SYMBOL_GPL(dma_heap_get_drvdata);
>  
>  struct dma_heap *dma_heap_add(const struct dma_heap_export_info *exp_info)
>  {
> @@ -243,6 +244,7 @@ struct dma_heap *dma_heap_add(const struct dma_heap_export_info *exp_info)
>  	kfree(heap);
>  	return err_ret;
>  }
> +EXPORT_SYMBOL_GPL(dma_heap_add);

Maybe overly picky - but adding the note about "no safe way to remove,
so there's no dma_heap_remove" to a comment on this function may be
easier to notice than in the git log alone.

Cheers,
-Brian

>  
>  static char *dma_heap_devnode(struct device *dev, umode_t *mode)
>  {
> diff --git a/drivers/dma-buf/heaps/Kconfig b/drivers/dma-buf/heaps/Kconfig
> index a5eef06c4226..e273fb18feca 100644
> --- a/drivers/dma-buf/heaps/Kconfig
> +++ b/drivers/dma-buf/heaps/Kconfig
> @@ -1,12 +1,12 @@
>  config DMABUF_HEAPS_SYSTEM
> -	bool "DMA-BUF System Heap"
> +	tristate "DMA-BUF System Heap"
>  	depends on DMABUF_HEAPS
>  	help
>  	  Choose this option to enable the system dmabuf heap. The system heap
>  	  is backed by pages from the buddy allocator. If in doubt, say Y.
>  
>  config DMABUF_HEAPS_CMA
> -	bool "DMA-BUF CMA Heap"
> +	tristate "DMA-BUF CMA Heap"
>  	depends on DMABUF_HEAPS && DMA_CMA
>  	help
>  	  Choose this option to enable dma-buf CMA heap. This heap is backed
> diff --git a/drivers/dma-buf/heaps/heap-helpers.c b/drivers/dma-buf/heaps/heap-helpers.c
> index 750bef4e902d..fb9835126893 100644
> --- a/drivers/dma-buf/heaps/heap-helpers.c
> +++ b/drivers/dma-buf/heaps/heap-helpers.c
> @@ -24,6 +24,7 @@ void init_heap_helper_buffer(struct heap_helper_buffer *buffer,
>  	INIT_LIST_HEAD(&buffer->attachments);
>  	buffer->free = free;
>  }
> +EXPORT_SYMBOL_GPL(init_heap_helper_buffer);
>  
>  struct dma_buf *heap_helper_export_dmabuf(struct heap_helper_buffer *buffer,
>  					  int fd_flags)
> @@ -37,6 +38,7 @@ struct dma_buf *heap_helper_export_dmabuf(struct heap_helper_buffer *buffer,
>  
>  	return dma_buf_export(&exp_info);
>  }
> +EXPORT_SYMBOL_GPL(heap_helper_export_dmabuf);
>  
>  static void *dma_heap_map_kernel(struct heap_helper_buffer *buffer)
>  {
> -- 
> 2.17.1
> 

  reply	other threads:[~2019-11-04  9:45 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25 23:48 [RFC][PATCH 0/2] Allow DMA BUF heaps to be loaded as modules John Stultz
2019-10-25 23:48 ` [RFC][PATCH 1/2] mm: cma: Export cma symbols for cma heap as a module John Stultz
2019-10-28  7:46   ` Christoph Hellwig
2019-10-28 18:39     ` John Stultz
2019-10-28 22:23       ` John Stultz
2019-10-28 19:12   ` sspatil
2019-10-28 20:03     ` John Stultz
2019-10-28 22:26       ` John Stultz
2019-10-25 23:48 ` [RFC][PATCH 2/2] dma-buf: heaps: Allow system & cma heaps to be configured as a modules John Stultz
2019-11-04  9:45   ` Brian Starkey [this message]
2019-11-04 10:24   ` Daniel Vetter
2019-11-04 19:00     ` John Stultz
2019-11-04  9:58 ` [RFC][PATCH 0/2] Allow DMA BUF heaps to be loaded as modules Daniel Vetter
2019-11-04 18:57   ` John Stultz
2019-11-05  9:42     ` Daniel Vetter
2019-11-05 13:30       ` Andrew F. Davis
2019-11-05 13:58         ` Daniel Vetter
2019-11-05 17:41       ` John Stultz
2019-11-05 19:18         ` Daniel Vetter
2019-11-05 19:47           ` John Stultz
2019-11-05 20:21             ` Daniel Vetter
2019-11-12  0:56             ` Sandeep Patil
2019-11-12  0:49         ` Sandeep Patil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191104094533.zal4sjexrmtgaacn@DESKTOP-E1NTVVP.localdomain \
    --to=brian.starkey@arm.com \
    --cc=afd@ti.com \
    --cc=akpm@linux-foundation.org \
    --cc=astrachan@google.com \
    --cc=benjamin.gaignard@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fengc@google.com \
    --cc=hridya@google.com \
    --cc=huyue2@yulong.com \
    --cc=john.stultz@linaro.org \
    --cc=labbott@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lmark@codeaurora.org \
    --cc=nd@arm.com \
    --cc=pratikp@codeaurora.org \
    --cc=rppt@linux.ibm.com \
    --cc=sspatil@google.com \
    --cc=sumit.semwal@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).