From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.43 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793116046; b=mCqZtAe3uvKU1zChoPBJch+wpaG62ChrN7Zs46ttE2Z1F7NwGIEyx5xz0Vxg47RBIFS6 jlPaLy2OBVAxYkWiwXE2jW4XLaxD+3qAJaiZhaQao1FXibg2UBTJWFGdAcqOk36qdv0mV cOuXouqp8jmS7Loj2qywnmaxZLYeaBa8Minv6NzP1IapMvIKlWqkxsrXzTirHED/VUjCY Ml0bhJXNGd+xNiBQQOvAiZI9AuqqeJCP4BDpSwonVAPSc8gyMwc/KUnBggFAVS8l8AgkO WLOZky7EpqkbmzmeEBtEexeKQhsgfwKuV6zyIKHi0uU2mhPMZtzfuofDWgGy+9QWalA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793116046; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=sPt0JYZ7MHrW6GDHRZTQpzJzKe8DOikeeLCfWsSdkp8=; b=Y08NzWPq+ph8kZLBaqkwIAtpKuIueLkqO6elWrWHUsqdIdAirpAHctfgBIaj0rnrjvE/ qJNsJvZr5pdI+8vF+kgUbUmOu7CWZrUmi+X8KUPaLlWr2KaXzcae9PzxvbloH2kw17Aya jq0aYGMUGEGCzNBxIs7FljE6vG+Oa2Gn8mZFIXW8A3YWVbDzbKzvZ9Klh6nqjbDW7aw3R lUQUoRoProEGeLT9DHG8Zzhbdwn2wDkUSadXtIlVwQ2Z6h76GAO4P4P7VMerr9DeFnG3L Uve6gxbyTXnu0VoCUoazEWghWwfTJhWsgyYJt/hzAhUOl1d96fFcuOI46xGM8kwExJg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=kcw83T2n; arc=none smtp.remote-ip=209.85.208.43 Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B884606FCA0 for ; Tue, 27 Oct 2026 15:47:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1B884606FCA0 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=kcw83T2n Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-6b1f4d8e09aso59921a12.1 for ; Tue, 27 Oct 2026 08:47:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793116044; x=1793720844; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=sPt0JYZ7MHrW6GDHRZTQpzJzKe8DOikeeLCfWsSdkp8=; b=kcw83T2nSkaEyFHSng80RnkSjKzv3U+mry1J7Kdql6n0+BAOG4epCHiZeNBiXv/S+3 thQxVZfhVGUoq0E+R3hvDAMUYYUmSNEaXtnQe5cbIJm8wz2dqwmRTPrenlDtCpevDI+p GX2DKsWzkdHx11I3VtTTP0yuULWjVfK5byS+HDevI2sEip2DIH0ow4B6mE1sv3QQ72N5 3sscYKwx1Xuz+TN3bbhWCqfqYhYQq4pcorr6tlacTy0OP5R7PCChI0mz1SBVAdvCj6vM e5oXSpY5pK+d45Dul3tVIGmZ7a1O9OxWUOmvLepM1Ri2FgA+LAZYPuL6QJB4Ovjhw1KW SsZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793116044; x=1793720844; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=sPt0JYZ7MHrW6GDHRZTQpzJzKe8DOikeeLCfWsSdkp8=; b=fg+KkKWz4V0fGYf5z3seOmwUs/NhGLaLqf8wq2bpHka2Vk2V6ABZzlt+XtfD9cA+4d DBs5xMDRYTl7hbjLoR9usmvFGSe8jUnkWUef8Qovwd/gCAi+f5haoagfU6DWHGCC2dVU E1hY72ewF5anRpXOHONFefBbvuoH8KqkUQsQfHJAj4mj7J9nufwjcngFq0hDXOCIYePm vv1TdQo7cFiAYy7tD1iW9665LHK8pCusP3Lu14xj8o7hh35yAICbRnZ9qbdfYELzkOdQ 3vENDXL2jXmbXdQWeOhMwPbeLOORIIRZAsKXYXReqMI9GJeLfBLfDOk3Pwbku3LcqLlG 2XOQ== X-Forwarded-Encrypted: i=1; AKwUvByYgNhWsGKweBr5CG2JoUCbWWl0YC8kXabZnuc5e0hWQlimQUAK2fdydHv8jmOWe3+vUDg=@vger.kernel.org X-Gm-Message-State: AFq9FYJlDWT8EcPE7TtcY6z2oxA9l+7EvL7wMWuIvyZ7QpwyKdOPsEfu K5L0hngYgDT/nLxz2w1twYi07/nGIiAfe5uqcItBJ4YsnlrtdQQDVmzr X-Gm-Gg: AYBFou10xMgnHes+5UtIeZE8j2NjdqD5NsPk2w/WhlsUF2NrwshTvW6K48ZwkGikEAy 3ttkVFCiwAzCRdNCKKZiX6wVkIFMzme/IIJFzspx93eBG0vhb/4NC9FeAsVVEKHS62aXaHFrrnP qK9tdGpAP9745xtBJKfvTMu4gsmxN3cIKWSE1eP4341TOhRpeMAr87cBGjt4PqELmwgblIOyYx6 bEXxZ/dTL1/uI571oN77isxx5p3zbjLAcj8l/4tocbwoBfGz6odCoAUY+lk1zBwr3hMeeX+FMez p9CfDIlI6czArKlvP4G8KLwk3BVTtsArxZHwSUtey7ETIoCGpI0YNlcLCsrD4NfOo1XeYFW05lk vqKjHCRfHS4FuYtZOKkGCW8Po+/OnMmzB7fPL3286WN8wytt18Bsn3BLeI8GMQwIcY92Yt/eLU2 98K6h+euudBTelv1/dtfq4vgjJLaNeNFeqnz/DsiyACvXjj/y7vFBgTtJFzlNrFmf7e0vAhNrXh O1rwiqgactvknsYHGprTXwhNhn1xHr9JjqxEJWZwm2q+lWavX1c+r/HwKzfBdYEKEm4LtgctEFs /jXD6U3bUWk+6nFcs5P1Dhep3F6ByKgb2shCuq5J3UF1ZaO11cegkHq/ERFZ0CnC2xeuZ4IorGc uoyxpZOAGG9F2t1VU X-Received: by 2002:a05:600c:8183:b0:4a2:8c5:5f2 with SMTP id 5b1f17b1804b1-4a35ac99b41mr172717785e9.5.1793116032487; Tue, 27 Oct 2026 08:47:12 -0700 (PDT) Received: from dev-dsk-fgriffo-1c-93421965.eu-west-1.amazon.com (54-240-197-234.amazon.com. [54.240.197.234]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e3ebcb958sm23845574f8f.21.2026.10.27.08.47.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Oct 2026 08:47:11 -0700 (PDT) From: Fred Griffoul To: Ackerley Tng , Paolo Bonzini , Sean Christopherson , Jason Gunthorpe , Kevin Tian Cc: Alex Williamson , Alexander Graf , Alexander Viro , Alexey Kardashevskiy , Andrew Morton , "Aneesh Kumar K . V" , Ashish Kalra , Baolin Wang , Baolu Lu , Bill Wendling , Borislav Petkov , Catalin Marinas , Christian Brauner , =?UTF-8?q?Christian=20K=C3=B6nig?= , Connor Williamson , Dave Hansen , Dave Jiang , David Hildenbrand , David Rientjes , David Woodhouse , Erdem Aktas , Frank van der Linden , Gregory Price , "H . Peter Anvin" , Hugh Dickins , Ingo Molnar , Jacob Pan , James Houghton , Jan Kara , Jianxiong Gao , Joerg Roedel , Joey Gouly , John Starks , Jonathan Corbet , Justin Stitt , Lorenzo Stoakes , Marc Zyngier , Michael Roth , Mike Rapoport , Nathan Chancellor , Nick Desaulniers , Nicolin Chen , Oliver Upton , Pratyush Yadav , Randy Dunlap , Robin Murphy , Samiullah Khawaja , Shuah Khan , Steffen Eiden , Steven Price , Suzuki K Poulose , Tarun Sahu , Thomas Gleixner , Tom Lendacky , Tycho Andersen , Vishal Annapurve , Vlastimil Babka , Will Deacon , Xu Yilun , Yan Zhao , Zenghui Yu , x86@kernel.org, Shuah Khan , Fuad Tabba , kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, llvm@lists.linux.dev, iommu@lists.linux.dev Subject: [RFC PATCH 08/14] iommufd: Track the domains of revocable pages in struct iopt_pages Date: Tue, 27 Oct 2026 15:46:43 +0000 Message-ID: <20261027154649.91571-9-griffoul@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261027154649.91571-1-griffoul@gmail.com> References: <20261022-gmem-alternative-providers-v2-0-5dd1dc6c660a@google.com> <20261027154649.91571-1-griffoul@gmail.com> X-Mailing-List: kvm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Fred Griffoul guest_memfd pages, like dma-buf pages, can be taken away from iommufd whatever references it holds, but the list of (area, domain) pairs to unmap on a revoke lives in struct iopt_pages_dmabuf. Move it to struct iopt_pages, rename the iopt_dmabuf_*track* helpers to iopt_pages_*, and add iopt_pages_tracked() for the page types that need it, so that other page types can use it. No functional change. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Fred Griffoul --- drivers/iommu/iommufd/io_pagetable.c | 24 +++++----- drivers/iommu/iommufd/io_pagetable.h | 33 +++++++++----- drivers/iommu/iommufd/pages.c | 67 ++++++++++++++-------------- 3 files changed, 67 insertions(+), 57 deletions(-) diff --git a/drivers/iommu/iommufd/io_pagetable.c b/drivers/iommu/iommufd/io_pagetable.c index 4e447ce74cf6..43d518e4ce58 100644 --- a/drivers/iommu/iommufd/io_pagetable.c +++ b/drivers/iommu/iommufd/io_pagetable.c @@ -1086,14 +1086,14 @@ static void iopt_unfill_domain(struct io_pagetable *iopt, WARN_ON(!area->storage_domain); if (area->storage_domain == domain) area->storage_domain = storage_domain; - if (iopt_is_dmabuf(pages)) { + if (iopt_pages_tracked(pages)) { if (!iopt_dmabuf_revoked(pages)) iopt_area_unmap_domain(area, domain); - iopt_dmabuf_untrack_domain(pages, area, domain); + iopt_pages_untrack_domain(pages, area, domain); } mutex_unlock(&pages->mutex); - if (!iopt_is_dmabuf(pages)) + if (!iopt_pages_tracked(pages)) iopt_area_unmap_domain(area, domain); } return; @@ -1111,8 +1111,8 @@ static void iopt_unfill_domain(struct io_pagetable *iopt, WARN_ON(area->storage_domain != domain); area->storage_domain = NULL; iopt_area_unfill_domain(area, pages, domain); - if (iopt_is_dmabuf(pages)) - iopt_dmabuf_untrack_domain(pages, area, domain); + if (iopt_pages_tracked(pages)) + iopt_pages_untrack_domain(pages, area, domain); mutex_unlock(&pages->mutex); } } @@ -1143,15 +1143,15 @@ static int iopt_fill_domain(struct io_pagetable *iopt, continue; guard(mutex)(&pages->mutex); - if (iopt_is_dmabuf(pages)) { - rc = iopt_dmabuf_track_domain(pages, area, domain); + if (iopt_pages_tracked(pages)) { + rc = iopt_pages_track_domain(pages, area, domain); if (rc) goto out_unfill; } rc = iopt_area_fill_domain(area, domain); if (rc) { - if (iopt_is_dmabuf(pages)) - iopt_dmabuf_untrack_domain(pages, area, domain); + if (iopt_pages_tracked(pages)) + iopt_pages_untrack_domain(pages, area, domain); goto out_unfill; } if (!area->storage_domain) { @@ -1180,8 +1180,8 @@ static int iopt_fill_domain(struct io_pagetable *iopt, area->storage_domain = NULL; } iopt_area_unfill_domain(area, pages, domain); - if (iopt_is_dmabuf(pages)) - iopt_dmabuf_untrack_domain(pages, area, domain); + if (iopt_pages_tracked(pages)) + iopt_pages_untrack_domain(pages, area, domain); mutex_unlock(&pages->mutex); } return rc; @@ -1393,7 +1393,7 @@ static int iopt_area_split(struct iopt_area *area, unsigned long iova) return -EBUSY; /* Maintaining the domains_itree below is a bit complicated */ - if (iopt_is_dmabuf(pages)) + if (iopt_pages_tracked(pages)) return -EOPNOTSUPP; if (new_start & (alignment - 1) || diff --git a/drivers/iommu/iommufd/io_pagetable.h b/drivers/iommu/iommufd/io_pagetable.h index 27e3e311d395..0dddfb5db5fd 100644 --- a/drivers/iommu/iommufd/io_pagetable.h +++ b/drivers/iommu/iommufd/io_pagetable.h @@ -70,15 +70,14 @@ void iopt_area_unfill_domain(struct iopt_area *area, struct iopt_pages *pages, void iopt_area_unmap_domain(struct iopt_area *area, struct iommu_domain *domain); -int iopt_dmabuf_track_domain(struct iopt_pages *pages, struct iopt_area *area, - struct iommu_domain *domain); -void iopt_dmabuf_untrack_domain(struct iopt_pages *pages, - struct iopt_area *area, - struct iommu_domain *domain); -int iopt_dmabuf_track_all_domains(struct iopt_area *area, - struct iopt_pages *pages); -void iopt_dmabuf_untrack_all_domains(struct iopt_area *area, - struct iopt_pages *pages); +int iopt_pages_track_domain(struct iopt_pages *pages, struct iopt_area *area, + struct iommu_domain *domain); +void iopt_pages_untrack_domain(struct iopt_pages *pages, struct iopt_area *area, + struct iommu_domain *domain); +int iopt_pages_track_all_domains(struct iopt_area *area, + struct iopt_pages *pages); +void iopt_pages_untrack_all_domains(struct iopt_area *area, + struct iopt_pages *pages); static inline unsigned long iopt_area_index(struct iopt_area *area) { @@ -194,7 +193,8 @@ enum iopt_address_type { IOPT_ADDRESS_DMABUF, }; -struct iopt_pages_dmabuf_track { +/* One (area, domain) mapping of revocable pages, on iopt_pages::tracker. */ +struct iopt_pages_track { struct iommu_domain *domain; struct iopt_area *area; struct list_head elm; @@ -205,7 +205,6 @@ struct iopt_pages_dmabuf { struct phys_vec phys; /* Always PAGE_SIZE aligned */ unsigned long start; - struct list_head tracker; }; /* @@ -246,6 +245,12 @@ struct iopt_pages { struct rb_root_cached access_itree; /* Of iopt_area::pages_node */ struct rb_root_cached domains_itree; + /* + * Of iopt_pages_track::elm. The owner of these pages can revoke them + * whatever references iommufd holds, so every (area, domain) that + * maps them is listed here for the revoke. See iopt_pages_tracked(). + */ + struct list_head tracker; }; static inline bool iopt_is_dmabuf(struct iopt_pages *pages) @@ -255,6 +260,12 @@ static inline bool iopt_is_dmabuf(struct iopt_pages *pages) return pages->type == IOPT_ADDRESS_DMABUF; } +/* The owner of the pages can revoke them, so their domains are tracked. */ +static inline bool iopt_pages_tracked(struct iopt_pages *pages) +{ + return iopt_is_dmabuf(pages); +} + static inline bool iopt_dmabuf_revoked(struct iopt_pages *pages) { lockdep_assert_held(&pages->mutex); diff --git a/drivers/iommu/iommufd/pages.c b/drivers/iommu/iommufd/pages.c index 404f31d8f729..cf0f08c4e9a6 100644 --- a/drivers/iommu/iommufd/pages.c +++ b/drivers/iommu/iommufd/pages.c @@ -1384,6 +1384,7 @@ static struct iopt_pages *iopt_alloc_pages(unsigned long start_byte, pages->npages = DIV_ROUND_UP(length + start_byte, PAGE_SIZE); pages->access_itree = RB_ROOT_CACHED; pages->domains_itree = RB_ROOT_CACHED; + INIT_LIST_HEAD(&pages->tracker); pages->writable = writable; if (capable(CAP_IPC_LOCK)) pages->account_mode = IOPT_PAGES_ACCOUNT_NONE; @@ -1434,13 +1435,13 @@ struct iopt_pages *iopt_alloc_file_pages(struct file *file, static void iopt_revoke_notify(struct dma_buf_attachment *attach) { struct iopt_pages *pages = attach->importer_priv; - struct iopt_pages_dmabuf_track *track; + struct iopt_pages_track *track; guard(mutex)(&pages->mutex); if (iopt_dmabuf_revoked(pages)) return; - list_for_each_entry(track, &pages->dmabuf.tracker, elm) { + list_for_each_entry(track, &pages->tracker, elm) { struct iopt_area *area = track->area; iopt_area_unmap_domain_range(area, track->domain, @@ -1557,7 +1558,6 @@ struct iopt_pages *iopt_alloc_dmabuf_pages(struct iommufd_ctx *ictx, pages->account_mode = IOPT_PAGES_ACCOUNT_NONE; pages->type = IOPT_ADDRESS_DMABUF; pages->dmabuf.start = start - start_byte; - INIT_LIST_HEAD(&pages->dmabuf.tracker); rc = iopt_map_dmabuf(ictx, pages, dmabuf); if (rc) { @@ -1568,16 +1568,16 @@ struct iopt_pages *iopt_alloc_dmabuf_pages(struct iommufd_ctx *ictx, return pages; } -int iopt_dmabuf_track_domain(struct iopt_pages *pages, struct iopt_area *area, - struct iommu_domain *domain) +int iopt_pages_track_domain(struct iopt_pages *pages, struct iopt_area *area, + struct iommu_domain *domain) { - struct iopt_pages_dmabuf_track *track; + struct iopt_pages_track *track; lockdep_assert_held(&pages->mutex); - if (WARN_ON(!iopt_is_dmabuf(pages))) + if (WARN_ON(!iopt_pages_tracked(pages))) return -EINVAL; - list_for_each_entry(track, &pages->dmabuf.tracker, elm) + list_for_each_entry(track, &pages->tracker, elm) if (WARN_ON(track->domain == domain && track->area == area)) return -EINVAL; @@ -1586,21 +1586,20 @@ int iopt_dmabuf_track_domain(struct iopt_pages *pages, struct iopt_area *area, return -ENOMEM; track->domain = domain; track->area = area; - list_add_tail(&track->elm, &pages->dmabuf.tracker); + list_add_tail(&track->elm, &pages->tracker); return 0; } -void iopt_dmabuf_untrack_domain(struct iopt_pages *pages, - struct iopt_area *area, - struct iommu_domain *domain) +void iopt_pages_untrack_domain(struct iopt_pages *pages, struct iopt_area *area, + struct iommu_domain *domain) { - struct iopt_pages_dmabuf_track *track; + struct iopt_pages_track *track; lockdep_assert_held(&pages->mutex); - WARN_ON(!iopt_is_dmabuf(pages)); + WARN_ON(!iopt_pages_tracked(pages)); - list_for_each_entry(track, &pages->dmabuf.tracker, elm) { + list_for_each_entry(track, &pages->tracker, elm) { if (track->domain == domain && track->area == area) { list_del(&track->elm); kfree(track); @@ -1610,36 +1609,36 @@ void iopt_dmabuf_untrack_domain(struct iopt_pages *pages, WARN_ON(true); } -int iopt_dmabuf_track_all_domains(struct iopt_area *area, - struct iopt_pages *pages) +int iopt_pages_track_all_domains(struct iopt_area *area, + struct iopt_pages *pages) { - struct iopt_pages_dmabuf_track *track; + struct iopt_pages_track *track; struct iommu_domain *domain; unsigned long index; int rc; - list_for_each_entry(track, &pages->dmabuf.tracker, elm) + list_for_each_entry(track, &pages->tracker, elm) if (WARN_ON(track->area == area)) return -EINVAL; xa_for_each(&area->iopt->domains, index, domain) { - rc = iopt_dmabuf_track_domain(pages, area, domain); + rc = iopt_pages_track_domain(pages, area, domain); if (rc) goto err_untrack; } return 0; err_untrack: - iopt_dmabuf_untrack_all_domains(area, pages); + iopt_pages_untrack_all_domains(area, pages); return rc; } -void iopt_dmabuf_untrack_all_domains(struct iopt_area *area, - struct iopt_pages *pages) +void iopt_pages_untrack_all_domains(struct iopt_area *area, + struct iopt_pages *pages) { - struct iopt_pages_dmabuf_track *track; - struct iopt_pages_dmabuf_track *tmp; + struct iopt_pages_track *track; + struct iopt_pages_track *tmp; - list_for_each_entry_safe(track, tmp, &pages->dmabuf.tracker, + list_for_each_entry_safe(track, tmp, &pages->tracker, elm) { if (track->area == area) { list_del(&track->elm); @@ -1656,6 +1655,7 @@ void iopt_release_pages(struct kref *kref) WARN_ON(!RB_EMPTY_ROOT(&pages->domains_itree.rb_root)); WARN_ON(pages->npinned); WARN_ON(!xa_empty(&pages->pinned_pfns)); + WARN_ON(!list_empty(&pages->tracker)); if (iopt_is_dmabuf(pages) && pages->dmabuf.attach) { struct dma_buf *dmabuf = pages->dmabuf.attach->dmabuf; @@ -1664,7 +1664,6 @@ void iopt_release_pages(struct kref *kref) dma_resv_unlock(dmabuf->resv); dma_buf_detach(dmabuf, pages->dmabuf.attach); dma_buf_put(dmabuf); - WARN_ON(!list_empty(&pages->dmabuf.tracker)); } else if (pages->type == IOPT_ADDRESS_FILE) { fput(pages->file); } @@ -1749,7 +1748,7 @@ static void __iopt_area_unfill_domain(struct iopt_area *area, lockdep_assert_held(&pages->mutex); - if (iopt_is_dmabuf(pages)) { + if (iopt_pages_tracked(pages)) { if (WARN_ON(iopt_dmabuf_revoked(pages))) return; iopt_area_unmap_domain_range(area, domain, start_index, @@ -1917,8 +1916,8 @@ int iopt_area_fill_domains(struct iopt_area *area, struct iopt_pages *pages) return 0; mutex_lock(&pages->mutex); - if (iopt_is_dmabuf(pages)) { - rc = iopt_dmabuf_track_all_domains(area, pages); + if (iopt_pages_tracked(pages)) { + rc = iopt_pages_track_all_domains(area, pages); if (rc) goto out_unlock; } @@ -1983,8 +1982,8 @@ int iopt_area_fill_domains(struct iopt_area *area, struct iopt_pages *pages) } pfn_reader_destroy(&pfns); out_untrack: - if (iopt_is_dmabuf(pages)) - iopt_dmabuf_untrack_all_domains(area, pages); + if (iopt_pages_tracked(pages)) + iopt_pages_untrack_all_domains(area, pages); out_unlock: mutex_unlock(&pages->mutex); return rc; @@ -2024,8 +2023,8 @@ void iopt_area_unfill_domains(struct iopt_area *area, struct iopt_pages *pages) WARN_ON(RB_EMPTY_NODE(&area->pages_node.rb)); interval_tree_remove(&area->pages_node, &pages->domains_itree); iopt_area_unfill_domain(area, pages, area->storage_domain); - if (iopt_is_dmabuf(pages)) - iopt_dmabuf_untrack_all_domains(area, pages); + if (iopt_pages_tracked(pages)) + iopt_pages_untrack_all_domains(area, pages); area->storage_domain = NULL; out_unlock: mutex_unlock(&pages->mutex); -- 2.47.3