From: Robin Murphy <robin.murphy@arm.com>
To: guangming.cao@mediatek.com
Cc: wsd_upstream@mediatek.com, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org, christian.koenig@amd.com,
linaro-mm-sig@lists.linaro.org, lmark@codeaurora.org,
benjamin.gaignard@linaro.org, matthias.bgg@gmail.com,
linux-mediatek@lists.infradead.org, labbott@redhat.com,
linux-arm-kernel@lists.infradead.org,
linux-media@vger.kernel.org
Subject: Re: [PATCH v2] dma_heap: use for_each_sgtable_sg in sg_table release flow
Date: Thu, 25 Nov 2021 14:08:00 +0000 [thread overview]
Message-ID: <eb6cc56d-cbe0-73d5-d4f5-0aa2b76272a4@arm.com> (raw)
In-Reply-To: <20211125134951.62002-1-guangming.cao@mediatek.com>
On 2021-11-25 13:49, guangming.cao@mediatek.com wrote:
> From: Guangming <Guangming.Cao@mediatek.com>
>
> Use (for_each_sgtable_sg) rather than (for_each_sg) to traverse
> sg_table to free sg_table.
> Use (for_each_sg) maybe will casuse some pages can't be freed
> when send wrong nents number.
It's still worth spelling out that this is fixing a bug where the
current code should have been using table->orig_nents - it's just that
switching to the sgtable helper is the best way to make the fix, since
it almost entirely removes the possibility of making that (previously
rather common) mistake.
If it helps, for the change itself:
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Thanks,
Robin.
> Signed-off-by: Guangming <Guangming.Cao@mediatek.com>
> ---
> drivers/dma-buf/heaps/system_heap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma-buf/heaps/system_heap.c b/drivers/dma-buf/heaps/system_heap.c
> index 23a7e74ef966..8660508f3684 100644
> --- a/drivers/dma-buf/heaps/system_heap.c
> +++ b/drivers/dma-buf/heaps/system_heap.c
> @@ -289,7 +289,7 @@ static void system_heap_dma_buf_release(struct dma_buf *dmabuf)
> int i;
>
> table = &buffer->sg_table;
> - for_each_sg(table->sgl, sg, table->nents, i) {
> + for_each_sgtable_sg(table, sg, i) {
> struct page *page = sg_page(sg);
>
> __free_pages(page, compound_order(page));
>
WARNING: multiple messages have this Message-ID (diff)
From: Robin Murphy <robin.murphy@arm.com>
To: guangming.cao@mediatek.com
Cc: Brian.Starkey@arm.com, benjamin.gaignard@linaro.org,
christian.koenig@amd.com, dri-devel@lists.freedesktop.org,
john.stultz@linaro.org, labbott@redhat.com,
linaro-mm-sig@lists.linaro.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linux-mediatek@lists.infradead.org, lmark@codeaurora.org,
matthias.bgg@gmail.com, sumit.semwal@linaro.org,
wsd_upstream@mediatek.com
Subject: Re: [PATCH v2] dma_heap: use for_each_sgtable_sg in sg_table release flow
Date: Thu, 25 Nov 2021 14:08:00 +0000 [thread overview]
Message-ID: <eb6cc56d-cbe0-73d5-d4f5-0aa2b76272a4@arm.com> (raw)
In-Reply-To: <20211125134951.62002-1-guangming.cao@mediatek.com>
On 2021-11-25 13:49, guangming.cao@mediatek.com wrote:
> From: Guangming <Guangming.Cao@mediatek.com>
>
> Use (for_each_sgtable_sg) rather than (for_each_sg) to traverse
> sg_table to free sg_table.
> Use (for_each_sg) maybe will casuse some pages can't be freed
> when send wrong nents number.
It's still worth spelling out that this is fixing a bug where the
current code should have been using table->orig_nents - it's just that
switching to the sgtable helper is the best way to make the fix, since
it almost entirely removes the possibility of making that (previously
rather common) mistake.
If it helps, for the change itself:
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Thanks,
Robin.
> Signed-off-by: Guangming <Guangming.Cao@mediatek.com>
> ---
> drivers/dma-buf/heaps/system_heap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma-buf/heaps/system_heap.c b/drivers/dma-buf/heaps/system_heap.c
> index 23a7e74ef966..8660508f3684 100644
> --- a/drivers/dma-buf/heaps/system_heap.c
> +++ b/drivers/dma-buf/heaps/system_heap.c
> @@ -289,7 +289,7 @@ static void system_heap_dma_buf_release(struct dma_buf *dmabuf)
> int i;
>
> table = &buffer->sg_table;
> - for_each_sg(table->sgl, sg, table->nents, i) {
> + for_each_sgtable_sg(table, sg, i) {
> struct page *page = sg_page(sg);
>
> __free_pages(page, compound_order(page));
>
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
WARNING: multiple messages have this Message-ID (diff)
From: Robin Murphy <robin.murphy@arm.com>
To: guangming.cao@mediatek.com
Cc: Brian.Starkey@arm.com, benjamin.gaignard@linaro.org,
christian.koenig@amd.com, dri-devel@lists.freedesktop.org,
john.stultz@linaro.org, labbott@redhat.com,
linaro-mm-sig@lists.linaro.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linux-mediatek@lists.infradead.org, lmark@codeaurora.org,
matthias.bgg@gmail.com, sumit.semwal@linaro.org,
wsd_upstream@mediatek.com
Subject: Re: [PATCH v2] dma_heap: use for_each_sgtable_sg in sg_table release flow
Date: Thu, 25 Nov 2021 14:08:00 +0000 [thread overview]
Message-ID: <eb6cc56d-cbe0-73d5-d4f5-0aa2b76272a4@arm.com> (raw)
In-Reply-To: <20211125134951.62002-1-guangming.cao@mediatek.com>
On 2021-11-25 13:49, guangming.cao@mediatek.com wrote:
> From: Guangming <Guangming.Cao@mediatek.com>
>
> Use (for_each_sgtable_sg) rather than (for_each_sg) to traverse
> sg_table to free sg_table.
> Use (for_each_sg) maybe will casuse some pages can't be freed
> when send wrong nents number.
It's still worth spelling out that this is fixing a bug where the
current code should have been using table->orig_nents - it's just that
switching to the sgtable helper is the best way to make the fix, since
it almost entirely removes the possibility of making that (previously
rather common) mistake.
If it helps, for the change itself:
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Thanks,
Robin.
> Signed-off-by: Guangming <Guangming.Cao@mediatek.com>
> ---
> drivers/dma-buf/heaps/system_heap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma-buf/heaps/system_heap.c b/drivers/dma-buf/heaps/system_heap.c
> index 23a7e74ef966..8660508f3684 100644
> --- a/drivers/dma-buf/heaps/system_heap.c
> +++ b/drivers/dma-buf/heaps/system_heap.c
> @@ -289,7 +289,7 @@ static void system_heap_dma_buf_release(struct dma_buf *dmabuf)
> int i;
>
> table = &buffer->sg_table;
> - for_each_sg(table->sgl, sg, table->nents, i) {
> + for_each_sgtable_sg(table, sg, i) {
> struct page *page = sg_page(sg);
>
> __free_pages(page, compound_order(page));
>
WARNING: multiple messages have this Message-ID (diff)
From: Robin Murphy <robin.murphy@arm.com>
To: guangming.cao@mediatek.com
Cc: Brian.Starkey@arm.com, benjamin.gaignard@linaro.org,
christian.koenig@amd.com, dri-devel@lists.freedesktop.org,
john.stultz@linaro.org, labbott@redhat.com,
linaro-mm-sig@lists.linaro.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linux-mediatek@lists.infradead.org, lmark@codeaurora.org,
matthias.bgg@gmail.com, sumit.semwal@linaro.org,
wsd_upstream@mediatek.com
Subject: Re: [PATCH v2] dma_heap: use for_each_sgtable_sg in sg_table release flow
Date: Thu, 25 Nov 2021 14:08:00 +0000 [thread overview]
Message-ID: <eb6cc56d-cbe0-73d5-d4f5-0aa2b76272a4@arm.com> (raw)
In-Reply-To: <20211125134951.62002-1-guangming.cao@mediatek.com>
On 2021-11-25 13:49, guangming.cao@mediatek.com wrote:
> From: Guangming <Guangming.Cao@mediatek.com>
>
> Use (for_each_sgtable_sg) rather than (for_each_sg) to traverse
> sg_table to free sg_table.
> Use (for_each_sg) maybe will casuse some pages can't be freed
> when send wrong nents number.
It's still worth spelling out that this is fixing a bug where the
current code should have been using table->orig_nents - it's just that
switching to the sgtable helper is the best way to make the fix, since
it almost entirely removes the possibility of making that (previously
rather common) mistake.
If it helps, for the change itself:
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Thanks,
Robin.
> Signed-off-by: Guangming <Guangming.Cao@mediatek.com>
> ---
> drivers/dma-buf/heaps/system_heap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma-buf/heaps/system_heap.c b/drivers/dma-buf/heaps/system_heap.c
> index 23a7e74ef966..8660508f3684 100644
> --- a/drivers/dma-buf/heaps/system_heap.c
> +++ b/drivers/dma-buf/heaps/system_heap.c
> @@ -289,7 +289,7 @@ static void system_heap_dma_buf_release(struct dma_buf *dmabuf)
> int i;
>
> table = &buffer->sg_table;
> - for_each_sg(table->sgl, sg, table->nents, i) {
> + for_each_sgtable_sg(table, sg, i) {
> struct page *page = sg_page(sg);
>
> __free_pages(page, compound_order(page));
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-11-25 14:08 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-25 12:46 [PATCH] dma_heap: use sg_table.orig_nents in sg_table release flow guangming.cao
2021-11-25 12:46 ` guangming.cao
2021-11-25 12:46 ` guangming.cao
2021-11-25 12:46 ` guangming.cao
2021-11-25 13:28 ` Robin Murphy
2021-11-25 13:28 ` Robin Murphy
2021-11-25 13:28 ` Robin Murphy
2021-11-25 13:49 ` [PATCH v2] dma_heap: use for_each_sgtable_sg " guangming.cao
2021-11-25 13:49 ` guangming.cao
2021-11-25 13:49 ` guangming.cao
2021-11-25 13:49 ` guangming.cao
2021-11-25 14:08 ` Robin Murphy [this message]
2021-11-25 14:08 ` Robin Murphy
2021-11-25 14:08 ` Robin Murphy
2021-11-25 14:08 ` Robin Murphy
2021-11-26 3:16 ` [PATCH v3] dma-buf: system_heap: Use 'for_each_sgtable_sg' in pages free flow guangming.cao
2021-11-26 3:16 ` guangming.cao
2021-11-26 3:16 ` guangming.cao
2021-11-26 3:16 ` guangming.cao
2021-11-26 6:31 ` Greg KH
2021-11-26 6:31 ` Greg KH
2021-11-26 6:31 ` Greg KH
2021-11-26 6:31 ` Greg KH
2021-11-26 7:49 ` [PATCH v4] " guangming.cao
2021-11-26 7:49 ` guangming.cao
2021-11-26 7:49 ` guangming.cao
2021-11-26 7:49 ` guangming.cao
2021-11-26 10:05 ` Christian König
2021-11-26 10:05 ` Christian König
2021-11-26 10:05 ` Christian König
2021-11-26 10:05 ` Christian König
2021-11-29 18:05 ` John Stultz
2021-11-29 18:05 ` John Stultz
2021-11-29 18:05 ` John Stultz
2021-11-29 18:05 ` John Stultz
2021-12-01 10:09 ` Sumit Semwal
2021-12-01 10:09 ` Sumit Semwal
2021-12-01 10:09 ` Sumit Semwal
2021-12-01 10:09 ` Sumit Semwal
2021-11-25 14:38 ` [PATCH v2] dma_heap: use for_each_sgtable_sg in sg_table release flow Kuan-Ying Lee
2021-11-25 14:38 ` Kuan-Ying Lee
2021-11-25 14:38 ` Kuan-Ying Lee
2021-11-25 14:38 ` Kuan-Ying Lee
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=eb6cc56d-cbe0-73d5-d4f5-0aa2b76272a4@arm.com \
--to=robin.murphy@arm.com \
--cc=benjamin.gaignard@linaro.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=guangming.cao@mediatek.com \
--cc=labbott@redhat.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=lmark@codeaurora.org \
--cc=matthias.bgg@gmail.com \
--cc=wsd_upstream@mediatek.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.