lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c2525d56-59fe-4dd7-aeea-7e5fb230bdf0@linux.intel.com>
Date: Fri, 5 Dec 2025 12:58:48 +0800
From: Baolu Lu <baolu.lu@...ux.intel.com>
To: Samiullah Khawaja <skhawaja@...gle.com>
Cc: David Woodhouse <dwmw2@...radead.org>, Joerg Roedel <joro@...tes.org>,
 Will Deacon <will@...nel.org>, Pasha Tatashin <pasha.tatashin@...een.com>,
 Jason Gunthorpe <jgg@...pe.ca>, iommu@...ts.linux.dev,
 Robin Murphy <robin.murphy@....com>, Pratyush Yadav <pratyush@...nel.org>,
 Kevin Tian <kevin.tian@...el.com>, Alex Williamson <alex@...zbot.org>,
 linux-kernel@...r.kernel.org, Saeed Mahameed <saeedm@...dia.com>,
 Adithya Jayachandran <ajayachandra@...dia.com>,
 Parav Pandit <parav@...dia.com>, Leon Romanovsky <leonro@...dia.com>,
 William Tu <witu@...dia.com>, Vipin Sharma <vipinsh@...gle.com>,
 dmatlack@...gle.com, YiFei Zhu <zhuyifei@...gle.com>,
 Chris Li <chrisl@...nel.org>, praan@...gle.com
Subject: Re: [RFC PATCH v2 11/32] iommu/pages: Add APIs to
 preserve/unpreserve/restore iommu pages

On 12/5/25 01:39, Samiullah Khawaja wrote:
> On Wed, Dec 3, 2025 at 6:30 PM Baolu Lu<baolu.lu@...ux.intel.com> wrote:
>> On 12/3/25 07:02, Samiullah Khawaja wrote:
>>> +int iommu_preserve_pages(struct iommu_pages_list *list)
>>> +{
>>> +     struct ioptdesc *iopt;
>>> +     int count = 0;
>>> +     int ret;
>>> +
>>> +     list_for_each_entry(iopt, &list->pages, iopt_freelist_elm) {
>>> +             ret = kho_preserve_folio(ioptdesc_folio(iopt));
>>> +             if (ret) {
>>> +                     iommu_unpreserve_pages(list, count);
>>> +                     return ret;
>>> +             }
>>> +
>>> +             ++count;
>>> +     }
>>> +
>>> +     return 0;
>>> +}
>>> +EXPORT_SYMBOL_GPL(iommu_preserve_pages);
>> What is the purpose of "count"?
> Thanks for reviewing.
> 
> The count is there to unpreserve only the preserved pages if an error
> occurs during preservation. For example if 4 pages (from the start of
> the list) were preserved out of 10 pages in the list, the unpreserve
> function will unpreserve the first 4 pages from the start of the list.
> Please take a look at the implementation of iommu_unpreserve_pages for
> details.

Oh, I see now. Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ