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