Thread (59 messages) 59 messages, 6 authors, 2022-12-06

Re: [PATCH v5 08/19] iommufd: PFN handling for iopt_pages

From: Jason Gunthorpe <jgg@nvidia.com>
Date: 2022-11-18 02:27:35
Also in: bpf, kvm, linux-iommu, linux-kselftest, llvm

On Fri, Nov 18, 2022 at 02:24:23AM +0000, Tian, Kevin wrote:
quoted hunk ↗ jump to hunk
quoted
From: Jason Gunthorpe <jgg@nvidia.com>
Sent: Thursday, November 17, 2022 5:01 AM
+static void batch_skip_carry(struct pfn_batch *batch, unsigned int skip_pfns)
+{
+	if (!batch->total_pfns)
+		return;
+	skip_pfns = min(batch->total_pfns, skip_pfns);
+	batch->pfns[0] += skip_pfns;
+	batch->npfns[0] -= skip_pfns;
+	batch->total_pfns -= skip_pfns;
+}
You forgot to add the assertion which you replied to v4:
@@ -239,6 +239,8 @@ static void batch_skip_carry(struct pfn_batch *batch, unsigned int skip_pfns)
 {
        if (!batch->total_pfns)
                return;
+       if (IS_ENABLED(CONFIG_IOMMUFD_TEST))
+               WARN_ON(batch->total_pfns != batch->npfns[0]);
        skip_pfns = min(batch->total_pfns, skip_pfns);
All the IS_ENABLED assertions are together in a later patch

Thanks,
Jason
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help