Skip to content

Multithreaded access to different channel and different memory area fails #516

@X-Ryl669

Description

@X-Ryl669

I'm trying to use XDMA.

Description of the issue:

  1. I've 2 threads (R & S).
  2. R has opened xdma0_c2h_0
  3. S has opened xdma0_h2c_0
  4. R does char buf[1024*1024]; pread(c2h_fd, buf, sizeof(buf), SOME_ADDR1); in a loop
  5. S does char buf[20*1024]; pwrite(h2c_fd, buf, sizeof(buf), SOME_ADDR2); in a loop
  6. Most transfer will work but some will fail (timeout) with this in dmesg:
Event logged [IO_PAGE_FAULT device=0e:00.0 domain=0x001a address=0xfe809400 flags=0x0020]
xdma_xfer_submit: xfer 0x00000000352a938a,1048832, s 0x1 timed out, ep 0x300100.
engine_reg_dump: 0-C2H0-MM: ioread32(0x00000000389bf350) = 0x1fc10006 (id).
engine_reg_dump: 0-C2H0-MM: ioread32(0x00000000c5bcecb2) = 0x00000001 (status).
engine_reg_dump: 0-C2H0-MM: ioread32(0x000000002fc32109) = 0x00f83e1f (control)
engine_reg_dump: 0-C2H0-MM: ioread32(0x00000000fc4073fa) = 0xffeb0000 (first_desc_lo)
engine_reg_dump: 0-C2H0-MM: ioread32(0x000000007b883500) = 0x00000000 (first_desc_hi)
engine_reg_dump: 0-C2H0-MM: ioread32(0x00000000190cefd2) = 0x0000003f (first_desc_adjacent).
engine_reg_dump: 0-C2H0-MM: ioread32(0x0000000017def8cc) = 0x00000004 (completed_desc_count).
engine_reg_dump: 0-C2H0-MM: ioread32(0x000000005cc4976c) = 0x00f83e1e (interrupt_enable_mask)
engine_status_dump: SG engine 0-C2H0-MM status: 0x00000001: BUSY
transfer_abort: abort transfer 0x00000000352a938a, desc 257, engine desc queued 0.

Remarks

If I add a mutex around these calls to prevent both thread to access the XDMA driver at the same time, it does not happen (but obviously with a much lower performance)

I'm not using the same memory buffer, I'm not using the same file descriptor, and I'm not using the same destination/src address in the FPGA here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions