From: "Walker, Benjamin" <[email protected]>
To: Jens Axboe <[email protected]>, Avi Kivity <[email protected]>,
<[email protected]>
Subject: Re: memory access op ideas
Date: Fri, 22 Apr 2022 13:03:00 -0700 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On 4/22/2022 7:50 AM, Jens Axboe wrote:
> On 4/13/22 4:33 AM, Avi Kivity wrote:
>> Unfortunately, only ideas, no patches. But at least the first seems very easy.
>>
>>
>> - IORING_OP_MEMCPY_IMMEDIATE - copy some payload included in the op
>> itself (1-8 bytes) to a user memory location specified by the op.
>>
>>
>> Linked to another op, this can generate an in-memory notification
>> useful for busy-waiters or the UMWAIT instruction
>>
>> This would be useful for Seastar, which looks at a timer-managed
>> memory location to check when to break computation loops.
>
> This one would indeed be trivial to do. If we limit the max size
> supported to eg 8 bytes like suggested, then it could be in the sqe
> itself and just copied to the user address specified.
>
> Eg have sqe->len be the length (1..8 bytes), sqe->addr the destination
> address, and sqe->off the data to copy.
>
> If you'll commit to testing this, I can hack it up pretty quickly...
>
>> - IORING_OP_MEMCPY - asynchronously copy memory
>>
>>
>> Some CPUs include a DMA engine, and io_uring is a perfect interface to
>> exercise it. It may be difficult to find space for two iovecs though.
>
> I've considered this one in the past too, and it is indeed an ideal fit
> in terms of API. Outside of the DMA engines, it can also be used to
> offload memcpy to a GPU, for example.
>
> The io_uring side would not be hard to wire up, basically just have the
> sqe specfy source, destination, length. Add some well defined flags
> depending on what the copy engine offers, for example.
>
> But probably some work required here in exposing an API and testing
> etc...
>
I'm about to send a set of patches to associate an io_uring with a
dmaengine channel to this list. I'm not necessarily thinking of using it
to directly drive the DMA engine itself (although we could, and there's
some nice advantages to that), but rather as a way to offload data
copies/transforms on existing io_uring operations. My primary focus has
been the copy between kernel and user space when receiving from a socket.
Upcoming DMA engines also support SVA, allowing them to copy from kernel
to user without page pinning. We've got patches for full SVA enabling in
dmaengine prepared, such that each io_uring can allocate a PASID
describing the user+kernel address space for the current context,
allocate a channel via dmaengine and assign it the PASID, and then do
DMA between kernel/user with new dmaengine APIs without any page pinning.
As preparation, I have submitted a series to dmaengine that allows for
polling and out-of-order completions. See
https://lore.kernel.org/dmaengine/[email protected]/T/#u.
This is a necessary first step.
I'll get the patches out ASAP as an RFC. I'm sure my approach was
entirely wrong, but you'll get the idea.
Thanks,
Ben
next prev parent reply other threads:[~2022-04-22 22:30 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-13 10:33 memory access op ideas Avi Kivity
2022-04-22 12:52 ` Hao Xu
2022-04-22 13:24 ` Hao Xu
2022-04-22 13:38 ` Jens Axboe
2022-04-23 7:19 ` Hao Xu
2022-04-23 16:14 ` Avi Kivity
2022-04-22 14:50 ` Jens Axboe
2022-04-22 15:03 ` Jens Axboe
2022-04-23 16:30 ` Avi Kivity
2022-04-23 17:32 ` Jens Axboe
2022-04-23 18:02 ` Jens Axboe
2022-04-23 18:11 ` Jens Axboe
2022-04-22 20:03 ` Walker, Benjamin [this message]
2022-04-23 10:19 ` Pavel Begunkov
2022-04-23 13:20 ` Jens Axboe
2022-04-23 16:23 ` Avi Kivity
2022-04-23 17:30 ` Jens Axboe
2022-04-24 13:04 ` Avi Kivity
2022-04-24 13:30 ` Jens Axboe
2022-04-24 14:56 ` Avi Kivity
2022-04-25 0:45 ` Jens Axboe
2022-04-25 18:05 ` Walker, Benjamin
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 \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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