All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bart.vanassche@gmail.com>
To: Al Viro <viro@zeniv.linux.org.uk>, Christoph Hellwig <hch@infradead.org>
Cc: David Howells <dhowells@redhat.com>,
	Matthew Wilcox <willy@infradead.org>,
	Jens Axboe <axboe@kernel.dk>, Jan Kara <jack@suse.cz>,
	Jeff Layton <jlayton@kernel.org>,
	Logan Gunthorpe <logang@deltatee.com>,
	linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Douglas Gilbert <dgilbert@interlog.com>
Subject: Re: [PATCH v5 3/9] iov_iter: Use IOCB/IOMAP_WRITE if available rather than iterator direction
Date: Thu, 12 Jan 2023 13:49:14 -0800	[thread overview]
Message-ID: <c6f4014e-d199-d5e8-515c-5ffcd9946c80@gmail.com> (raw)
In-Reply-To: <Y8BFVgdGYNQqK3sB@ZenIV>

On 1/12/23 09:37, Al Viro wrote:
> On Thu, Jan 12, 2023 at 06:08:14AM -0800, Christoph Hellwig wrote:
>> On Thu, Jan 12, 2023 at 10:31:01AM +0000, David Howells wrote:
>>>> And use the information in the request for this one (see patch below),
>>>> and then move this patch first in the series, add an explicit direction
>>>> parameter in the gup_flags to the get/pin helper and drop iov_iter_rw
>>>> and the whole confusing source/dest information in the iov_iter entirely,
>>>> which is a really nice big tree wide cleanup that remove redundant
>>>> information.
>>>
>>> Fine by me, but Al might object as I think he wanted the internal checks.  Al?
>>
>> I'm happy to have another discussion, but the fact the information in
>> the iov_iter is 98% redundant and various callers got it wrong and
>> away is a pretty good sign that we should drop this information.  It
>> also nicely simplified the API.
> 
> I have no problem with getting rid of iov_iter_rw(), but I would really like to
> keep ->data_source.  If nothing else, any place getting direction wrong is
> a trouble waiting to happen - something that is currently dealing only with
> iovec and bvec might be given e.g. a pipe.
> 
> Speaking of which, I would really like to get rid of the kludge /dev/sg is
> pulling - right now from-device requests there do the following:
> 	* copy the entire destination in (and better hope that nothing is mapped
> write-only, etc.)
> 	* form a request + bio, attach the pages with the destination copy to it
> 	* submit
> 	* copy the damn thing back to destination after the completion.
> The reason for that is (quoted in commit ecb554a846f8)
> 
> ====
>      The semantics of SG_DXFER_TO_FROM_DEV were:
>         - copy user space buffer to kernel (LLD) buffer
>         - do SCSI command which is assumed to be of the DATA_IN
>           (data from device) variety. This would overwrite
>           some or all of the kernel buffer
>         - copy kernel (LLD) buffer back to the user space.
>      
>      The idea was to detect short reads by filling the original
>      user space buffer with some marker bytes ("0xec" it would
>      seem in this report). The "resid" value is a better way
>      of detecting short reads but that was only added this century
>      and requires co-operation from the LLD.
> ====
> 
> IOW, we can't tell how much do we actually want to copy out, unless the SCSI driver
> in question is recent enough.  Note that the above had been written in 2009, so
> it might not be an issue these days.
> 
> Do we still have SCSI drivers that would not set the residual on bypass requests
> completion?  Because I would obviously very much prefer to get rid of that
> copy in-overwrite-copy out thing there - given the accurate information about
> the transfer length it would be easy to do.

(+Martin and Doug)

I'm not sure that we still need the double copy in the sg driver. It 
seems obscure to me that there is user space software that relies on 
finding "0xec" in bytes not originating from a SCSI device. 
Additionally, SCSI drivers that do not support residuals should be 
something from the past.

Others may be better qualified to comment on this topic.

Bart.

  reply	other threads:[~2023-01-12 21:58 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-11 14:27 [PATCH v5 0/9] iov_iter: Add extraction helpers David Howells
2023-01-11 14:27 ` [PATCH v5 1/9] iov_iter: Change the direction macros into an enum David Howells
2023-01-11 14:27 ` [PATCH v5 2/9] iov_iter: Use the direction in the iterator functions David Howells
2023-01-11 14:27 ` [PATCH v5 3/9] iov_iter: Use IOCB/IOMAP_WRITE if available rather than iterator direction David Howells
2023-01-12  7:54   ` Christoph Hellwig
2023-01-12 10:31   ` David Howells
2023-01-12 14:08     ` Christoph Hellwig
2023-01-12 17:37       ` Al Viro
2023-01-12 21:49         ` Bart Van Assche [this message]
2023-01-13  5:32           ` Christoph Hellwig
2023-01-14  1:33             ` Martin K. Petersen
2023-01-14  1:34           ` Martin K. Petersen
2023-01-14  1:58             ` Al Viro
2023-01-13  5:30         ` Christoph Hellwig
2023-01-12 21:56   ` Al Viro
2023-01-13  5:33     ` Christoph Hellwig
2023-01-11 14:28 ` [PATCH v5 4/9] iov_iter: Add a function to extract a page list from an iterator David Howells
2023-01-12  7:55   ` Christoph Hellwig
2023-01-12 21:15   ` Al Viro
2023-01-12 21:36     ` Al Viro
2023-01-13  5:26     ` Christoph Hellwig
2023-01-11 14:28 ` [PATCH v5 5/9] netfs: Add a function to extract a UBUF or IOVEC into a BVEC iterator David Howells
2023-01-11 14:28 ` [PATCH v5 6/9] netfs: Add a function to extract an iterator into a scatterlist David Howells
2023-01-11 14:28 ` [PATCH v5 7/9] bio: Rename BIO_NO_PAGE_REF to BIO_PAGE_REFFED and invert the meaning David Howells
2023-01-12  7:32   ` Christoph Hellwig
2023-01-11 14:28 ` [PATCH v5 8/9] iov_iter, block: Make bio structs pin pages rather than ref'ing if appropriate David Howells
2023-01-12  7:44   ` Christoph Hellwig
2023-01-12 10:28   ` David Howells
2023-01-12 14:09     ` Christoph Hellwig
2023-01-12 14:17       ` Christoph Hellwig
2023-01-12 14:58       ` David Howells
2023-01-12 15:02         ` Christoph Hellwig
2023-01-11 14:28 ` [PATCH v5 9/9] bio: Fix bio_flagged() so that it can be combined David Howells
2023-01-12  7:33   ` Christoph Hellwig

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=c6f4014e-d199-d5e8-515c-5ffcd9946c80@gmail.com \
    --to=bart.vanassche@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=dgilbert@interlog.com \
    --cc=dhowells@redhat.com \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=jlayton@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=logang@deltatee.com \
    --cc=martin.petersen@oracle.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.