[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 4 Apr 2024 09:56:16 -0400
From: Pasha Tatashin <pasha.tatashin@...een.com>
To: Linu Cherian <lcherian@...vell.com>
Cc: akpm@...ux-foundation.org, alim.akhtar@...sung.com, alyssa@...enzweig.io,
asahi@...ts.linux.dev, baolu.lu@...ux.intel.com, bhelgaas@...gle.com,
cgroups@...r.kernel.org, corbet@....net, david@...hat.com,
dwmw2@...radead.org, hannes@...xchg.org, heiko@...ech.de,
iommu@...ts.linux.dev, jernej.skrabec@...il.com, jonathanh@...dia.com,
joro@...tes.org, krzysztof.kozlowski@...aro.org, linux-doc@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, linux-rockchip@...ts.infradead.org,
linux-samsung-soc@...r.kernel.org, linux-sunxi@...ts.linux.dev,
linux-tegra@...r.kernel.org, lizefan.x@...edance.com, marcan@...can.st,
mhiramat@...nel.org, m.szyprowski@...sung.com, paulmck@...nel.org,
rdunlap@...radead.org, robin.murphy@....com, samuel@...lland.org,
suravee.suthikulpanit@....com, sven@...npeter.dev, thierry.reding@...il.com,
tj@...nel.org, tomas.mudrunka@...il.com, vdumpa@...dia.com, wens@...e.org,
will@...nel.org, yu-cheng.yu@...el.com, rientjes@...gle.com,
bagasdotme@...il.com, mkoutny@...e.com
Subject: Re: [PATCH v5 01/11] iommu/vt-d: add wrapper functions for page allocations
> Few minor nits.
Hi Linu,
Thank you for taking a look at this patch, my replies below.
> > +/*
> > + * All page allocations that should be reported to as "iommu-pagetables" to
> > + * userspace must use on of the functions below. This includes allocations of
> > + * page-tables and other per-iommu_domain configuration structures.
>
> /s/use on/use one/?
I will correct in the next version (if there is going to be one).
> > + *
> > + * This is necessary for the proper accounting as IOMMU state can be rather
> > + * large, i.e. multiple gigabytes in size.
> > + */
> > +
> > +/**
> > + * __iommu_alloc_pages - allocate a zeroed page of a given order.
> > + * @gfp: buddy allocator flags
>
> Shall we keep the comments generic here(avoid reference to allocator
> algo) ?
There are no references to allocator algorithm. I specify the zero
page because this function adds __GFP_ZERO. The order and gfp
arguments are provided by the caller, therefore, should be mentioned.
> > + * @order: page order
> > + *
> > + * returns the head struct page of the allocated page.
> > + */
> > +static inline struct page *__iommu_alloc_pages(gfp_t gfp, int order)
> > +{
> > + struct page *page;
> > +
> > + page = alloc_pages(gfp | __GFP_ZERO, order);
> > + if (unlikely(!page))
> > + return NULL;
> > +
> > + return page;
> > +}
> > +
> > +/**
> > + * __iommu_free_pages - free page of a given order
> > + * @page: head struct page of the page
> > + * @order: page order
> > + */
> > +static inline void __iommu_free_pages(struct page *page, int order)
> > +{
> > + if (!page)
> > + return;
> > +
> > + __free_pages(page, order);
> > +}
> > +
> > +/**
> > + * iommu_alloc_pages_node - allocate a zeroed page of a given order from
> > + * specific NUMA node.
> > + * @nid: memory NUMA node id
> > + * @gfp: buddy allocator flags
>
> Same here for this one and other references below.
ditto.
Thank you,
Pasha
Powered by blists - more mailing lists