[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210823135437.GN1721383@nvidia.com>
Date: Mon, 23 Aug 2021 10:54:37 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Maor Gottlieb <maorg@...dia.com>
Cc: Leon Romanovsky <leon@...nel.org>,
Doug Ledford <dledford@...hat.com>,
Christoph Hellwig <hch@...radead.org>,
Ariel Elior <aelior@...vell.com>,
Daniel Vetter <daniel@...ll.ch>,
David Airlie <airlied@...ux.ie>,
Dennis Dalessandro <dennis.dalessandro@...nelisnetworks.com>,
dri-devel@...ts.freedesktop.org, intel-gfx@...ts.freedesktop.org,
Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
linux-kernel@...r.kernel.org, linux-rdma@...r.kernel.org,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Michal Kalderon <mkalderon@...vell.com>,
Mike Marciniszyn <mike.marciniszyn@...nelisnetworks.com>,
Mustafa Ismail <mustafa.ismail@...el.com>,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
Roland Scheidegger <sroland@...are.com>,
Shiraz Saleem <shiraz.saleem@...el.com>,
Thomas Zimmermann <tzimmermann@...e.de>,
VMware Graphics <linux-graphics-maintainer@...are.com>,
Weihang Li <liweihang@...wei.com>,
Wenpeng Liang <liangwenpeng@...wei.com>,
Yishai Hadas <yishaih@...dia.com>,
Zack Rusin <zackr@...are.com>,
Zhu Yanjun <zyjzyj2000@...il.com>
Subject: Re: [PATCH rdma-next v3 2/3] lib/scatterlist: Fix wrong update of
orig_nents
On Mon, Aug 23, 2021 at 04:45:45PM +0300, Maor Gottlieb wrote:
>
> On 8/23/2021 3:45 PM, Jason Gunthorpe wrote:
> > On Mon, Aug 23, 2021 at 02:09:37PM +0300, Maor Gottlieb wrote:
> > > On 8/20/2021 6:54 PM, Jason Gunthorpe wrote:
> > > > On Thu, Jul 29, 2021 at 12:39:12PM +0300, Leon Romanovsky wrote:
> > > >
> > > > > +/**
> > > > > + * __sg_free_table - Free a previously mapped sg table
> > > > > + * @table: The sg table header to use
> > > > > + * @max_ents: The maximum number of entries per single scatterlist
> > > > > + * @total_ents: The total number of entries in the table
> > > > > + * @nents_first_chunk: Number of entries int the (preallocated) first
> > > > > + * scatterlist chunk, 0 means no such preallocated
> > > > > + * first chunk
> > > > > + * @free_fn: Free function
> > > > > + *
> > > > > + * Description:
> > > > > + * Free an sg table previously allocated and setup with
> > > > > + * __sg_alloc_table(). The @max_ents value must be identical to
> > > > > + * that previously used with __sg_alloc_table().
> > > > > + *
> > > > > + **/
> > > > > +void __sg_free_table(struct sg_table *table, unsigned int max_ents,
> > > > > + unsigned int nents_first_chunk, sg_free_fn *free_fn)
> > > > > +{
> > > > > + sg_free_table_entries(table, max_ents, nents_first_chunk, free_fn,
> > > > > + table->orig_nents);
> > > > > +}
> > > > > EXPORT_SYMBOL(__sg_free_table);
> > > > This is getting a bit indirect, there is only one caller of
> > > > __sg_free_table() in sg_pool.c, so may as well just export
> > > > sg_free_table_entries have have it use that directly.
> > > So I can just extend __sg_free_table to get number of entries. What do you
> > > think?
> > Isn't the point here that different paths to __sg_free_table require
> > different entries? What do you mean?
>
> I mean that __sg_free_table will get the number of entries. sg_pool will
> call it with table->orig_nents and sg_free_append_table will call it with
> with total_nents.
That is sort of what you've done, just renamed __sg_free_table to
sg_free_table_entries in the process, which seem fine enough
Jason
Powered by blists - more mailing lists