linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Maor Gottlieb <maorg@nvidia.com>
Cc: Leon Romanovsky <leon@kernel.org>,
	Doug Ledford <dledford@redhat.com>,
	Christoph Hellwig <hch@infradead.org>,
	Ariel Elior <aelior@marvell.com>, Daniel Vetter <daniel@ffwll.ch>,
	David Airlie <airlied@linux.ie>,
	Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>,
	dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Michal Kalderon <mkalderon@marvell.com>,
	Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>,
	Mustafa Ismail <mustafa.ismail@intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Roland Scheidegger <sroland@vmware.com>,
	Shiraz Saleem <shiraz.saleem@intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	VMware Graphics <linux-graphics-maintainer@vmware.com>,
	Weihang Li <liweihang@huawei.com>,
	Wenpeng Liang <liangwenpeng@huawei.com>,
	Yishai Hadas <yishaih@nvidia.com>, Zack Rusin <zackr@vmware.com>,
	Zhu Yanjun <zyjzyj2000@gmail.com>
Subject: Re: [PATCH rdma-next v3 2/3] lib/scatterlist: Fix wrong update of orig_nents
Date: Mon, 23 Aug 2021 10:54:37 -0300	[thread overview]
Message-ID: <20210823135437.GN1721383@nvidia.com> (raw)
In-Reply-To: <2aab4d71-c6d3-d24c-ed81-7ded355a1592@nvidia.com>

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

  reply	other threads:[~2021-08-23 13:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-29  9:39 [PATCH rdma-next v3 0/3] SG fix together with update to RDMA umem Leon Romanovsky
2021-07-29  9:39 ` [PATCH rdma-next v3 1/3] lib/scatterlist: Provide a dedicated function to support table append Leon Romanovsky
2021-07-29  9:39 ` [PATCH rdma-next v3 2/3] lib/scatterlist: Fix wrong update of orig_nents Leon Romanovsky
2021-08-20 15:54   ` Jason Gunthorpe
2021-08-20 15:57     ` Jason Gunthorpe
2021-08-23 11:09     ` Maor Gottlieb
2021-08-23 12:45       ` Jason Gunthorpe
2021-08-23 13:45         ` Maor Gottlieb
2021-08-23 13:54           ` Jason Gunthorpe [this message]
2021-07-29  9:39 ` [PATCH rdma-next v3 3/3] RDMA: Use the sg_table directly and remove the opencoded version from umem Leon Romanovsky
2021-08-20 16:18 ` [PATCH rdma-next v3 0/3] SG fix together with update to RDMA umem Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210823135437.GN1721383@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=aelior@marvell.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dennis.dalessandro@cornelisnetworks.com \
    --cc=dledford@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hch@infradead.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=leon@kernel.org \
    --cc=liangwenpeng@huawei.com \
    --cc=linux-graphics-maintainer@vmware.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=liweihang@huawei.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=maorg@nvidia.com \
    --cc=mike.marciniszyn@cornelisnetworks.com \
    --cc=mkalderon@marvell.com \
    --cc=mripard@kernel.org \
    --cc=mustafa.ismail@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=shiraz.saleem@intel.com \
    --cc=sroland@vmware.com \
    --cc=tzimmermann@suse.de \
    --cc=yishaih@nvidia.com \
    --cc=zackr@vmware.com \
    --cc=zyjzyj2000@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).