From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Zach Brown <zab@redhat.com>
Cc: axboe@kernel.dk, martin.petersen@oracle.com,
JBottomley@parallels.com, jmoyer@redhat.com, bcrl@kvack.org,
viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org,
linux-aio@kvack.org, linux-scsi@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [PATCH 2/6] io: define an interface for IO extensions
Date: Wed, 2 Apr 2014 16:06:12 -0700 [thread overview]
Message-ID: <20140402230612.GF10230@birch.djwong.org> (raw)
In-Reply-To: <20140402225333.GO2394@lenny.home.zabbo.net>
On Wed, Apr 02, 2014 at 03:53:33PM -0700, Zach Brown wrote:
> > > I'd just remove this generic teardown callback path entirely. If
> > > there's PI state hanging off the iocb tear it down during iocb teardown.
> >
> > Hmm, I thought aio_complete /was/ iocb teardown time.
>
> Well, usually :). If you build up before aio_run_iocb() then you nead
> to teardown in kiocb_free(), which is also called by aio_complete().
Oh, yeah. I handle that by tearing down the extensions if stuff fails, though
I don't remember if that was in this version of the patchset.
> > > (Isn't there some allocate-and-copy-from-userspace helper now? But..)
> >
> > <shrug> Is there? I didn't find one when I looked, but it wasn't an exhaustive
> > search.
>
> I could have sworn that I saw something.. ah, right, memdup_user().
Noted. :)
> > > I don't like the rudundancy of the implicit size requirement by a
> > > field's flag being set being duplicated by the explicit size argument.
> > > What does that give us, exactly?
> >
> > Either another sanity check or another way to screw up, depending on how you
> > look at it. I'd been considering shortening the size field to u32 and adding a
> > magic number field, but I wonder if that's really necessary. Seems like it
> > shouldn't be -- if userland screws up, it's not hard to kill the process.
> > (Or segv it, or...)
>
> I don't think I'd bother. The bits should be enough and are already
> necessary to have explicit indicators of fields being set.
<nod>
> > > Fields in the iocb As each of these are initialized I'd just
> > > test the presence bits and __get_user() the userspace arguemnts
> > > directly, or copy_from_user() something slightly more complicated on to
> > > the stack.
> > >
> > > That gets rid of us having to care about the size at all. It stops us
> > > from allocating a kernel copy and pinning it for the duration of the IO.
> > > We'd just be sampling the present userspace arguments as we initialie
> > > the iocb during submission.
> >
> > I like this idea. For the PI extension, nothing particularly error-prone
> > happens in teardown, which allows the flexibility to copy_from_user any
> > arguments required, and to copy_to_user any setup errors that happen. I can
> > get rid a lot of allocate-and-copy nonsense, as you point out.
> >
> > Ok, I'll migrate my patches towards this strategy, and let's see how much code
> > goes away. :)
>
> Cool :).
>
> > I've also noticed a bug where if you make one of these PI-extended calls on a
> > file living on a filesystem, it'll extend the io request's range to be
> > filesystem block-aligned, which causes all kinds of havoc with the user
> > provided PI buffers, since they now need to be extended to fit the added
> > blocks. Alternately, one could require PI IOs to be fs-block aligned when
> > dealing with regular files.
>
> I think, like O_DIRECT, it just has to be aligned or fail :(.
Heh. O_DIRECT is a hilarious maze of twisty unobvious requirements. Yuck.
#define O_IMNAIVEENOUGHTOTHINKIKNOWWHATTHISDOES O_DIRECT
--D
>
> - z
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-04-02 23:06 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-24 16:22 [RFC PATCH DONOTMERGE v2 0/6] userspace PI passthrough via AIO/DIO Darrick J. Wong
2014-03-24 16:22 ` [PATCH 1/6] fs/bio-integrity: remove duplicate code Darrick J. Wong
2014-04-02 19:17 ` Zach Brown
2014-04-02 20:35 ` Darrick J. Wong
2014-03-24 16:22 ` [PATCH 2/6] io: define an interface for IO extensions Darrick J. Wong
[not found] ` <20140324162244.10848.46322.stgit-PTl6brltDGh4DFYR7WNSRA@public.gmane.org>
2014-04-02 19:22 ` Jeff Moyer
2014-04-02 22:08 ` Darrick J. Wong
2014-04-02 19:49 ` Zach Brown
2014-04-02 22:28 ` Darrick J. Wong
2014-04-02 22:53 ` Zach Brown
2014-04-02 23:06 ` Darrick J. Wong [this message]
2014-03-24 16:22 ` [PATCH 3/6] aio/dio: enable PI passthrough Darrick J. Wong
2014-04-02 20:01 ` Zach Brown
2014-04-02 20:44 ` Darrick J. Wong
2014-04-02 22:33 ` Zach Brown
2014-04-02 22:55 ` Darrick J. Wong
2014-03-24 16:22 ` [PATCH 4/6] PI IO extension: allow user to ask kernel to fill in parts of the protection info Darrick J. Wong
2014-03-24 16:23 ` [PATCH 5/6] PI IO extension: advertise possible userspace flags Darrick J. Wong
2014-03-24 16:23 ` [PATCH 6/6] blk-integrity: refactor various routines Darrick J. Wong
2014-04-02 19:14 ` [RFC PATCH DONOTMERGE v2 0/6] userspace PI passthrough via AIO/DIO Zach Brown
2014-04-02 20:05 ` Zach Brown
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=20140402230612.GF10230@birch.djwong.org \
--to=darrick.wong@oracle.com \
--cc=JBottomley@parallels.com \
--cc=axboe@kernel.dk \
--cc=bcrl@kvack.org \
--cc=jmoyer@redhat.com \
--cc=linux-aio@kvack.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=viro@zeniv.linux.org.uk \
--cc=zab@redhat.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).