From: Mike Christie <michael.christie@oracle.com>
To: Bodo Stroesser <bostroesser@gmail.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org
Subject: Re: [PATCH v2] scsi: target: tcmu: scatter_/gather_data_area rework
Date: Thu, 22 Oct 2020 00:36:51 +0000 [thread overview]
Message-ID: <417c848e-ee17-e600-2c99-c1e4896f5709@oracle.com> (raw)
In-Reply-To: <20201019115118.11949-1-bostroesser@gmail.com>
On 10/19/20 6:51 AM, Bodo Stroesser wrote:
> This is made on top of the scsi-staging tree plus my previous
> patch:
> "scsi: target: tcmu: add compat mode for 32bit userspace on 64bit kernel"
>
> ---
>
> scatter_data_area and gather_data_area are not easy to understand,
> since data is copied in nested loops over sg_list and tcmu dbi
> list. Since sg list can contain only partly filled pages, the loop
> has to be prepared to handle sg pages not matching dbi pages
> 1 by 1.
>
> Existing implementation uses kmap_atomic()/kunmap_atomic() due to
> performance reasons. But instead of using these calls strictly
> nested for sg and dpi pages, the code holds the mappings in an
> overlapping way, which indeed is a bug that would trigger on archs
> using highmem.
>
> The scatterlist lib contains the sg_miter_start/_next/_stop
> functions which can be used to simplify such complicated loops.
>
> The new code now processes the dbi list in the outer loop, while
> sg list is handled by the inner one. That way the code can take
> advantage of the sg_miter_* family calls.
>
> Calling sg_miter_stop() after the end of the inner loop enforces
> strict nesting of atomic kmaps.
>
> Since the nested loops in scatter_/gather_data_area were very
> similar, I replaced them by the new helper function
> tcmu_copy_data().
>
> Signed-off-by: Bodo Stroesser <bostroesser@gmail.com>
>
Acked-by: Mike Christie <michael.christie@oracle.com>
next prev parent reply other threads:[~2020-10-22 0:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-19 11:51 [PATCH v2] scsi: target: tcmu: scatter_/gather_data_area rework Bodo Stroesser
2020-10-22 0:36 ` Mike Christie [this message]
2020-10-26 22:29 ` Martin K. Petersen
2020-11-11 2:59 ` Martin K. Petersen
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=417c848e-ee17-e600-2c99-c1e4896f5709@oracle.com \
--to=michael.christie@oracle.com \
--cc=bostroesser@gmail.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=target-devel@vger.kernel.org \
/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).