mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rik van Riel <riel@surriel.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: linux-kernel@vger.kernel.org, robin.murphy@arm.com,
	joro@8bytes.org,  will@kernel.org, iommu@lists.linux.dev,
	kyle@mcmartin.ca, kernel-team@meta.com,
	 Rik van Riel	 <riel@meta.com>
Subject: Re: [PATCH 5/5] iova: add KUnit test suite
Date: Fri, 15 May 2026 23:20:24 -0400	[thread overview]
Message-ID: <87439b0b88bfa4d4771052090e107d38ae5f0eee.camel@surriel.com> (raw)
In-Reply-To: <20260515224317.GM7702@ziepe.ca>

On Fri, 2026-05-15 at 19:43 -0300, Jason Gunthorpe wrote:
> On Tue, May 12, 2026 at 10:00:22PM -0400, Rik van Riel wrote:
> > From: Rik van Riel <riel@meta.com>
> > 
> > Add a kunit suite for the augmented-rbtree IOVA allocator, plus an
> > iova_domain_verify_invariants() helper (compiled only when the test
> > config is enabled) that walks the tree and confirms every node's
> > gap_to_prev, clamped_gap32, __subtree_max_gap, and
> > __subtree_max_gap32
> > match what recomputation from scratch yields.
> > 
> > Test cases:
> >   - test_init_destroy: domain lifecycle, no leaks.
> >   - test_basic_alloc_free: single alloc/free roundtrip, top-down
> > reuse.
> >   - test_size_aligned: alignment of size_aligned allocs across
> > orders 0..7.
> >   - test_top_down_preference: sequential allocs decrease in pfn_lo.
> >   - test_limit_pfn_respected: 100 allocs all stay <= limit_pfn.
> >   - test_reserve_iova: allocs avoid the reserved range.
> >   - test_find_iova: lookup by pfn returns the right iova.
> >   - test_32bit_in_64bit_domain: 1000 64-bit allocs followed by a
> > 32-bit
> >     alloc must still find a slot below DMA_BIT_MASK(32) --
> > exercises
> >     the __subtree_max_gap32 augmentation.
> >   - test_two_phase_alignment: pack size-2 size_aligned allocs, free
> >     every other; subsequent size-2 alloc must succeed via the
> > phase-2
> >     fallback search since phase-1's S+A-1 threshold prunes the
> > size-2
> >     gaps.
> >   - test_pci_32bit_workaround_pattern: alternate 32-bit-first
> > allocation
> >     attempts with 64-bit fallback, mirroring dma-iommu.c.
> >   - test_stress_random: 2048 random alloc/free operations with
> > mixed
> >     sizes, alignments, and 32/64-bit limits, with periodic
> > invariant
> >     checks.
> > 
> > Each test verifies the augmented invariants both during and after
> > the
> > test run so that any sequencing bug in insert / erase / rotate /
> > propagate is caught at the operation that introduced it.
> > 
> > Tested by: building drivers/iommu/iova.o and drivers/iommu/iova-
> > kunit.o
> > (no warnings); runtime execution requires booting a kernel with
> > CONFIG_IOMMU_IOVA_KUNIT_TEST=y under qemu-system-x86_64 (not
> > available
> > on this devvm).
>     ^^^^^^^^^^^^^^^
> 
> Heh, you should still read the patches when using claude :)
> 
I saw it. Then I got distracted by something else,
and forgot to fix it :/

> Can you add a .kunitconfig please? The tests should run with a
> command like:

I'll address your comments, and also the issues
found by Sashiko. I'll try to get v2 ready within
a week or two.

-- 
All Rights Reversed.

      reply	other threads:[~2026-05-16  3:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13  2:00 [PATCH 0/5] iova augmented rbtree O(log n) alloc_iova Rik van Riel
2026-05-13  2:00 ` [PATCH 1/5] iova: switch to augmented rbtree for log(n) allocation Rik van Riel
2026-05-13  2:00 ` [PATCH 2/5] iova: drop dead cached_node / cached32_node infrastructure Rik van Riel
2026-05-13  2:00 ` [PATCH 3/5] iova: limit_pfn-aware augmentation for log(n) 32-bit alloc Rik van Riel
2026-05-13  2:00 ` [PATCH 4/5] iova: alignment-aware two-phase search for log(n) aligned alloc Rik van Riel
2026-05-13  2:00 ` [PATCH 5/5] iova: add KUnit test suite Rik van Riel
2026-05-15 22:43   ` Jason Gunthorpe
2026-05-16  3:20     ` Rik van Riel [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=87439b0b88bfa4d4771052090e107d38ae5f0eee.camel@surriel.com \
    --to=riel@surriel.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=joro@8bytes.org \
    --cc=kernel-team@meta.com \
    --cc=kyle@mcmartin.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=riel@meta.com \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    /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®