Skip to contentSkip to conversation

dma-buf: system_heap: Add a system-uncached heap re-using the system heap

PATCH Hillf Danton 2 participants 2 messages Oct 30, 2020 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw
Quoted 6 lines · On Thu, 29 Oct 2020 15:28:34 -0700 John Stultz wrote:
Quoted 5 lines · Hillf Danton
Quoted 4 lines · On Thu, 29 Oct 2020 00:16:24 +0000 John Stultz wrote:
(quoted diff) +0 -0
@@ -194,6 +210,9 @@ static int system_heap_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
      struct sg_page_iter piter;
      int ret;
 
Quoted 8 lines
Quoted 5 lines

Review static int system_heap_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma) · line 215

Quoted 3 lines
(quoted diff) +3 -0
+     if (buffer->uncached)
+             vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
+

Wonder why you turn back to dma_mmap_wc() and friends?

Sorry, can you expand on what you are proposing here instead? I'm not sure I see how dma_alloc/mmap/*_wc() quite fits here.

I just wondered if *_wc() could save you two minutes or three. Can you shed some light on your concerns about their unfitness?
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw
Quoted 13 lines · Hillf Danton
Quoted 12 lines · On Thu, 29 Oct 2020 15:28:34 -0700 John Stultz wrote:
Quoted 10 lines · Hillf Danton

Review static int system_heap_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma) · line 215

Quoted 7 lines · On Thu, 29 Oct 2020 00:16:24 +0000 John Stultz wrote:
(quoted diff) +3 -0
@@ -194,6 +210,9 @@ static int system_heap_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
      struct sg_page_iter piter;
      int ret;
 
+     if (buffer->uncached)
+             vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
+

Wonder why you turn back to dma_mmap_wc() and friends?

Quoted 5 lines
Quoted 2 lines

Sorry, can you expand on what you are proposing here instead? I'm not sure I see how dma_alloc/mmap/*_wc() quite fits here.

I just wondered if *_wc() could save you two minutes or three. Can you shed some light on your concerns about their unfitness?

Sorry, I feel a bit daft here. I'm still not exactly sure what you're proposing, and your reply of saving minutes doesn't really clarify things.
So I'm not sure it's a good use of time to try to (most likely, incorrectly) refute all the possible things you might be suggesting. :)

But I'll try to share my thoughts:

So the system heap allows for allocation of non-contiguous buffers (currently allocated from page_alloc), which we keep track using sglists.
Since the resulting dmabufs are shared between multiple devices, we want to provide a *specific type of memory* (in this case non-contiguous system memory), rather than what the underlying dma_alloc_attr() allocates for a specific device.

My sense is dma_mmap_wc() likely ought to be paired with switching to using dma_alloc_wc() as well, which calls down to dma_alloc_attr(). Maybe one could use dma_alloc_attr against the heap device to allocate chunks that we track in the sglist. But I'm not sure how that saves us much other than possibly swapping dma_mmap_wc() for remap_pfn_range()?

But again, I suspect I've mischaracterized what you're actually suggesting. So please let me know what you're thinking and I'm happy to consider it.

thanks
-john
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel