On 09/02/18 09:56 AM, Christian König wrote: > Am 09.02.2018 um 15:51 schrieb Tom St Denis: >> On 09/02/18 09:12 AM, Christian König wrote: >>> No, there is simply no need to initialize the system domain. What are >>> the values of p->mapping and adev->mman.bdev.dev_mapping when they >>> don't match? Maybe we are allocating memory before initializing >>> adev->mman.bdev.dev_mapping. >> >> In my test setup I'm running test 3 from libdrm (suite 1) with a pause >> before the unmap/free call. So the IB should still be mapped. Indeed >> the VM PTE decoding has the V bit set. >> >>> Or do you have more than one GPU in the system? E.g. APU+dGPU? Could >>> it be that you read through the wrong device? >> >> I found the issue: >> >>     while (size) { >>        phys_addr_t addr = *pos & PAGE_MASK; >>        loff_t off = *pos & ~PAGE_MASK; >>        size_t bytes = PAGE_SIZE - off; >> >> "bytes" should be limited by the 'size' parameter passed in. What is >> happening instead is it's reading the entire PTB until it hits a V=0 >> page and then returns an error and in the process is doing "fun >> things" to the user mode application (by copying more data than I >> asked for). > > Ah, obvious problem. > > Do you want to fix it or should I take a look? You wanted to add write > support as well anyway IIRC. Yup, I can tackle this this afternoon. I'll take your read only patch and make it do both read/write (and fix the minor error). Tom