From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: dma: contiguous: Turn heap registration logic around
Date: Wed, 01 Apr 2026 07:50:36 +1000 [thread overview]
Message-ID: <review-patch1-20260331-dma-buf-heaps-as-modules-v4-1-e18fda504419@kernel.org> (raw)
In-Reply-To: <20260331-dma-buf-heaps-as-modules-v4-1-e18fda504419@kernel.org>
Patch Review
This is the core architectural change. It moves the CMA area tracking array from `cma_heap.c` into `contiguous.c` and provides `dma_contiguous_get_area_by_idx()` as an iterator for the heap to use.
**Potential duplicate default CMA area issue:**
In `rmem_cma_setup()`, the patch inserts **every** CMA area (including one marked `linux,cma-default`) into `dma_contiguous_areas[]` via `dma_contiguous_insert_area()`. Then in `dma_contiguous_reserve()`, if `!dma_contiguous_default_area`, it creates a default area and **also** inserts it.
On the consumer side in `add_cma_heaps()`:
```c
if (default_cma) {
ret = __add_cma_heap(default_cma, DEFAULT_CMA_NAME);
...
}
for (i = 0; (cma = dma_contiguous_get_area_by_idx(i)) != NULL; i++) {
ret = __add_cma_heap(cma, cma_get_name(cma));
```
When the default CMA area comes from the DT (`rmem_cma_setup` sets `dma_contiguous_default_area` AND inserts it), the loop will encounter it again. `__add_cma_heap` will attempt to create a second heap for the same CMA region. This was **already** the case in the old code (the original `dma_areas[]` had the same issue), so this patch doesn't introduce a regression -- but it would be good to add a check in the loop to skip the default area:
```c
for (i = 0; (cma = dma_contiguous_get_area_by_idx(i)) != NULL; i++) {
if (cma == default_cma)
continue;
```
Wait -- looking more carefully at the old code, the original `add_cma_heaps()` also iterated `dma_areas[]` which included the default area registered by `rmem_cma_setup()`. So this is pre-existing behavior. The `dma_heap_add()` call presumably handles or rejects duplicates. Still worth a comment.
The comment block added in `dma_contiguous_reserve()` is well-written and explains the non-DT case clearly.
**Minor:** `dma_contiguous_areas` is not `__initdata` unlike the old `dma_areas` in `cma_heap.c`. This is correct since it's now accessed at module load time (not just `__init`), but worth noting that this adds a small permanent memory cost for the array (up to `MAX_CMA_AREAS` pointers).
No other issues.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-03-31 21:50 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20260331100026eucas1p19bdc2aaca4c9a48c6f6ac8fec71478d8@eucas1p1.samsung.com>
2026-03-31 10:00 ` [PATCH v4 0/8] dma-buf: heaps: Turn heaps into modules Maxime Ripard
2026-03-31 10:00 ` [PATCH v4 1/8] dma: contiguous: Turn heap registration logic around Maxime Ripard
2026-03-31 21:50 ` Claude Code Review Bot [this message]
2026-03-31 10:00 ` [PATCH v4 2/8] dma: contiguous: Make dev_get_cma_area() a proper function Maxime Ripard
2026-03-31 21:50 ` Claude review: " Claude Code Review Bot
2026-03-31 10:00 ` [PATCH v4 3/8] dma: contiguous: Make dma_contiguous_default_area static Maxime Ripard
2026-03-31 21:50 ` Claude review: " Claude Code Review Bot
2026-03-31 10:00 ` [PATCH v4 4/8] dma: contiguous: Export dev_get_cma_area() Maxime Ripard
2026-03-31 21:50 ` Claude review: " Claude Code Review Bot
2026-03-31 10:00 ` [PATCH v4 5/8] mm: cma: Export cma_alloc(), cma_release() and cma_get_name() Maxime Ripard
2026-03-31 21:50 ` Claude review: " Claude Code Review Bot
2026-03-31 10:00 ` [PATCH v4 6/8] dma-buf: heaps: Export mem_accounting parameter Maxime Ripard
2026-03-31 21:50 ` Claude review: " Claude Code Review Bot
2026-03-31 10:00 ` [PATCH v4 7/8] dma-buf: heaps: cma: Turn the heap into a module Maxime Ripard
2026-03-31 21:50 ` Claude review: " Claude Code Review Bot
2026-03-31 10:00 ` [PATCH v4 8/8] dma-buf: heaps: system: " Maxime Ripard
2026-03-31 21:50 ` Claude review: " Claude Code Review Bot
2026-03-31 12:54 ` [PATCH v4 0/8] dma-buf: heaps: Turn heaps into modules Marek Szyprowski
2026-03-31 21:50 ` Claude review: " Claude Code Review Bot
2026-03-03 10:13 [PATCH v3 0/8] " Maxime Ripard
2026-03-03 10:13 ` [PATCH v3 1/8] dma: contiguous: Turn heap registration logic around Maxime Ripard
2026-03-03 21:41 ` Claude review: " Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-02-25 16:41 [PATCH 0/7] dma-buf: heaps: Turn heaps into modules Maxime Ripard
2026-02-25 16:41 ` [PATCH 1/7] dma: contiguous: Turn heap registration logic around Maxime Ripard
2026-02-27 3:12 ` Claude review: " Claude Code Review Bot
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=review-patch1-20260331-dma-buf-heaps-as-modules-v4-1-e18fda504419@kernel.org \
--to=claude-review@example.com \
--cc=dri-devel-reviews@example.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