From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D839C3E5A30 for ; Wed, 24 Jun 2026 21:17:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782335824; cv=none; b=lekKUU7X/5IRvufIYDPv1R9+mIweYVKGEI2YBTbn7f8zyegNzZ60qB2C+yABO+OkSGUI8YFl5sxZakk08uJxEAgsm+AChifyLJDgVAEiH97MxYqDZN1tWVgyblyEK1cx49B+xtE2uRE5MyXqgmlKsl6LPL4vDLzqj8AGno7DNlc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782335824; c=relaxed/simple; bh=btByfG8J/O/uHq+arR9tAyc/e4eUAeVa41QUMNs0ipY=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=OMGNg6zVUU9vRwNKGuCaVQ6Ii0+rcRq0PbgvRvJVI1CaWw0QC0qujRLvVe6pwFleB+AgPj6j/vjpungHgh7OQdtGq4MZSrNjIzt/S7PPFuSNpp/+xQip8/+7k3S7YMb6Srs1XWism2hSjPeZ3LAMFXF2yz2dukZbOaykGya9iBU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--sharaienko.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=pREl56OS; arc=none smtp.client-ip=209.85.215.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--sharaienko.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="pREl56OS" Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-c892143db7fso878443a12.1 for ; Wed, 24 Jun 2026 14:17:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782335822; x=1782940622; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=V286S8A78/gcYLSjq3uOi4CPB9ZMdA6ZUDnrzrYWuWA=; b=pREl56OSfCAQFSLT/jm0mR6z9/30bkAcwL6GfNSZMSN/goM0Qvuo/7JH1bXT0cIjGH mLt0XJ4j3fL+qR3Cr71W1M3p+m3sXpc97uXJY2OYV65Pt209HQhUMXBM3UNl3HCxrOJQ OkKK3RWT3Tq/t74JFSR/NMt72JxvFN/NrRjtZJXArmC867mPGyVAu6pD7TxrMy7qvvCh S+PfkJHMif0ui8CwDY7bxDavcXCphsnCkEBw3MpAV21vWfx47XWm7zMZ3a7mf9xGCuOp oM6MmCIxmaAQJYeirKfOWHpji0iJFMJY5oP8gUosZk2UzCvOHtfnHuneOLR7fz8lNuEp 70CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782335822; x=1782940622; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=V286S8A78/gcYLSjq3uOi4CPB9ZMdA6ZUDnrzrYWuWA=; b=cbFIHiLMKXS6qpnblME4CGnJo9px9WL3G4xpY7xuFFQypZE5bwQjzbjjLtEp8x1Jdj 0yfyp/8PfKRZ57CCPM1a+lRfy2xozGmz4vKJI/69Nui8rLS3VU+pae85bY7iSudDCKTx tJ7VBin29/b+Vx8losRW6alVhn7MdKOK6uFgRPyRGA4uX/sySHx3FLeGdBj/l8oD7gHh QEHW6xuZ/kegL0aPRlRJ1uOFHD6p9PzMzNyqumYnyTwTENDVK/FgynN6xKLfSyKZ9l9f KJPeu9xU2WvAx7QVgWygAb66KuwMeyEoM3FJbDZF1p0LtViG8PFI1W8fHVMIKwzrB9p9 Bvmg== X-Forwarded-Encrypted: i=1; AFNElJ/oxFT0pWysT3ZN4ZxCNk0eB9cthitpnXRbyEvAaOqs1Hmm5RPAovqBIT+t4sF4JluaCrpDO01m3n6FFMA=@vger.kernel.org X-Gm-Message-State: AOJu0Yy1bon5yOb3f5+6ClO3fFd/eCAfOXeiTNk7a2tyGVMQkBKWZcjE aq9XiKjsNxK3sxl8EKNcKm/E5vkhTvmaw1zSWui+K+UabylM/wLGvoMlUoialr9QKZoi6Vc34XB BmJ7u/XHB92cHSpurjTjX7A== X-Received: from pgbfm22.prod.google.com ([2002:a05:6a02:4996:b0:c89:c57:f58]) (user=sharaienko job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a20:9e4a:b0:3b3:fdb0:229a with SMTP id adf61e73a8af0-3bd2d045a4emr5967027637.1.1782335821550; Wed, 24 Jun 2026 14:17:01 -0700 (PDT) Date: Wed, 24 Jun 2026 21:16:45 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.55.0.rc0.799.gd6f94ed593-goog Message-ID: <20260624211646.1674041-1-sharaienko@google.com> Subject: [RFC PATCH v2] dma-coherent: use KiB in DMA allocation logs From: Vova Sharaienko To: Marek Szyprowski , Robin Murphy Cc: android-mm@google.com, Vova Sharaienko , kernel-team@android.com, iommu@lists.linux.dev, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" We are proposing to 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. This is currently marked as an RFC because we would like feedback on a KiB unit change. Signed-off-by: Vova Sharaienko --- 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