From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Vova Sharaienko <sharaienko@google.com>,
Robin Murphy <robin.murphy@arm.com>
Cc: android-mm@google.com, kernel-team@android.com,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] dma-coherent: use KiB in DMA allocation logs
Date: Mon, 13 Jul 2026 09:33:29 +0200 [thread overview]
Message-ID: <5f49e2c3-a442-4aa3-82da-ffb4ca88fbdb@samsung.com> (raw)
In-Reply-To: <20260629223759.2637162-1-sharaienko@google.com>
On 30.06.2026 00:37, Vova Sharaienko wrote:
> Update DMA reserved memory pool allocation log messages to display
> sizes in KiB instead of MiB. Using MiB caused allocations less than
> 1 MiB to be logged as 0 MiB due to integer truncation. KiB provides
> better precision for smaller memory regions specified in the Device Tree.
>
> Signed-off-by: Vova Sharaienko <sharaienko@google.com>
Applied to dma-mapping-for-next. Thanks!
> ---
> v1: https://lore.kernel.org/all/20260624000516.597555-1-sharaienko@google.com/
> Addressed feedback from v1: changed %ld to %llu for size in KiB
> to avoid truncation for sizes (which can be 64-bit on a 32-bit kernel)
> larger than 4 GiB.
>
> kernel/dma/coherent.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/dma/coherent.c b/kernel/dma/coherent.c
> index bcdc0f76d2e8..67f9a88ec4fe 100644
> --- a/kernel/dma/coherent.c
> +++ b/kernel/dma/coherent.c
> @@ -69,8 +69,8 @@ static struct dma_coherent_mem *dma_init_coherent_memory(phys_addr_t phys_addr,
> kfree(dma_mem);
> out_unmap_membase:
> memunmap(mem_base);
> - pr_err("Reserved memory: failed to init DMA memory pool at %pa, size %zd MiB\n",
> - &phys_addr, size / SZ_1M);
> + pr_err("Reserved memory: failed to init DMA memory pool at %pa, size %zu KiB\n",
> + &phys_addr, size / SZ_1K);
> return ERR_PTR(-ENOMEM);
> }
>
> @@ -384,8 +384,8 @@ static int __init rmem_dma_setup(unsigned long node, struct reserved_mem *rmem)
> }
> #endif
>
> - pr_info("Reserved memory: created DMA memory pool at %pa, size %ld MiB\n",
> - &rmem->base, (unsigned long)rmem->size / SZ_1M);
> + pr_info("Reserved memory: created DMA memory pool at %pa, size %llu KiB\n",
> + &rmem->base, (unsigned long long)(rmem->size / SZ_1K));
> return 0;
> }
>
> --
> 2.55.0.rc0.799.gd6f94ed593-goog
>
>
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
prev parent reply other threads:[~2026-07-13 7:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20260629223817eucas1p2313aed48a121788c92b6710f63ddb03f@eucas1p2.samsung.com>
2026-06-29 22:37 ` Vova Sharaienko
2026-07-13 7:33 ` Marek Szyprowski [this message]
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=5f49e2c3-a442-4aa3-82da-ffb4ca88fbdb@samsung.com \
--to=m.szyprowski@samsung.com \
--cc=android-mm@google.com \
--cc=iommu@lists.linux.dev \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=sharaienko@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®