From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
Al Viro <viro@zeniv.linux.org.uk>, Arnd Bergmann <arnd@arndb.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-scsi <linux-scsi@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [GIT PULL] first round of SCSI updates for the 5.4+ merge window
Date: Mon, 02 Dec 2019 14:40:37 -0800 [thread overview]
Message-ID: <1575326437.24227.19.camel@HansenPartnership.com> (raw)
In-Reply-To: <CAHk-=wjWNpPW91wyEj4FC4pOimWEUtLVb_RwQgB+9h2OO6ynyA@mail.gmail.com>
On Mon, 2019-12-02 at 13:57 -0800, Linus Torvalds wrote:
> On Sat, Nov 30, 2019 at 10:10 AM James Bottomley
> <James.Bottomley@hansenpartnership.com> wrote:
> >
> > The two major core
> > changes are Al Viro's reworking of sg's handling of copy to/from
> > user, Ming Lei's removal of the host busy counter to avoid
> > contention in the multiqueue case and Damien Le Moal's fixing of
> > residual tracking across error handling.
>
> Math is hard. You say "The two major core changes are.." and then you
> list _three_ changes.
Oh ... I wasn't expecting the Spanish Inquisition.
> Anyway, the sg copyin/out changes by Al conflicted fairly badly with
> Arnd's compat_ioctl changes.
>
> Al did
>
> c35a5cfb4150 ("scsi: sg: sg_read(): simplify reading ->pack_id of
> userland sg_io_hdr_t")
>
> which avoided doing a whole allocation of an 'sg_io_hdr_t' to just
> read the one field of it.
>
> But Arnd did
>
> 98aaaec4a150 ("compat_ioctl: reimplement SG_IO handling")
>
> which created a get_sg_io_hdr() helper that copied the 'sg_io_hdr_t'
> from user space the right way for both compat and native, which
> basically relied on the old approach.
>
> So I effectively reverted Al's patch in order to take Arnd's patch in
> the crazy sg legacy case that presumably nobody really cares about
> anyway, since everybody should use SG_IO rather than the sg_read()
> thing. But I know not everybody is.
>
> I added a comment in that place:
>
> /*
> * This is stupid.
> *
> * We're copying the whole sg_io_hdr_t from user
> * space just to get the 'pack_id' field. But the
> * field is at different offsets for the compat
> * case, so we'll use "get_sg_io_hdr()" to copy
> * the whole thing and convert it.
> *
> * We could do something like just calculating the
> * offset based of 'in_compat_syscall()', but the
> * 'compat_sg_io_hdr' definition is in the wrong
> * place for that.
> */
>
> since it turns out that the one 'pack_id' field we want does have the
> same format in compat mode as in native mode ("int" and
> "compat_int_t" are the same), it's just at different offsets. But the
> definition of 'compat_sg_io_hdr' isn't available in that place.
>
> I'm leaving it to Al and Arnd to decide if they want to fix the
> stupidity. I tried to make the minimally invasive merge resolution.
>
> Al, Arnd? Comments?
>
> It looks like linux-next punted on this entirely, and took Al's
> simplified version that doesn't work with the compat case. Maybe I
> should have done the same - if you use read() on the /dev/sg* device,
> you deserve to get broken for the compat case. And it didn't
> historically work anyway. But it was kind of sad to see how Arnd
> fixed it, and then it got broken again.
Sorry, I did do a test merge with the current state of your tree when I
sent the pull request, but, obviously, that didn't include the Arnd
changes and I've taken to rely on linux-next as the merge problem
canary for trees you haven't yet pulled.
> I really really wish we could get rid of sg_read/sg_write() entirely,
> and have SG_IO_SUBMIT and SG_IO_RECEIVE ioctl's that can handle the
> queued cases that apparently some people need. Because the read/write
> case really is disgusting.
We're definitely not having a read/write case for the proposed v4
protocol ... however we are a bit stuck with it for the existing v3
case.
James
next prev parent reply other threads:[~2019-12-02 22:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-30 18:10 [GIT PULL] first round of SCSI updates for the 5.4+ merge window James Bottomley
2019-12-02 21:57 ` Linus Torvalds
2019-12-02 22:40 ` James Bottomley [this message]
2019-12-04 14:05 ` Arnd Bergmann
2019-12-04 14:08 ` [PATCH] scsi: sg: fix v3 compat read/write interface Arnd Bergmann
2019-12-04 18:32 ` Linus Torvalds
2019-12-04 20:35 ` Arnd Bergmann
2019-12-02 22:00 ` [GIT PULL] first round of SCSI updates for the 5.4+ merge window pr-tracker-bot
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=1575326437.24227.19.camel@HansenPartnership.com \
--to=james.bottomley@hansenpartnership.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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).