Using kunit to write tests for new work on dmabuf is coming up:
https://lore.kernel.org/all/26-v1-b5cab63049c0+191af-dmabuf_map_type_jgg@nv…
Replace the custom test framework with kunit to avoid maintaining two
concurrent test frameworks.
The conversion minimizes code changes and uses simple pattern-oriented
reworks to reduce the chance of breaking any tests. Aside from adding the
kunit_test_suite() boilerplate, the conversion follows a number of
patterns:
Test failures without cleanup. For example:
if (!ptr)
return -ENOMEM;
Becomes:
KUNIT_ASSERT_NOT_NULL(test, ptr);
In kunit ASSERT longjumps out of the test.
Check for error, fail and cleanup:
if (err) {
pr_err("msg\n");
goto cleanup;
}
Becomes:
if (err) {
KUNIT_FAIL(test, "msg");
goto cleanup;
}
Preserve the existing failure messages and cleanup code.
Cases where the test returns err but prints no message:
if (err)
goto cleanup;
Becomes:
if (err) {
KUNIT_FAIL(test, "msg");
goto cleanup;
}
Use KUNIT_FAIL to retain the 'cleanup on err' behavior.
Overall, the conversion is straightforward.
The result can be run with kunit.py:
$ tools/testing/kunit/kunit.py run --build_dir build_kunit_x86_64 --arch x86_64 --kunitconfig ./drivers/dma-buf/.kunitconfig
[20:37:23] Configuring KUnit Kernel ...
[20:37:23] Building KUnit Kernel ...
Populating config with:
$ make ARCH=x86_64 O=build_kunit_x86_64 olddefconfig
Building with:
$ make all compile_commands.json scripts_gdb ARCH=x86_64 O=build_kunit_x86_64 --jobs=20
[20:37:29] Starting KUnit Kernel (1/1)...
[20:37:29] ============================================================
Running tests with:
$ qemu-system-x86_64 -nodefaults -m 1024 -kernel build_kunit_x86_64/arch/x86/boot/bzImage -append 'kunit.enable=1 console=ttyS0 kunit_shutdown=reboot' -no-reboot -nographic -accel kvm -accel hvf -accel tcg -serial stdio -bios qboot.rom
[20:37:30] ================ dma-buf-resv (5 subtests) =================
[20:37:30] [PASSED] test_sanitycheck
[20:37:30] ===================== test_signaling ======================
[20:37:30] [PASSED] kernel
[20:37:30] [PASSED] write
[20:37:30] [PASSED] read
[20:37:30] [PASSED] bookkeep
[20:37:30] ================= [PASSED] test_signaling ==================
...
[20:37:35] Testing complete. Ran 50 tests: passed: 49, skipped: 1
[20:37:35] Elapsed time: 12.635s total, 0.001s configuring, 6.551s building, 6.017s running
One test that requires two CPUs is skipped since the default VM has a
single CPU and cannot run the test.
All other usual ways to run kunit work as well, and all tests are placed
in a module to provide more options for how they are run.
AI was used to do the large scale semantic search and replaces described
above, then everything was hand checked. AI also deduced the issue with
test_race_signal_callback() in a couple of seconds from the kunit
crash (!!), again was hand checked though I am not so familiar with this
test to be fully certain this is the best answer.
Jason Gunthorpe (5):
dma-buf: Change st-dma-resv.c to use kunit
dma-buf: Change st-dma-fence.c to use kunit
dma-buf: Change st-dma-fence-unwrap.c to use kunit
dma-buf: Change st-dma-fence-chain.c to use kunit
dma-buf: Remove the old selftest
drivers/dma-buf/.kunitconfig | 2 +
drivers/dma-buf/Kconfig | 11 +-
drivers/dma-buf/Makefile | 5 +-
drivers/dma-buf/selftest.c | 167 ---------------
drivers/dma-buf/selftest.h | 30 ---
drivers/dma-buf/selftests.h | 16 --
drivers/dma-buf/st-dma-fence-chain.c | 217 +++++++++----------
drivers/dma-buf/st-dma-fence-unwrap.c | 290 +++++++++++---------------
drivers/dma-buf/st-dma-fence.c | 200 ++++++++----------
drivers/dma-buf/st-dma-resv.c | 145 +++++++------
drivers/gpu/drm/i915/Kconfig.debug | 2 +-
11 files changed, 394 insertions(+), 691 deletions(-)
create mode 100644 drivers/dma-buf/.kunitconfig
delete mode 100644 drivers/dma-buf/selftest.c
delete mode 100644 drivers/dma-buf/selftest.h
delete mode 100644 drivers/dma-buf/selftests.h
base-commit: 41dae5ac5e157b0bb260f381eb3df2f4a4610205
--
2.43.0
On 4/6/26 23:49, Barry Song (Xiaomi) wrote:
> From: Xueyuan Chen <Xueyuan.chen21(a)gmail.com>
>
> Replace the heavy for_each_sgtable_page() iterator in system_heap_do_vmap()
> with a more efficient nested loop approach.
>
> Instead of iterating page by page, we now iterate through the scatterlist
> entries via for_each_sgtable_sg(). Because pages within a single sg entry
> are physically contiguous, we can populate the page array with a in an
> inner loop using simple pointer math. This save a lot of time.
>
> The WARN_ON check is also pulled out of the loop to save branch
> instructions.
>
> Performance results mapping a 2GB buffer on Radxa O6:
> - Before: ~1440000 ns
> - After: ~232000 ns
> (~84% reduction in iteration time, or ~6.2x faster)
Well real question is why do you care about the vmap performance?
That should basically only be used for fbdev emulation (except for VMGFX) and we absolutely don't care about performance there.
Regards,
Christian.
>
> Cc: Sumit Semwal <sumit.semwal(a)linaro.org>
> Cc: Benjamin Gaignard <benjamin.gaignard(a)collabora.com>
> Cc: Brian Starkey <Brian.Starkey(a)arm.com>
> Cc: John Stultz <jstultz(a)google.com>
> Cc: T.J. Mercier <tjmercier(a)google.com>
> Cc: Christian König <christian.koenig(a)amd.com>
> Signed-off-by: Xueyuan Chen <Xueyuan.chen21(a)gmail.com>
> Signed-off-by: Barry Song (Xiaomi) <baohua(a)kernel.org>
> ---
> drivers/dma-buf/heaps/system_heap.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/dma-buf/heaps/system_heap.c b/drivers/dma-buf/heaps/system_heap.c
> index b3650d8fd651..769f01f0cc96 100644
> --- a/drivers/dma-buf/heaps/system_heap.c
> +++ b/drivers/dma-buf/heaps/system_heap.c
> @@ -224,16 +224,21 @@ static void *system_heap_do_vmap(struct system_heap_buffer *buffer)
> int npages = PAGE_ALIGN(buffer->len) / PAGE_SIZE;
> struct page **pages = vmalloc(sizeof(struct page *) * npages);
> struct page **tmp = pages;
> - struct sg_page_iter piter;
> void *vaddr;
> + u32 i, j, count;
> + struct page *base_page;
> + struct scatterlist *sg;
>
> if (!pages)
> return ERR_PTR(-ENOMEM);
>
> - for_each_sgtable_page(table, &piter, 0) {
> - WARN_ON(tmp - pages >= npages);
> - *tmp++ = sg_page_iter_page(&piter);
> + for_each_sgtable_sg(table, sg, i) {
> + base_page = sg_page(sg);
> + count = sg->length >> PAGE_SHIFT;
> + for (j = 0; j < count; j++)
> + *tmp++ = base_page + j;
> }
> + WARN_ON(tmp - pages != npages);
>
> vaddr = vmap(pages, npages, VM_MAP, PAGE_KERNEL);
> vfree(pages);
On Thu, Apr 2, 2026 at 7:11 AM Jiri Pirko <jiri(a)resnulli.us> wrote:
>
> From: Jiri Pirko <jiri(a)nvidia.com>
>
> Document the system_cc_shared dma-buf heap that was introduced
> recently. Describe its purpose, availability conditions and
> relation to confidential computing VMs.
>
> Signed-off-by: Jiri Pirko <jiri(a)nvidia.com>
> ---
> Documentation/userspace-api/dma-buf-heaps.rst | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/Documentation/userspace-api/dma-buf-heaps.rst b/Documentation/userspace-api/dma-buf-heaps.rst
> index 05445c83b79a..591732393e7d 100644
> --- a/Documentation/userspace-api/dma-buf-heaps.rst
> +++ b/Documentation/userspace-api/dma-buf-heaps.rst
> @@ -16,6 +16,14 @@ following heaps:
>
> - The ``system`` heap allocates virtually contiguous, cacheable, buffers.
>
> + - The ``system_cc_shared`` heap allocates virtually contiguous, cacheable,
> + buffers using shared (decrypted) memory. It is only present on
> + confidential computing (CoCo) VMs where memory encryption is active
> + (e.g., AMD SEV, Intel TDX). The allocated pages have the encryption
> + bit cleared, making them accessible for device DMA without TDISP
> + support. On non-CoCo VMs configurations, this heap is
"non-CoCo VM configurations"
> + not registered.
Doesn't seem like you need to wrap this line.
with that: Reviewed-by: T.J.Mercier <tjmercier(a)google.com>
> +
> - The ``default_cma_region`` heap allocates physically contiguous,
> cacheable, buffers. Only present if a CMA region is present. Such a
> region is usually created either through the kernel commandline
Each paragraph starting with '-' confused me for a second there. Those
aren't part of the diff. :)
Safeguard is not just another name in the crowded field of cryptocurrency recovery; they are renowned for their effectiveness and expertise in tracing lost funds. Their team comprises skilled professionals who understand the intricate workings of blockchain technology and the tactics employed by online scammers. This specialized knowledge enables them to devise tailored strategies to recover your assets.
Email,.. safeguardbitcoin(a)consultant.com
WhatsApp,.. +44 7426 168300
Web:., https://safeguardbitcoin.wixsite.com/safeguard-bitcoin--1
Don't worry, TREK Tech Corp is here to help you get your lost coins back. Our expert team specializes in recovering funds from fraudulent schemes and can assist you in reclaiming what is rightfully yours. Contact us today for a free consultation and let us help you get back on track. Don't let scammers hold you back any longer, trust TREK Tech Corp to help you recover your lost funds.
Contact email: trektechcorp1(a)gmail.com / trektechcorp(a)consultant.com.
In the volatile world of cryptocurrency, where billions are lost annually to scams, hacks, phishing attacks, rug pulls, and wallet compromises, the demand for legitimate recovery services has never been higher. As of 02/ 22/ 2026, victims often face a dual challenge: recovering stolen or inaccessible funds while avoiding secondary scams that prey on desperation with false promises and upfront fees. Amid this landscape, TREK Tech Corp—commonly referred to as CCS—has established itself as a credible, professional firm specializing in blockchain forensics, crypto asset tracing, fraud investigation, and realistic recovery support.
TREK Tech Corp operates with a foundation built on 14 years of experience in digital investigations, long predating the widespread adoption of cryptocurrencies. This extensive background in forensics gives CCS a significant edge over many newer entrants in the crypto recovery space. The firm focuses on helping individuals, families, and institutions trace lost or stolen digital assets using advanced, transparent methods rather than speculative or guaranteed outcomes. Their official website is https://www.trektechcorp.net, and direct inquiries can be sent to trektechcorp1(a)gmail.com.
What sets TREK Tech Corp apart as a legitimate provider is its commitment to ethical standards and evidence-based processes. Unlike fraudulent recovery operations that demand large upfront payments without case evaluation or promise 100% success (a clear red flag in the industry), CCS conducts honest feasibility assessments from the outset. They never require clients to share private keys, seed phrases, or sensitive wallet credentials during initial consultations. Fees are typically aligned with outcomes, and the firm maintains strict confidentiality with robust data protection protocols.
The core of TREK Tech Corp’ service is multi-layer blockchain attribution—a proprietary technique that tracks funds through complex laundering paths. Scammers frequently use mixers, cross-chain bridges, decentralized exchanges, privacy protocols, flash-loan obfuscation, and automated smart-contract tumbling to break direct traceability. Basic block explorers lose visibility after one or two hops, but CCS reconstructs these movements by analyzing on-chain behavioral patterns: timing correlations, amount similarities, address clustering via co-spending heuristics, change address reuse, and interactions with known services.
A typical engagement begins with a secure intake process. Victims submit transaction hashes (TXIDs), wallet addresses, scam communications, screenshots, and timelines. TREK Tech Corp then performs comprehensive on-chain and off-chain analysis, building detailed transaction graphs and identifying probable endpoints—most commonly centralized exchanges that enforce KYC/AML compliance. When funds reach such platforms, CCS prepares evidence-grade forensic reports that include visualized flow diagrams, confidence-scored address clusters, identified laundering techniques, and recommended intervention steps. These reports are frequently used to support asset freeze requests submitted to exchange compliance teams or filed with law enforcement agencies such as the FBI’s Internet Crime Complaint Center (IC3), local cybercrime units, or financial regulators.
TREK Tech Corp emphasizes speed: the sooner a theft is reported and analyzed, the higher the chance of intervention before funds are fully dispersed. In cases where rapid action was taken, partial recoveries—often 70–90% of stolen amounts—have been achieved through coordinated freezes and subsequent legal processes. While full recovery is never guaranteed due to blockchain’s immutable design and variables like scammer sophistication and jurisdictional limits, CCS provides clear, realistic expectations from day one.
Beyond recovery support, TREK Tech Corp prioritizes victim education and prevention. Clients receive tailored guidance on hardening security: using hardware wallets, enabling strong multi-factor authentication, securely backing up seed phrases in multiple encrypted locations, verifying addresses before every transfer, monitoring wallet activity proactively, and recognizing emerging threats such as AI-enhanced impersonation scams, clipboard hijacking, or malicious browser extensions. This preventive focus helps reduce the likelihood of future incidents and empowers users in an environment where threats evolve rapidly.
The firm’s legitimacy is further reinforced by its performance metrics and client feedback. As of early 2026, TREK Tech Corp has successfully handled over 426 documented projects and maintains a 4.28 out of 5 rating based on more than 2,467 verified reviews. Clients consistently highlight the team’s professionalism, technical precision, clear communication, regular updates, and genuine support during high-stress situations. In an industry rife with advance-fee fraud and misleading marketing, CCS stands out for refusing high-pressure tactics, avoiding unrealistic guarantees, and focusing on evidence-driven results.
For anyone who has suffered a crypto loss—whether through a sophisticated scam, forgotten credentials, hardware failure, or inheritance complications—TREK Tech Corp offers a professional, confidential pathway forward. Their website, https://www.trektechcorp.net, provides in-depth information about services, the investigation process, anonymized case examples, and how to initiate contact. Direct email communication is available at trektechcorp1(a)gmail.com for a no-obligation initial consultation.
In conclusion, legitimate crypto recovery requires expertise, transparency, and ethical conduct—qualities TREK Tech Corp consistently demonstrates. While blockchain’s architecture limits reversals, CCS leverages decades of investigative rigor, advanced multi-layer attribution, and strategic coordination to deliver clarity, evidence, and realistic recovery opportunities. In 2026’s high-risk digital asset environment, partnering with a reputable firm like TREK Tech Corp can make the critical difference between permanent loss and meaningful progress toward reclamation and renewed security.
Safeguard is not just another name in the crowded field of cryptocurrency recovery; they are renowned for their effectiveness and expertise in tracing lost funds. Their team comprises skilled professionals who understand the intricate workings of blockchain technology and the tactics employed by online scammers. This specialized knowledge enables them to devise tailored strategies to recover your assets.
Email,.. safeguardbitcoin(a)consultant.com
WhatsApp,.. +44 7426 168300
Web:., https://safeguardbitcoin.wixsite.com/safeguard-bitcoin--1
Safeguard is not just another name in the crowded field of cryptocurrency recovery; they are renowned for their effectiveness and expertise in tracing lost funds. Their team comprises skilled professionals who understand the intricate workings of blockchain technology and the tactics employed by online scammers. This specialized knowledge enables them to devise tailored strategies to recover your assets.
Email,.. safeguardbitcoin(a)consultant.com
WhatsApp,.. +44 7426 168300
Web:., https://safeguardbitcoin.wixsite.com/safeguard-bitcoin--1