LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Maor Gottlieb <maorg@nvidia.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: <dledford@redhat.com>, <hch@infradead.org>, <leonro@nvidia.com>,
	<aelior@marvell.com>, <daniel@ffwll.ch>, <airlied@linux.ie>,
	<dennis.dalessandro@cornelisnetworks.com>,
	<dri-devel@lists.freedesktop.org>,
	<intel-gfx@lists.freedesktop.org>, <jani.nikula@linux.intel.com>,
	<joonas.lahtinen@linux.intel.com>, <linux-kernel@vger.kernel.org>,
	<linux-rdma@vger.kernel.org>, <maarten.lankhorst@linux.intel.com>,
	<mripard@kernel.org>, <mkalderon@marvell.com>,
	<mike.marciniszyn@cornelisnetworks.com>,
	<mustafa.ismail@intel.com>, <rodrigo.vivi@intel.com>,
	<sroland@vmware.com>, <shiraz.saleem@intel.com>,
	<tzimmermann@suse.de>, <linux-graphics-maintainer@vmware.com>,
	<liweihang@huawei.com>, <liangwenpeng@huawei.com>,
	<yishaih@nvidia.com>, <zackr@vmware.com>, <zyjzyj2000@gmail.com>
Subject: Re: [PATCH rdma-next v4 2/3] lib/scatterlist: Fix wrong update of orig_nents
Date: Wed, 25 Aug 2021 07:59:27 +0300	[thread overview]
Message-ID: <4f4a712a-71d4-ebac-48f2-766bfda61f1e@nvidia.com> (raw)
In-Reply-To: <20210824191248.GY1721383@nvidia.com>


On 8/24/2021 10:12 PM, Jason Gunthorpe wrote:
> On Tue, Aug 24, 2021 at 05:25:30PM +0300, Maor Gottlieb wrote:
>> @@ -514,11 +531,13 @@ struct scatterlist *sg_alloc_append_table_from_pages(struct sg_table *sgt,
>>   		offset = 0;
>>   		cur_page = j;
>>   	}
>> -	sgt->nents += added_nents;
>> +	sgt_append->sgt.nents += added_nents;
>> +	sgt_append->sgt.orig_nents = sgt_append->sgt.nents;
>> +	sgt_append->prv = s;
> Why is nents being touched here?
>
> Shouldn't it just be
>
>      sgt_append->sgt.orig_nents += added_nents;
>      sgt_append->prv = s;
>
> ?

In general yes, but all the sg_alloc_* functions update both orig_nents 
and nents (to same value). May be drivers that pass nents instead of 
orig_nents to dma_map_sg* (like umem did before this patch set). So I 
prefer to set it here as well, also not to break 
sg_alloc_table_from_pages_segment which use the same path. This kind of 
change could be done very carefully next cycle for all sg_alloc_*.

>
> Let me know I can fix it
>
> Jason

  reply	other threads:[~2021-08-25  4:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24 14:25 [PATCH rdma-next v4 0/3] SG fix together with update to RDMA umem Maor Gottlieb
2021-08-24 14:25 ` [PATCH rdma-next v4 1/3] lib/scatterlist: Provide a dedicated function to support table append Maor Gottlieb
2021-08-24 14:25 ` [PATCH rdma-next v4 2/3] lib/scatterlist: Fix wrong update of orig_nents Maor Gottlieb
2021-08-24 19:12   ` Jason Gunthorpe
2021-08-25  4:59     ` Maor Gottlieb [this message]
2021-08-25 13:09       ` Jason Gunthorpe
2021-08-24 14:25 ` [PATCH rdma-next v4 3/3] RDMA: Use the sg_table directly and remove the opencoded version from umem Maor Gottlieb
2021-08-30  8:21 ` [PATCH rdma-next v4 0/3] SG fix together with update to RDMA umem Leon Romanovsky
2021-08-30 13:31   ` Jason Gunthorpe
2021-08-30 13:42     ` Leon Romanovsky

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=4f4a712a-71d4-ebac-48f2-766bfda61f1e@nvidia.com \
    --to=maorg@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=jgg@nvidia.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=leonro@nvidia.com \
    --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=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 \
    --subject='Re: [PATCH rdma-next v4 2/3] lib/scatterlist: Fix wrong update of orig_nents' \
    /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

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).