The problem didn't let me rest and I believe I have found a solution. I need to use virt_to_page instead of vmalloc_to_page in order to find consistent pages in drm_vm_shm_nopage. I still don't understand how agpAlloc made vmalloc_to_page work.
If no one objects I'll commit the attached patch after sleeping over it. Good night, Felix Am Mittwoch, den 12.01.2005, 01:26 +0100 schrieb Felix K�hling: > Hi, > > I need some help with _DRM_CONSISTENT maps. They worked fine with the > AGP cards I've been testing so far. This weekend I added PCI support to > the Savage driver and found out that with PCI cards the _DRM_CONSISTENT > maps don't work. Either the status page is mapped somehow incorrectly, > so that the Xserver doesn't see hardware status updates. Or the Xserver > is killed and I see a message in the kernel log: > > VM: killing process Xorg > > I've narrowed it down using an AGP card a little. I disabled AGP > textures and AGP DMA buffers. Then I removed the call to drmAgpBind in > the Xserver and it still worked. The map stopped working when I also > omitted the call to drmAgpAlloc. The other thing I checked is that it > does not make a difference whether I use drm_pci_alloc or > drm_alloc_pages to allocate the pages. > > I know it must be possible to reliably map consistent pages into user > processes. I think I just need to get the vm_operations in drm_vm.c > right for these maps. But I have no clue how to do this. I'd be grateful > for any comments that get me on the right track. > > Thanks, > Felix > -- | Felix K�hling <[EMAIL PROTECTED]> http://fxk.de.vu | | PGP Fingerprint: 6A3C 9566 5B30 DDED 73C3 B152 151C 5CC1 D888 E595 |
--- ./drm_vm.c.~1.48.~ 2004-12-30 15:59:53.000000000 +0100 +++ ./drm_vm.c 2005-01-12 03:39:29.000000000 +0100 @@ -151,7 +151,8 @@ offset = address - vma->vm_start; i = (unsigned long)map->handle + offset; - page = vmalloc_to_page((void *)i); + page = (map->type == _DRM_CONSISTENT) ? + virt_to_page((void *)i) : vmalloc_to_page((void *)i); if (!page) return NOPAGE_OOM; get_page(page); @@ -663,8 +664,9 @@ break; case _DRM_SHM: case _DRM_CONSISTENT: - /* Consistent memory is really like shared memory. It's only - * allocated in a different way. */ + /* Consistent memory is much like shared memory. The + * only difference is that drm_vm_shm_nopage must use + * virt_to_page instead of vmalloc_to_page. */ vma->vm_ops = &drm_vm_shm_ops; vma->vm_private_data = (void *)map; /* Don't let this area swap. Change when
