Message ID | 20230324135808.855245-1-ming.lei@redhat.com (mailing list archive) |
---|---|
Headers | show |
Series | io_uring/ublk: add IORING_OP_FUSED_CMD | expand |
Ming Lei wrote: > Hello Jens, > > Add IORING_OP_FUSED_CMD, it is one special URING_CMD, which has to > be SQE128. The 1st SQE(master) is one 64byte URING_CMD, and the 2nd > 64byte SQE(slave) is another normal 64byte OP. For any OP which needs > to support slave OP, io_issue_defs[op].fused_slave needs to be set as 1, > and its ->issue() can retrieve/import buffer from master request's > fused_cmd_kbuf. The slave OP is actually submitted from kernel, part of > this idea is from Xiaoguang's ublk ebpf patchset, but this patchset > submits slave OP just like normal OP issued from userspace, that said, > SQE order is kept, and batching handling is done too. Hi Ming, io_uring and ublk are starting to be more on my radar these days. I wanted to take a look at this series, but could not get past the distracting "master"/"slave" terminology in this lead-in paragraph let alone start looking at patches. Frankly, the description sounds more like "head"/"tail", or even "fuse0"/"fuse1" because, for example, who is to say you might not have larger fused ops in the future and need terminology to address "fuse{0,1,2,3}"? Once that's fixed up I can take a look at forwarding on to others that might be interested in this use case. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst#n338 Thanks in advance for fixing that up!
Hi Dan, On Mon, Mar 27, 2023 at 05:36:33PM -0700, Dan Williams wrote: > Ming Lei wrote: > > Hello Jens, > > > > Add IORING_OP_FUSED_CMD, it is one special URING_CMD, which has to > > be SQE128. The 1st SQE(master) is one 64byte URING_CMD, and the 2nd > > 64byte SQE(slave) is another normal 64byte OP. For any OP which needs > > to support slave OP, io_issue_defs[op].fused_slave needs to be set as 1, > > and its ->issue() can retrieve/import buffer from master request's > > fused_cmd_kbuf. The slave OP is actually submitted from kernel, part of > > this idea is from Xiaoguang's ublk ebpf patchset, but this patchset > > submits slave OP just like normal OP issued from userspace, that said, > > SQE order is kept, and batching handling is done too. > > Hi Ming, > > io_uring and ublk are starting to be more on my radar these days. I > wanted to take a look at this series, but could not get past the > distracting "master"/"slave" terminology in this lead-in paragraph let > alone start looking at patches. > > Frankly, the description sounds more like "head"/"tail", or even > "fuse0"/"fuse1" because, for example, who is to say you might not have The term "master/slave" is from patches. The master command not only provides buffer for slave request, but also requires slave request for serving master command, and master command is always completed after all slave request are done. That is why it is named as master/slave. Actually Jens raised the similar concern and I hate the name too, but it is always hard to figure out perfect name, or any other name for reflecting the relation? (head/tail, fuse0/1 can't do that, IMO) > larger fused ops in the future and need terminology to address > "fuse{0,1,2,3}"? Yeah, definitely, the interface can be extended in future to support multiple "slave" requests. Thanks, Ming
On 3/27/23 7:16 PM, Ming Lei wrote: > Hi Dan, > > On Mon, Mar 27, 2023 at 05:36:33PM -0700, Dan Williams wrote: >> Ming Lei wrote: >>> Hello Jens, >>> >>> Add IORING_OP_FUSED_CMD, it is one special URING_CMD, which has to >>> be SQE128. The 1st SQE(master) is one 64byte URING_CMD, and the 2nd >>> 64byte SQE(slave) is another normal 64byte OP. For any OP which needs >>> to support slave OP, io_issue_defs[op].fused_slave needs to be set as 1, >>> and its ->issue() can retrieve/import buffer from master request's >>> fused_cmd_kbuf. The slave OP is actually submitted from kernel, part of >>> this idea is from Xiaoguang's ublk ebpf patchset, but this patchset >>> submits slave OP just like normal OP issued from userspace, that said, >>> SQE order is kept, and batching handling is done too. >> >> Hi Ming, >> >> io_uring and ublk are starting to be more on my radar these days. I >> wanted to take a look at this series, but could not get past the >> distracting "master"/"slave" terminology in this lead-in paragraph let >> alone start looking at patches. >> >> Frankly, the description sounds more like "head"/"tail", or even >> "fuse0"/"fuse1" because, for example, who is to say you might not have > > The term "master/slave" is from patches. > > The master command not only provides buffer for slave request, but also requires > slave request for serving master command, and master command is always completed > after all slave request are done. > > That is why it is named as master/slave. Actually Jens raised the similar concern > and I hate the name too, but it is always hard to figure out perfect name, or > any other name for reflecting the relation? (head/tail, fuse0/1 can't > do that, IMO) Indeed. What about primary/secondary? And it'd be quite possible to have multiple secondaries too.
Ming Lei wrote: > Hi Dan, > > On Mon, Mar 27, 2023 at 05:36:33PM -0700, Dan Williams wrote: > > Ming Lei wrote: > > > Hello Jens, > > > > > > Add IORING_OP_FUSED_CMD, it is one special URING_CMD, which has to > > > be SQE128. The 1st SQE(master) is one 64byte URING_CMD, and the 2nd > > > 64byte SQE(slave) is another normal 64byte OP. For any OP which needs > > > to support slave OP, io_issue_defs[op].fused_slave needs to be set as 1, > > > and its ->issue() can retrieve/import buffer from master request's > > > fused_cmd_kbuf. The slave OP is actually submitted from kernel, part of > > > this idea is from Xiaoguang's ublk ebpf patchset, but this patchset > > > submits slave OP just like normal OP issued from userspace, that said, > > > SQE order is kept, and batching handling is done too. > > > > Hi Ming, > > > > io_uring and ublk are starting to be more on my radar these days. I > > wanted to take a look at this series, but could not get past the > > distracting "master"/"slave" terminology in this lead-in paragraph let > > alone start looking at patches. > > > > Frankly, the description sounds more like "head"/"tail", or even > > "fuse0"/"fuse1" because, for example, who is to say you might not have > > The term "master/slave" is from patches. From what patches? I did not understand this explanation either: https://lore.kernel.org/all/ZBXjH5ipRUwtYIVF@ovpn-8-18.pek2.redhat.com/ > The master command not only provides buffer for slave request, but also requires > slave request for serving master command, and master command is always completed > after all slave request are done. In terms of core kernel concepts that description aligns more with idiomatic "parent"/"child" relationships where the child object holds a reference on the parent. > That is why it is named as master/slave. That explanation did not clarify. > Actually Jens raised the similar concern Thanks Jens! > ...and I hate the name too, but it is always hard to figure out > perfect name, or any other name for reflecting the relation? > (head/tail, fuse0/1 can't do that, IMO) Naming is hard, and master/slave is not appropriate so this needs a new name. The reason I mentioned "head"/"tail" is not for ring buffer purposes but more for its similarity to pages and folios where the folio is not unreferenced until all tail pages are unreferenced. In short there are several options that add more clarity and avoid running afoul of coding-style. > > larger fused ops in the future and need terminology to address > > "fuse{0,1,2,3}"? > > Yeah, definitely, the interface can be extended in future to support > multiple "slave" requests. Right, so why not just name them fuse0,1...n and specify that fuse0 is the head of a fused op?
On Mon, Mar 27, 2023 at 07:29:36PM -0600, Jens Axboe wrote: > On 3/27/23 7:16 PM, Ming Lei wrote: > > Hi Dan, > > > > On Mon, Mar 27, 2023 at 05:36:33PM -0700, Dan Williams wrote: > >> Ming Lei wrote: > >>> Hello Jens, > >>> > >>> Add IORING_OP_FUSED_CMD, it is one special URING_CMD, which has to > >>> be SQE128. The 1st SQE(master) is one 64byte URING_CMD, and the 2nd > >>> 64byte SQE(slave) is another normal 64byte OP. For any OP which needs > >>> to support slave OP, io_issue_defs[op].fused_slave needs to be set as 1, > >>> and its ->issue() can retrieve/import buffer from master request's > >>> fused_cmd_kbuf. The slave OP is actually submitted from kernel, part of > >>> this idea is from Xiaoguang's ublk ebpf patchset, but this patchset > >>> submits slave OP just like normal OP issued from userspace, that said, > >>> SQE order is kept, and batching handling is done too. > >> > >> Hi Ming, > >> > >> io_uring and ublk are starting to be more on my radar these days. I > >> wanted to take a look at this series, but could not get past the > >> distracting "master"/"slave" terminology in this lead-in paragraph let > >> alone start looking at patches. > >> > >> Frankly, the description sounds more like "head"/"tail", or even > >> "fuse0"/"fuse1" because, for example, who is to say you might not have > > > > The term "master/slave" is from patches. > > > > The master command not only provides buffer for slave request, but also requires > > slave request for serving master command, and master command is always completed > > after all slave request are done. > > > > That is why it is named as master/slave. Actually Jens raised the similar concern > > and I hate the name too, but it is always hard to figure out perfect name, or > > any other name for reflecting the relation? (head/tail, fuse0/1 can't > > do that, IMO) > > Indeed. What about primary/secondary? And it'd be quite possible to have > multiple secondaries too. OK, I will take primary/secondary in V5 if no better name is suggested. Thanks, Ming
On Mon, Mar 27, 2023 at 06:31:37PM -0700, Dan Williams wrote: > Ming Lei wrote: > > Hi Dan, > > > > On Mon, Mar 27, 2023 at 05:36:33PM -0700, Dan Williams wrote: > > > Ming Lei wrote: > > > > Hello Jens, > > > > > > > > Add IORING_OP_FUSED_CMD, it is one special URING_CMD, which has to > > > > be SQE128. The 1st SQE(master) is one 64byte URING_CMD, and the 2nd > > > > 64byte SQE(slave) is another normal 64byte OP. For any OP which needs > > > > to support slave OP, io_issue_defs[op].fused_slave needs to be set as 1, > > > > and its ->issue() can retrieve/import buffer from master request's > > > > fused_cmd_kbuf. The slave OP is actually submitted from kernel, part of > > > > this idea is from Xiaoguang's ublk ebpf patchset, but this patchset > > > > submits slave OP just like normal OP issued from userspace, that said, > > > > SQE order is kept, and batching handling is done too. > > > > > > Hi Ming, > > > > > > io_uring and ublk are starting to be more on my radar these days. I > > > wanted to take a look at this series, but could not get past the > > > distracting "master"/"slave" terminology in this lead-in paragraph let > > > alone start looking at patches. > > > > > > Frankly, the description sounds more like "head"/"tail", or even > > > "fuse0"/"fuse1" because, for example, who is to say you might not have > > > > The term "master/slave" is from patches. > > From what patches? https://lore.kernel.org/linux-block/20230324135808.855245-3-ming.lei@redhat.com/T/#u > > I did not understand this explanation either: > > https://lore.kernel.org/all/ZBXjH5ipRUwtYIVF@ovpn-8-18.pek2.redhat.com/ Jens just suggested primary/secondary, which looks better, and I will use them in this thread and next version. > > > The master command not only provides buffer for slave request, but also requires > > slave request for serving master command, and master command is always completed > > after all slave request are done. > > In terms of core kernel concepts that description aligns more with > idiomatic "parent"/"child" relationships where the child object holds a > reference on the parent. Yeah, holding reference is true for both two relationships. But "parent"/"child" relationship is often one long-time relation, but here both requests are short-time objects, just the secondary requests need to grab primary command buffer for running IO. After secondary requests IO is done, the relation is over. So it is sort of temporary/short-term relation, like contract. Also the buffer meta(bvec) data are readable for all secondary requests, and secondary requests have to use buffer in the primary command allowed direction. So the relation is very limited. > > > That is why it is named as master/slave. > > That explanation did not clarify. Hope the above words help. > > > Actually Jens raised the similar concern > > Thanks Jens! > > > ...and I hate the name too, but it is always hard to figure out > > perfect name, or any other name for reflecting the relation? > > (head/tail, fuse0/1 can't do that, IMO) > > Naming is hard, and master/slave is not appropriate so this needs a new > name. The reason I mentioned "head"/"tail" is not for ring buffer > purposes but more for its similarity to pages and folios where the folio > is not unreferenced until all tail pages are unreferenced. > > In short there are several options that add more clarity and avoid > running afoul of coding-style. > > > > larger fused ops in the future and need terminology to address > > > "fuse{0,1,2,3}"? > > > > Yeah, definitely, the interface can be extended in future to support > > multiple "slave" requests. > > Right, so why not just name them fuse0,1...n and specify that fuse0 is > the head of a fused op? fuse0, 1...n often means all these objects sharing common property, such as, all are objects of same class. However, here we do know primary is completely different with secondary. Thanks, Ming
On 2023/3/28 09:16, Ming Lei wrote: > Hi Dan, > > On Mon, Mar 27, 2023 at 05:36:33PM -0700, Dan Williams wrote: >> Ming Lei wrote: >>> Hello Jens, >>> >>> Add IORING_OP_FUSED_CMD, it is one special URING_CMD, which has to >>> be SQE128. The 1st SQE(master) is one 64byte URING_CMD, and the 2nd >>> 64byte SQE(slave) is another normal 64byte OP. For any OP which needs >>> to support slave OP, io_issue_defs[op].fused_slave needs to be set as 1, >>> and its ->issue() can retrieve/import buffer from master request's >>> fused_cmd_kbuf. The slave OP is actually submitted from kernel, part of >>> this idea is from Xiaoguang's ublk ebpf patchset, but this patchset >>> submits slave OP just like normal OP issued from userspace, that said, >>> SQE order is kept, and batching handling is done too. >> >> Hi Ming, >> >> io_uring and ublk are starting to be more on my radar these days. I >> wanted to take a look at this series, but could not get past the >> distracting "master"/"slave" terminology in this lead-in paragraph let >> alone start looking at patches. >> >> Frankly, the description sounds more like "head"/"tail", or even >> "fuse0"/"fuse1" because, for example, who is to say you might not have > > The term "master/slave" is from patches. > > The master command not only provides buffer for slave request, but also requires > slave request for serving master command, and master command is always completed > after all slave request are done. > > That is why it is named as master/slave. Actually Jens raised the similar concern > and I hate the name too, but it is always hard to figure out perfect name, or > any other name for reflecting the relation? (head/tail, fuse0/1 can't > do that, IMO) > >> larger fused ops in the future and need terminology to address >> "fuse{0,1,2,3}"? > > Yeah, definitely, the interface can be extended in future to support > multiple "slave" requests. I guess master/slave (especially now) have bad meaning to English-language guys so it's better to avoid it. Thanks, Gao Xiang > > Thanks, > Ming
On Tue, Mar 28, 2023 at 11:13:53AM +0800, Gao Xiang wrote: > > > On 2023/3/28 09:16, Ming Lei wrote: > > Hi Dan, > > > > On Mon, Mar 27, 2023 at 05:36:33PM -0700, Dan Williams wrote: > > > Ming Lei wrote: > > > > Hello Jens, > > > > > > > > Add IORING_OP_FUSED_CMD, it is one special URING_CMD, which has to > > > > be SQE128. The 1st SQE(master) is one 64byte URING_CMD, and the 2nd > > > > 64byte SQE(slave) is another normal 64byte OP. For any OP which needs > > > > to support slave OP, io_issue_defs[op].fused_slave needs to be set as 1, > > > > and its ->issue() can retrieve/import buffer from master request's > > > > fused_cmd_kbuf. The slave OP is actually submitted from kernel, part of > > > > this idea is from Xiaoguang's ublk ebpf patchset, but this patchset > > > > submits slave OP just like normal OP issued from userspace, that said, > > > > SQE order is kept, and batching handling is done too. > > > > > > Hi Ming, > > > > > > io_uring and ublk are starting to be more on my radar these days. I > > > wanted to take a look at this series, but could not get past the > > > distracting "master"/"slave" terminology in this lead-in paragraph let > > > alone start looking at patches. > > > > > > Frankly, the description sounds more like "head"/"tail", or even > > > "fuse0"/"fuse1" because, for example, who is to say you might not have > > > > The term "master/slave" is from patches. > > > > The master command not only provides buffer for slave request, but also requires > > slave request for serving master command, and master command is always completed > > after all slave request are done. > > > > That is why it is named as master/slave. Actually Jens raised the similar concern > > and I hate the name too, but it is always hard to figure out perfect name, or > > any other name for reflecting the relation? (head/tail, fuse0/1 can't > > do that, IMO) > > > > > larger fused ops in the future and need terminology to address > > > "fuse{0,1,2,3}"? > > > > Yeah, definitely, the interface can be extended in future to support > > multiple "slave" requests. > > I guess master/slave (especially now) have bad meaning to > English-language guys so it's better to avoid it. Absolutely no offense given English isn't my native language, so let's move on with V5. Thanks, Ming
On Fri, Mar 24, 2023 at 09:57:51PM +0800, Ming Lei wrote: >Hello Jens, > >Add IORING_OP_FUSED_CMD, it is one special URING_CMD, which has to >be SQE128. The 1st SQE(master) is one 64byte URING_CMD, and the 2nd >64byte SQE(slave) is another normal 64byte OP. For any OP which needs >to support slave OP, io_issue_defs[op].fused_slave needs to be set as 1, >and its ->issue() can retrieve/import buffer from master request's >fused_cmd_kbuf. The slave OP is actually submitted from kernel, part of >this idea is from Xiaoguang's ublk ebpf patchset, but this patchset >submits slave OP just like normal OP issued from userspace, that said, >SQE order is kept, and batching handling is done too. > >Please see detailed design in commit log of the 2th patch, and one big >point is how to handle buffer ownership. > >With this way, it is easy to support zero copy for ublk/fuse device. > >Basically userspace can specify any sub-buffer of the ublk block request >buffer from the fused command just by setting 'offset/len' >in the slave SQE for running slave OP. Wondering if this new OP can also be used to do larger IO (than device limit) on nvme-passthrough? For example, 1MB IO on NVMe than has 512k or 256K maximum transfer size.
Ming Lei wrote: > Jens just suggested primary/secondary, which looks better, and I will > use them in this thread and next version. Sounds good, thank you.