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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAywjhSTn6hnzVDSpPGTD2=F2vweRc17e1Fd0vJVL-awpd_dcA@mail.gmail.com>
Date: Thu, 4 Dec 2025 09:39:46 -0800
From: Samiullah Khawaja <skhawaja@...gle.com>
To: Baolu Lu <baolu.lu@...ux.intel.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 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.
>
> Thanks,
> baolu

Sami

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ