io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Ring Setup Question
@ 2020-04-23 14:38 Daniel H
  2020-04-23 15:24 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel H @ 2020-04-23 14:38 UTC (permalink / raw)
  To: io-uring

I'm working on a implementation of for the Go language and I've been running
into a failed test case that I can't understand. The test is setup in the
following manner; first write some data into a file and then read the data
back using the io_uring. The simple test case of reading back all the bytes
passes. However, when using two reads to read half the amount of data what I
observe is the second time the ring is entered (after the first read completes
successfully) is that the resulting CQE doesn't match the UserData. The test
uses a monotonically increasing value for UserData and the following debug
messages show that each entry has a unique UserData field. I'm guessing
the ring is setup properly, however I'm not sure how to proceed.

=== RUN   TestRingFileReadWriterRead
pre enter
sq head: 0 tail: 1
sq entries: [{Opcode:22 Flags:2 Ioprio:0 Fd:8 Offset:0
Addr:824634362160 Len:7 UFlags:0 UserData:1 Anon0:[0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0]} {Opcode:0 Flags:0 Ioprio:0 Fd:0 Offset:0
Addr:0 Len:0 UFlags:0 UserData:0 Anon0:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0]}]
cq head: 0 tail: 0
cq entries: [{UserData:0 Res:0 Flags:0} {UserData:0 Res:0 Flags:0}]
enter complete
sq head: 1 tail: 1
sq entries: [{Opcode:22 Flags:2 Ioprio:0 Fd:8 Offset:0
Addr:824634362160 Len:7 UFlags:0 UserData:1 Anon0:[0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0]} {Opcode:0 Flags:0 Ioprio:0 Fd:0 Offset:0
Addr:0 Len:0 UFlags:0 UserData:0 Anon0:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0]}]
cq head: 1 tail: 1
cq entries: [{UserData:1 Res:7 Flags:0} {UserData:0 Res:0 Flags:0}]
pre enter
sq head: 1 tail: 2
sq entries: [{Opcode:22 Flags:2 Ioprio:0 Fd:8 Offset:0
Addr:824634362160 Len:7 UFlags:0 UserData:1 Anon0:[0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0]} {Opcode:22 Flags:2 Ioprio:0 Fd:8
Offset:7 Addr:824634363240 Len:7 UFlags:0 UserData:2 Anon0:[0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]}]
cq head: 1 tail: 1
cq entries: [{UserData:1 Res:7 Flags:0} {UserData:0 Res:0 Flags:0}]
enter complete
sq head: 2 tail: 2
sq entries: [{Opcode:22 Flags:2 Ioprio:0 Fd:8 Offset:0
Addr:824634362160 Len:7 UFlags:0 UserData:1 Anon0:[0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0]} {Opcode:22 Flags:2 Ioprio:0 Fd:8
Offset:7 Addr:824634363240 Len:7 UFlags:0 UserData
:2 Anon0:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]}]
cq head: 1 tail: 2
cq entries: [{UserData:1 Res:7 Flags:0} {UserData:1 Res:7 Flags:0}]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Ring Setup Question
  2020-04-23 14:38 Ring Setup Question Daniel H
@ 2020-04-23 15:24 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2020-04-23 15:24 UTC (permalink / raw)
  To: Daniel H, io-uring

On 4/23/20 8:38 AM, Daniel H wrote:
> I'm working on a implementation of for the Go language and I've been running
> into a failed test case that I can't understand. The test is setup in the
> following manner; first write some data into a file and then read the data
> back using the io_uring. The simple test case of reading back all the bytes
> passes. However, when using two reads to read half the amount of data what I
> observe is the second time the ring is entered (after the first read completes
> successfully) is that the resulting CQE doesn't match the UserData. The test
> uses a monotonically increasing value for UserData and the following debug
> messages show that each entry has a unique UserData field. I'm guessing
> the ring is setup properly, however I'm not sure how to proceed.
> 
> === RUN   TestRingFileReadWriterRead
> pre enter
> sq head: 0 tail: 1
> sq entries: [{Opcode:22 Flags:2 Ioprio:0 Fd:8 Offset:0
> Addr:824634362160 Len:7 UFlags:0 UserData:1 Anon0:[0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0]} {Opcode:0 Flags:0 Ioprio:0 Fd:0 Offset:0
> Addr:0 Len:0 UFlags:0 UserData:0 Anon0:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0]}]
> cq head: 0 tail: 0
> cq entries: [{UserData:0 Res:0 Flags:0} {UserData:0 Res:0 Flags:0}]
> enter complete
> sq head: 1 tail: 1
> sq entries: [{Opcode:22 Flags:2 Ioprio:0 Fd:8 Offset:0
> Addr:824634362160 Len:7 UFlags:0 UserData:1 Anon0:[0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0]} {Opcode:0 Flags:0 Ioprio:0 Fd:0 Offset:0
> Addr:0 Len:0 UFlags:0 UserData:0 Anon0:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0]}]
> cq head: 1 tail: 1
> cq entries: [{UserData:1 Res:7 Flags:0} {UserData:0 Res:0 Flags:0}]
> pre enter
> sq head: 1 tail: 2
> sq entries: [{Opcode:22 Flags:2 Ioprio:0 Fd:8 Offset:0
> Addr:824634362160 Len:7 UFlags:0 UserData:1 Anon0:[0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0]} {Opcode:22 Flags:2 Ioprio:0 Fd:8
> Offset:7 Addr:824634363240 Len:7 UFlags:0 UserData:2 Anon0:[0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]}]
> cq head: 1 tail: 1
> cq entries: [{UserData:1 Res:7 Flags:0} {UserData:0 Res:0 Flags:0}]
> enter complete
> sq head: 2 tail: 2
> sq entries: [{Opcode:22 Flags:2 Ioprio:0 Fd:8 Offset:0
> Addr:824634362160 Len:7 UFlags:0 UserData:1 Anon0:[0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0]} {Opcode:22 Flags:2 Ioprio:0 Fd:8
> Offset:7 Addr:824634363240 Len:7 UFlags:0 UserData
> :2 Anon0:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]}]
> cq head: 1 tail: 2
> cq entries: [{UserData:1 Res:7 Flags:0} {UserData:1 Res:7 Flags:0}]

I think it'll be hard to advise on what is going wrong here without
having a test case.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-23 15:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-23 14:38 Ring Setup Question Daniel H
2020-04-23 15:24 ` Jens Axboe

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).