drm/shmem-helpers: vunmap: Don't put pages for dma-buf
Subsystems (2)
PATCH 1/1 drm/shmem-helpers: vunmap: Don't put pages for dma-buf
dma-buf importing was reworked in commit 7d2cd72a9aa3 ("drm/shmem-helpers: Simplify dma-buf importing"). Before that commit drm_gem_shmem_prime_import_sg_table() did set ->pages_use_count=1 and drm_gem_shmem_vunmap_locked() could call drm_gem_shmem_put_pages() unconditionally. Now without the use count set, put pages is called also on dma-bufs. Fix this by only putting pages if it's not imported.
--- drivers/gpu/drm/drm_gem_shmem_helper.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_gem_shmem_helper.c +4 -3
@@ -357,13 +357,14 @@ static void drm_gem_shmem_vunmap_locked(struct drm_gem_shmem_object *shmem,if (--shmem->vmap_use_count >0 )return ; -if (obj->import_attach) +if (obj->import_attach) {dma_buf_vunmap (obj->import_attach->dmabuf, map); -else + }else {vunmap (shmem->vaddr); +drm_gem_shmem_put_pages (shmem); + } shmem->vaddr =NULL ; -drm_gem_shmem_put_pages (shmem); }/*
Signature · 6 lines
2.23.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi
Am 19.02.21 um 13:22 schrieb Noralf Trønnes:
Quoted 11 lines
dma-buf importing was reworked in commit
7d2cd72a9aa3("drm/shmem-helpers: Simplify dma-buf importing"). Before that commitdrm_gem_shmem_prime_import_sg_table()did set ->pages_use_count=1 anddrm_gem_shmem_vunmap_locked()could calldrm_gem_shmem_put_pages()unconditionally. Now without the use count set, put pages is called also on dma-bufs. Fix this by only putting pages if it's not imported.Fixes 7d2cd72a9aa3 ("drm/shmem-helpers: Simplify dma-buf importing")Cc Daniel Vetter <[email protected]>Cc Thomas Zimmermann <[email protected]>Signed-off-by Noralf Trønnes <[email protected]>
Just when I saw the error. Nice. :)
For testing the GUD driver, you may also want to keep an eye at [1]
Best regards
Thomas
[1] https://lore.kernel.org/dri-devel/[email protected]/T/#t
Quoted 27 lines
--- drivers/gpu/drm/drm_gem_shmem_helper.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_gem_shmem_helper.c +4
-3@@ -357,13 +357,14 @@ static void drm_gem_shmem_vunmap_locked(struct drm_gem_shmem_object *shmem,if (--shmem->vmap_use_count >0 )return ; -if (obj->import_attach) +if (obj->import_attach) {dma_buf_vunmap (obj->import_attach->dmabuf, map); -else + }else {vunmap (shmem->vaddr); +drm_gem_shmem_put_pages (shmem); + } shmem->vaddr =NULL ; -drm_gem_shmem_put_pages (shmem); }/*
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Den 19.02.2021 14.54, skrev Thomas Zimmermann:
Quoted 15 lines
Hi
Am 19.02.21 um 13:22 schrieb Noralf Trønnes:
Quoted 11 lines
dma-buf importing was reworked in commit
7d2cd72a9aa3("drm/shmem-helpers: Simplify dma-buf importing"). Before that commitdrm_gem_shmem_prime_import_sg_table()did set ->pages_use_count=1 anddrm_gem_shmem_vunmap_locked()could calldrm_gem_shmem_put_pages()unconditionally. Now without the use count set, put pages is called also on dma-bufs. Fix this by only putting pages if it's not imported.Fixes 7d2cd72a9aa3 ("drm/shmem-helpers: Simplify dma-buf importing")Cc Daniel Vetter <[email protected]>Cc Thomas Zimmermann <[email protected]>Signed-off-by Noralf Trønnes <[email protected]>
Quoted 5 lines
Just when I saw the error. Nice. :)
Tested-by Thomas Zimmermann <[email protected]>
Should I apply this to drm-misc-fixes?
Noralf.
Quoted 27 lines
For testing the GUD driver, you may also want to keep an eye at [1]
Best regards
Thomas[1]
https://lore.kernel.org/dri-devel/[email protected]/T/#tQuoted 18 lines
---
drivers/gpu/drm/drm_gem_shmem_helper.c| 7 ++++---1 file changed, 4 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_gem_shmem_helper.c +2
-1@@ -357,13 +357,14 @@ static void drm_gem_shmem_vunmap_locked(struct drm_gem_shmem_object *shmem, if (--shmem->vmap_use_count > 0) return; - if (obj->import_attach) + if (obj->import_attach) { dma_buf_vunmap(obj->import_attach->dmabuf, map); - else + } else {
Quoted 9 lines
drivers/gpu/drm/drm_gem_shmem_helper.c static void drm_gem_shmem_vunmap_locked(struct drm_gem_shmem_object *shmem,
Quoted 8 lines
drivers/gpu/drm/drm_gem_shmem_helper.c +2
-1vunmap(shmem->vaddr); + drm_gem_shmem_put_pages(shmem); + } shmem->vaddr = NULL; - drm_gem_shmem_put_pages(shmem); } /*
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerHi
Am 24.02.21 um 18:14 schrieb Noralf Trønnes:
Quoted 18 lines
Den 19.02.2021 14.54, skrev Thomas Zimmermann:
Quoted 15 lines
Hi
Am 19.02.21 um 13:22 schrieb Noralf Trønnes:
Quoted 11 lines
dma-buf importing was reworked in commit
7d2cd72a9aa3("drm/shmem-helpers: Simplify dma-buf importing"). Before that commitdrm_gem_shmem_prime_import_sg_table()did set ->pages_use_count=1 anddrm_gem_shmem_vunmap_locked()could calldrm_gem_shmem_put_pages()unconditionally. Now without the use count set, put pages is called also on dma-bufs. Fix this by only putting pages if it's not imported.Fixes 7d2cd72a9aa3 ("drm/shmem-helpers: Simplify dma-buf importing")Cc Daniel Vetter <[email protected]>Cc Thomas Zimmermann <[email protected]>Signed-off-by Noralf Trønnes <[email protected]>
Quoted 7 lines
Quoted 5 lines
Just when I saw the error. Nice. :)
Tested-by Thomas Zimmermann <[email protected]>Should I apply this to drm-misc-fixes?
I think so. Ping me if you want me to add it.
Best regards
Thomas
Quoted 39 lines
Noralf.
Quoted 36 lines
For testing the GUD driver, you may also want to keep an eye at [1]
Best regards
Thomas[1]
https://lore.kernel.org/dri-devel/[email protected]/T/#tQuoted 26 lines
--- drivers/gpu/drm/drm_gem_shmem_helper.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_gem_shmem_helper.c +4
-2@@ -357,13 +357,14 @@ static void drm_gem_shmem_vunmap_locked(struct drm_gem_shmem_object *shmem, if (--shmem->vmap_use_count > 0) return; - if (obj->import_attach) + if (obj->import_attach) { dma_buf_vunmap(obj->import_attach->dmabuf, map); - else + } else { vunmap(shmem->vaddr); + drm_gem_shmem_put_pages(shmem); + } shmem->vaddr = NULL; - drm_gem_shmem_put_pages(shmem); } /*
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Den 25.02.2021 09.12, skrev Thomas Zimmermann:
Quoted 24 lines
Hi
Am 24.02.21 um 18:14 schrieb Noralf Trønnes:
Quoted 21 lines
Den 19.02.2021 14.54, skrev Thomas Zimmermann:
Quoted 18 lines
Hi
Am 19.02.21 um 13:22 schrieb Noralf Trønnes:
Quoted 8 lines
dma-buf importing was reworked in commit
7d2cd72a9aa3("drm/shmem-helpers: Simplify dma-buf importing"). Before that commitdrm_gem_shmem_prime_import_sg_table()did set ->pages_use_count=1 anddrm_gem_shmem_vunmap_locked()could calldrm_gem_shmem_put_pages()unconditionally. Now without the use count set, put pages is called also
on dma-bufs. Fix this by only putting pages if it's not imported.Quoted 4 lines
Fixes 7d2cd72a9aa3 ("drm/shmem-helpers: Simplify dma-buf importing")Cc Daniel Vetter <[email protected]>Cc Thomas Zimmermann <[email protected]>Signed-off-by Noralf Trønnes <[email protected]>Just when I saw the error. Nice. :)
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Tested-by Thomas Zimmermann <[email protected]>Should I apply this to drm-misc-fixes?
I think so. Ping me if you want me to add it.
I'd appreciate if you could do it. I haven't applied a patch in almost a year now and need to dig out my notes on how I do it. -fixes stuff is for me a "hold my breath and hope I don't screw up anything" exercise. Stressful :/
One day in the future I hope there's a green button I can push that
says: Merge patch to -fixes and make sure everything is OK. That would be nice :)
Thanks,
Noralf.
Quoted 44 lines
Best regards
ThomasQuoted 40 lines
Noralf.
Quoted 37 lines
For testing the GUD driver, you may also want to keep an eye at [1]
Best regards
Thomas[1]
https://lore.kernel.org/dri-devel/[email protected]/T/#tQuoted 26 lines
---
drivers/gpu/drm/drm_gem_shmem_helper.c| 7 ++++---1 file changed, 4 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_gem_shmem_helper.c +4
-2@@ -357,13 +357,14 @@ static void drm_gem_shmem_vunmap_locked(struct drm_gem_shmem_object *shmem, if (--shmem->vmap_use_count > 0) return; - if (obj->import_attach) + if (obj->import_attach) { dma_buf_vunmap(obj->import_attach->dmabuf, map); - else + } else { vunmap(shmem->vaddr); + drm_gem_shmem_put_pages(shmem); + } shmem->vaddr = NULL; - drm_gem_shmem_put_pages(shmem); } /*
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerAm 25.02.21 um 10:25 schrieb Noralf Trønnes:
Quoted 33 lines
Den 25.02.2021 09.12, skrev Thomas Zimmermann:
Quoted 30 lines
Hi
Am 24.02.21 um 18:14 schrieb Noralf Trønnes:
Quoted 26 lines
Den 19.02.2021 14.54, skrev Thomas Zimmermann:
Quoted 16 lines
Hi
Am 19.02.21 um 13:22 schrieb Noralf Trønnes:
Quoted 8 lines
dma-buf importing was reworked in commit
7d2cd72a9aa3("drm/shmem-helpers: Simplify dma-buf importing"). Before that commitdrm_gem_shmem_prime_import_sg_table()did set ->pages_use_count=1 anddrm_gem_shmem_vunmap_locked()could calldrm_gem_shmem_put_pages()unconditionally. Now without the use count set, put pages is called also
on dma-bufs. Fix this by only putting pages if it's not imported.Quoted 4 lines
Fixes 7d2cd72a9aa3 ("drm/shmem-helpers: Simplify dma-buf importing")Cc Daniel Vetter <[email protected]>Cc Thomas Zimmermann <[email protected]>Signed-off-by Noralf Trønnes <[email protected]>Quoted 5 lines
Just when I saw the error. Nice. :)
Tested-by Thomas Zimmermann <[email protected]>Should I apply this to drm-misc-fixes?
Quoted 7 lines
Quoted 2 lines
I think so. Ping me if you want me to add it.
I'd appreciate if you could do it. I haven't applied a patch in almost a year now and need to dig out my notes on how I do it. -fixes stuff is for me a "hold my breath and hope I don't screw up anything" exercise. Stressful :/
Applied now to drm-misc-next. If it breaks, I'll also take the blame. :) I took the liberty of moving your S-o-b line to the top of the tag. IIRC this is the preferred style. Thanks again for the fix.
Best regards
Thomas
Quoted 52 lines
One day in the future I hope there's a green button I can push that
says: Merge patch to -fixes and make sure everything is OK. That would be nice :)Thanks,
Noralf.Quoted 44 lines
Best regards
ThomasQuoted 40 lines
Noralf.
Quoted 37 lines
For testing the GUD driver, you may also want to keep an eye at [1]
Best regards
Thomas[1]
https://lore.kernel.org/dri-devel/[email protected]/T/#tQuoted 26 lines
--- drivers/gpu/drm/drm_gem_shmem_helper.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_gem_shmem_helper.c +4
-2@@ -357,13 +357,14 @@ static void drm_gem_shmem_vunmap_locked(struct drm_gem_shmem_object *shmem, if (--shmem->vmap_use_count > 0) return; - if (obj->import_attach) + if (obj->import_attach) { dma_buf_vunmap(obj->import_attach->dmabuf, map); - else + } else { vunmap(shmem->vaddr); + drm_gem_shmem_put_pages(shmem); + } shmem->vaddr = NULL; - drm_gem_shmem_put_pages(shmem); } /*
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 19 lines · Noralf Trønnes
Den 19.02.2021 14.54, skrev Thomas Zimmermann:
Quoted 15 lines
Hi
Am 19.02.21 um 13:22 schrieb Noralf Trønnes:
Quoted 11 lines
dma-buf importing was reworked in commit
7d2cd72a9aa3("drm/shmem-helpers: Simplify dma-buf importing"). Before that commitdrm_gem_shmem_prime_import_sg_table()did set ->pages_use_count=1 anddrm_gem_shmem_vunmap_locked()could calldrm_gem_shmem_put_pages()unconditionally. Now without the use count set, put pages is called also on dma-bufs. Fix this by only putting pages if it's not imported.Fixes 7d2cd72a9aa3 ("drm/shmem-helpers: Simplify dma-buf importing")Cc Daniel Vetter <[email protected]>Cc Thomas Zimmermann <[email protected]>Signed-off-by Noralf Trønnes <[email protected]>
Quoted 7 lines
Quoted 5 lines
Just when I saw the error. Nice. :)
Tested-by Thomas Zimmermann <[email protected]>Should I apply this to drm-misc-fixes?
drm-misc-next-fixes because we're in the merge window. -Daniel
Quoted 39 lines
Noralf.
Quoted 36 lines
For testing the GUD driver, you may also want to keep an eye at [1]
Best regards
Thomas[1]
https://lore.kernel.org/dri-devel/[email protected]/T/#tQuoted 26 lines
--- drivers/gpu/drm/drm_gem_shmem_helper.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_gem_shmem_helper.c +4
-2@@ -357,13 +357,14 @@ static void drm_gem_shmem_vunmap_locked(struct drm_gem_shmem_object *shmem, if (--shmem->vmap_use_count > 0) return; - if (obj->import_attach) +if (obj->import_attach) {dma_buf_vunmap (obj->import_attach->dmabuf, map); - else + }else {vunmap (shmem->vaddr); +drm_gem_shmem_put_pages (shmem); + } shmem->vaddr =NULL ; -drm_gem_shmem_put_pages (shmem); }/*
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerHi
Am 25.02.21 um 10:43 schrieb Daniel Vetter:
Quoted 22 lines · Noralf Trønnes
Quoted 21 lines
Den 19.02.2021 14.54, skrev Thomas Zimmermann:
Quoted 17 lines
Hi
Am 19.02.21 um 13:22 schrieb Noralf Trønnes:
Quoted 11 lines
dma-buf importing was reworked in commit
7d2cd72a9aa3("drm/shmem-helpers: Simplify dma-buf importing"). Before that commitdrm_gem_shmem_prime_import_sg_table()did set ->pages_use_count=1 anddrm_gem_shmem_vunmap_locked()could calldrm_gem_shmem_put_pages()unconditionally. Now without the use count set, put pages is called also on dma-bufs. Fix this by only putting pages if it's not imported.Fixes 7d2cd72a9aa3 ("drm/shmem-helpers: Simplify dma-buf importing")Cc Daniel Vetter <[email protected]>Cc Thomas Zimmermann <[email protected]>Signed-off-by Noralf Trønnes <[email protected]>Just when I saw the error. Nice. :)
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Tested-by Thomas Zimmermann <[email protected]>Should I apply this to drm-misc-fixes?
drm-misc-next-fixes because we're in the merge window.
Too late. Can/should I cherry-pick the patch from drm-misc-next?
Best regards
Thomas
Quoted 44 lines
-Daniel
Quoted 39 lines
Noralf.
Quoted 36 lines
For testing the GUD driver, you may also want to keep an eye at [1]
Best regards
Thomas[1]
https://lore.kernel.org/dri-devel/[email protected]/T/#tQuoted 26 lines
--- drivers/gpu/drm/drm_gem_shmem_helper.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_gem_shmem_helper.c +4
-2@@ -357,13 +357,14 @@ static void drm_gem_shmem_vunmap_locked(struct drm_gem_shmem_object *shmem, if (--shmem->vmap_use_count > 0) return; - if (obj->import_attach) +if (obj->import_attach) {dma_buf_vunmap (obj->import_attach->dmabuf, map); - else + }else {vunmap (shmem->vaddr); +drm_gem_shmem_put_pages (shmem); + } shmem->vaddr =NULL ; -drm_gem_shmem_put_pages (shmem); }/*
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 29 lines · Thomas Zimmermann
Hi
Am 25.02.21 um 10:43 schrieb Daniel Vetter:
Quoted 26 lines · Noralf Trønnes
Quoted 25 lines
Den 19.02.2021 14.54, skrev Thomas Zimmermann:
Quoted 20 lines
Hi
Am 19.02.21 um 13:22 schrieb Noralf Trønnes:
Quoted 11 lines
dma-buf importing was reworked in commit
7d2cd72a9aa3("drm/shmem-helpers: Simplify dma-buf importing"). Before that commitdrm_gem_shmem_prime_import_sg_table()did set ->pages_use_count=1 anddrm_gem_shmem_vunmap_locked()could calldrm_gem_shmem_put_pages()unconditionally. Now without the use count set, put pages is called also on dma-bufs. Fix this by only putting pages if it's not imported.Fixes 7d2cd72a9aa3 ("drm/shmem-helpers: Simplify dma-buf importing")Cc Daniel Vetter <[email protected]>Cc Thomas Zimmermann <[email protected]>Signed-off-by Noralf Trønnes <[email protected]>Just when I saw the error. Nice. :)
Tested-by Thomas Zimmermann <[email protected]>
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Should I apply this to drm-misc-fixes?
drm-misc-next-fixes because we're in the merge window.
Too late. Can/should I cherry-pick the patch from drm-misc-next?
Maarten just send the pull around, so pls coordinate with him. Maybe best if Maarten cherry-picks onto drm-misc-fixes after -rc1 is out. -Daniel
Quoted 57 lines
Best regards
ThomasQuoted 44 lines
-Daniel
Quoted 39 lines
Noralf.
Quoted 36 lines
For testing the GUD driver, you may also want to keep an eye at [1]
Best regards
Thomas[1]
https://lore.kernel.org/dri-devel/[email protected]/T/#tQuoted 26 lines
--- drivers/gpu/drm/drm_gem_shmem_helper.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_gem_shmem_helper.c +4
-2@@ -357,13 +357,14 @@ static void drm_gem_shmem_vunmap_locked(struct drm_gem_shmem_object *shmem, if (--shmem->vmap_use_count > 0) return; - if (obj->import_attach) +if (obj->import_attach) {dma_buf_vunmap (obj->import_attach->dmabuf, map); - else + }else {vunmap (shmem->vaddr); +drm_gem_shmem_put_pages (shmem); + } shmem->vaddr =NULL ; -drm_gem_shmem_put_pages (shmem); }/* Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel