Re: [patch 1/3] drm: nopage
> Well they're all gone.. ;) > > There is a nopfn method which I converted in a subsequent patch I sent you. > Maybe that's what you mean? > Ah thats what it was, we added a nopfn not a nopage.. Thanks, Dave. > Thanks, > Nick > > > > Dave. > > > > > > > > Anyway, please apply. > > > > > > -- > > > > > > drm: nopage > > > > > > Convert drm from nopage to fault. > > > Remove redundant vma range checks. > > > > > > Signed-off-by: Nick Piggin <[EMAIL PROTECTED]> > > > Cc: [EMAIL PROTECTED] > > > Cc: linux-kernel@vger.kernel.org > > > --- > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 1/3] drm: nopage
On Tue, Jan 08, 2008 at 10:25:15PM +, Dave Airlie wrote: > > > > Dave, this patch is against 2.6.24-rc6-mm1. You said git-drm had rewritten > > this area, > > but the patch didn't have any rejects and seems to run fine here (although > > I'm not > > exactly sure how to exercise drm too well). > > Hi Nick, > > there should be a new nopage method added though which you need to > convert.. Well they're all gone.. ;) There is a nopfn method which I converted in a subsequent patch I sent you. Maybe that's what you mean? Thanks, Nick > > Dave. > > > > > Anyway, please apply. > > > > -- > > > > drm: nopage > > > > Convert drm from nopage to fault. > > Remove redundant vma range checks. > > > > Signed-off-by: Nick Piggin <[EMAIL PROTECTED]> > > Cc: [EMAIL PROTECTED] > > Cc: linux-kernel@vger.kernel.org > > --- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 1/3] drm: nopage
> Dave, this patch is against 2.6.24-rc6-mm1. You said git-drm had rewritten > this area, > but the patch didn't have any rejects and seems to run fine here (although > I'm not > exactly sure how to exercise drm too well). Hi Nick, there should be a new nopage method added though which you need to convert.. Dave. > > Anyway, please apply. > > -- > > drm: nopage > > Convert drm from nopage to fault. > Remove redundant vma range checks. > > Signed-off-by: Nick Piggin <[EMAIL PROTECTED]> > Cc: [EMAIL PROTECTED] > Cc: linux-kernel@vger.kernel.org > --- > drivers/char/drm/drm_vm.c | 131 > +- > 1 file changed, 61 insertions(+), 70 deletions(-) > > Index: linux-2.6/drivers/char/drm/drm_vm.c > === > --- linux-2.6.orig/drivers/char/drm/drm_vm.c > +++ linux-2.6/drivers/char/drm/drm_vm.c > @@ -70,7 +70,7 @@ static pgprot_t drm_io_prot(uint32_t map > } > > /** > - * \c nopage method for AGP virtual memory. > + * \c fault method for AGP virtual memory. > * > * \param vma virtual memory area. > * \param address access address. > @@ -80,8 +80,8 @@ static pgprot_t drm_io_prot(uint32_t map > * map, get the page, increment the use count and return it. > */ > #if __OS_HAS_AGP > -static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, > - unsigned long address) > +static __inline__ int drm_do_vm_fault(struct vm_area_struct *vma, > + struct vm_fault *vmf) > { > struct drm_file *priv = vma->vm_file->private_data; > struct drm_device *dev = priv->head->dev; > @@ -93,19 +93,24 @@ static __inline__ struct page *drm_do_vm >* Find the right map >*/ > if (!drm_core_has_AGP(dev)) > - goto vm_nopage_error; > + goto vm_fault_error; > > if (!dev->agp || !dev->agp->cant_use_aperture) > - goto vm_nopage_error; > + goto vm_fault_error; > > if (drm_ht_find_item(>map_hash, vma->vm_pgoff, )) > - goto vm_nopage_error; > + goto vm_fault_error; > > r_list = drm_hash_entry(hash, struct drm_map_list, hash); > map = r_list->map; > > if (map && map->type == _DRM_AGP) { > - unsigned long offset = address - vma->vm_start; > + /* > + * Using vm_pgoff as a selector forces us to use this unusual > + * addressing scheme. > + */ > + unsigned long offset = (unsigned long)vmf->virtual_address - > + vma->vm_start; > unsigned long baddr = map->offset + offset; > struct drm_agp_mem *agpmem; > struct page *page; > @@ -127,7 +132,7 @@ static __inline__ struct page *drm_do_vm > } > > if (!agpmem) > - goto vm_nopage_error; > + goto vm_fault_error; > > /* >* Get the page, inc the use count, and return it > @@ -135,27 +140,28 @@ static __inline__ struct page *drm_do_vm > offset = (baddr - agpmem->bound) >> PAGE_SHIFT; > page = virt_to_page(__va(agpmem->memory->memory[offset])); > get_page(page); > + vmf->page = page; > > DRM_DEBUG > ("baddr = 0x%lx page = 0x%p, offset = 0x%lx, count=%d\n", >baddr, __va(agpmem->memory->memory[offset]), offset, >page_count(page)); > > - return page; > + return 0; > } > - vm_nopage_error: > - return NOPAGE_SIGBUS; /* Disallow mremap */ > + vm_fault_error: > + return VM_FAULT_SIGBUS; /* Disallow mremap */ > } > #else/* __OS_HAS_AGP */ > -static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, > - unsigned long address) > +static __inline__ int drm_do_vm_fault(struct vm_area_struct *vma, > + struct vm_fault *vmf) > { > - return NOPAGE_SIGBUS; > + return VM_FAULT_SIGBUS; > } > #endif /* __OS_HAS_AGP */ > > /** > - * \c nopage method for shared virtual memory. > + * \c fault method for shared virtual memory. > * > * \param vma virtual memory area. > * \param address access address. > @@ -164,28 +170,27 @@ static __inline__ struct page *drm_do_vm > * Get the mapping, find the real physical page to map, get the page, and > * return it. > */ > -static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct > *vma, > - unsigned long address) > +static __inline__ int drm_do_vm_shm_fault(struct vm_area_struct *vma, > +
[patch 1/3] drm: nopage
Dave, this patch is against 2.6.24-rc6-mm1. You said git-drm had rewritten this area, but the patch didn't have any rejects and seems to run fine here (although I'm not exactly sure how to exercise drm too well). Anyway, please apply. -- drm: nopage Convert drm from nopage to fault. Remove redundant vma range checks. Signed-off-by: Nick Piggin <[EMAIL PROTECTED]> Cc: [EMAIL PROTECTED] Cc: linux-kernel@vger.kernel.org --- drivers/char/drm/drm_vm.c | 131 +- 1 file changed, 61 insertions(+), 70 deletions(-) Index: linux-2.6/drivers/char/drm/drm_vm.c === --- linux-2.6.orig/drivers/char/drm/drm_vm.c +++ linux-2.6/drivers/char/drm/drm_vm.c @@ -70,7 +70,7 @@ static pgprot_t drm_io_prot(uint32_t map } /** - * \c nopage method for AGP virtual memory. + * \c fault method for AGP virtual memory. * * \param vma virtual memory area. * \param address access address. @@ -80,8 +80,8 @@ static pgprot_t drm_io_prot(uint32_t map * map, get the page, increment the use count and return it. */ #if __OS_HAS_AGP -static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, - unsigned long address) +static __inline__ int drm_do_vm_fault(struct vm_area_struct *vma, + struct vm_fault *vmf) { struct drm_file *priv = vma->vm_file->private_data; struct drm_device *dev = priv->head->dev; @@ -93,19 +93,24 @@ static __inline__ struct page *drm_do_vm * Find the right map */ if (!drm_core_has_AGP(dev)) - goto vm_nopage_error; + goto vm_fault_error; if (!dev->agp || !dev->agp->cant_use_aperture) - goto vm_nopage_error; + goto vm_fault_error; if (drm_ht_find_item(>map_hash, vma->vm_pgoff, )) - goto vm_nopage_error; + goto vm_fault_error; r_list = drm_hash_entry(hash, struct drm_map_list, hash); map = r_list->map; if (map && map->type == _DRM_AGP) { - unsigned long offset = address - vma->vm_start; + /* +* Using vm_pgoff as a selector forces us to use this unusual +* addressing scheme. +*/ + unsigned long offset = (unsigned long)vmf->virtual_address - + vma->vm_start; unsigned long baddr = map->offset + offset; struct drm_agp_mem *agpmem; struct page *page; @@ -127,7 +132,7 @@ static __inline__ struct page *drm_do_vm } if (!agpmem) - goto vm_nopage_error; + goto vm_fault_error; /* * Get the page, inc the use count, and return it @@ -135,27 +140,28 @@ static __inline__ struct page *drm_do_vm offset = (baddr - agpmem->bound) >> PAGE_SHIFT; page = virt_to_page(__va(agpmem->memory->memory[offset])); get_page(page); + vmf->page = page; DRM_DEBUG ("baddr = 0x%lx page = 0x%p, offset = 0x%lx, count=%d\n", baddr, __va(agpmem->memory->memory[offset]), offset, page_count(page)); - return page; + return 0; } - vm_nopage_error: - return NOPAGE_SIGBUS; /* Disallow mremap */ + vm_fault_error: + return VM_FAULT_SIGBUS; /* Disallow mremap */ } #else /* __OS_HAS_AGP */ -static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, - unsigned long address) +static __inline__ int drm_do_vm_fault(struct vm_area_struct *vma, + struct vm_fault *vmf) { - return NOPAGE_SIGBUS; + return VM_FAULT_SIGBUS; } #endif /* __OS_HAS_AGP */ /** - * \c nopage method for shared virtual memory. + * \c fault method for shared virtual memory. * * \param vma virtual memory area. * \param address access address. @@ -164,28 +170,27 @@ static __inline__ struct page *drm_do_vm * Get the mapping, find the real physical page to map, get the page, and * return it. */ -static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma, - unsigned long address) +static __inline__ int drm_do_vm_shm_fault(struct vm_area_struct *vma, + struct vm_fault *vmf) { struct drm_map *map = (struct drm_map *) vma->vm_private_data; unsigned long offset; unsigned long i; struct page *page; - if (address > vma->vm_end) - return NOPAGE_SIGBUS;
[patch 1/3] drm: nopage
Dave, this patch is against 2.6.24-rc6-mm1. You said git-drm had rewritten this area, but the patch didn't have any rejects and seems to run fine here (although I'm not exactly sure how to exercise drm too well). Anyway, please apply. -- drm: nopage Convert drm from nopage to fault. Remove redundant vma range checks. Signed-off-by: Nick Piggin [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Cc: linux-kernel@vger.kernel.org --- drivers/char/drm/drm_vm.c | 131 +- 1 file changed, 61 insertions(+), 70 deletions(-) Index: linux-2.6/drivers/char/drm/drm_vm.c === --- linux-2.6.orig/drivers/char/drm/drm_vm.c +++ linux-2.6/drivers/char/drm/drm_vm.c @@ -70,7 +70,7 @@ static pgprot_t drm_io_prot(uint32_t map } /** - * \c nopage method for AGP virtual memory. + * \c fault method for AGP virtual memory. * * \param vma virtual memory area. * \param address access address. @@ -80,8 +80,8 @@ static pgprot_t drm_io_prot(uint32_t map * map, get the page, increment the use count and return it. */ #if __OS_HAS_AGP -static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, - unsigned long address) +static __inline__ int drm_do_vm_fault(struct vm_area_struct *vma, + struct vm_fault *vmf) { struct drm_file *priv = vma-vm_file-private_data; struct drm_device *dev = priv-head-dev; @@ -93,19 +93,24 @@ static __inline__ struct page *drm_do_vm * Find the right map */ if (!drm_core_has_AGP(dev)) - goto vm_nopage_error; + goto vm_fault_error; if (!dev-agp || !dev-agp-cant_use_aperture) - goto vm_nopage_error; + goto vm_fault_error; if (drm_ht_find_item(dev-map_hash, vma-vm_pgoff, hash)) - goto vm_nopage_error; + goto vm_fault_error; r_list = drm_hash_entry(hash, struct drm_map_list, hash); map = r_list-map; if (map map-type == _DRM_AGP) { - unsigned long offset = address - vma-vm_start; + /* +* Using vm_pgoff as a selector forces us to use this unusual +* addressing scheme. +*/ + unsigned long offset = (unsigned long)vmf-virtual_address - + vma-vm_start; unsigned long baddr = map-offset + offset; struct drm_agp_mem *agpmem; struct page *page; @@ -127,7 +132,7 @@ static __inline__ struct page *drm_do_vm } if (!agpmem) - goto vm_nopage_error; + goto vm_fault_error; /* * Get the page, inc the use count, and return it @@ -135,27 +140,28 @@ static __inline__ struct page *drm_do_vm offset = (baddr - agpmem-bound) PAGE_SHIFT; page = virt_to_page(__va(agpmem-memory-memory[offset])); get_page(page); + vmf-page = page; DRM_DEBUG (baddr = 0x%lx page = 0x%p, offset = 0x%lx, count=%d\n, baddr, __va(agpmem-memory-memory[offset]), offset, page_count(page)); - return page; + return 0; } - vm_nopage_error: - return NOPAGE_SIGBUS; /* Disallow mremap */ + vm_fault_error: + return VM_FAULT_SIGBUS; /* Disallow mremap */ } #else /* __OS_HAS_AGP */ -static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, - unsigned long address) +static __inline__ int drm_do_vm_fault(struct vm_area_struct *vma, + struct vm_fault *vmf) { - return NOPAGE_SIGBUS; + return VM_FAULT_SIGBUS; } #endif /* __OS_HAS_AGP */ /** - * \c nopage method for shared virtual memory. + * \c fault method for shared virtual memory. * * \param vma virtual memory area. * \param address access address. @@ -164,28 +170,27 @@ static __inline__ struct page *drm_do_vm * Get the mapping, find the real physical page to map, get the page, and * return it. */ -static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma, - unsigned long address) +static __inline__ int drm_do_vm_shm_fault(struct vm_area_struct *vma, + struct vm_fault *vmf) { struct drm_map *map = (struct drm_map *) vma-vm_private_data; unsigned long offset; unsigned long i; struct page *page; - if (address vma-vm_end) - return NOPAGE_SIGBUS; /* Disallow mremap */
Re: [patch 1/3] drm: nopage
On Tue, Jan 08, 2008 at 10:25:15PM +, Dave Airlie wrote: Dave, this patch is against 2.6.24-rc6-mm1. You said git-drm had rewritten this area, but the patch didn't have any rejects and seems to run fine here (although I'm not exactly sure how to exercise drm too well). Hi Nick, there should be a new nopage method added though which you need to convert.. Well they're all gone.. ;) There is a nopfn method which I converted in a subsequent patch I sent you. Maybe that's what you mean? Thanks, Nick Dave. Anyway, please apply. -- drm: nopage Convert drm from nopage to fault. Remove redundant vma range checks. Signed-off-by: Nick Piggin [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Cc: linux-kernel@vger.kernel.org --- -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 1/3] drm: nopage
Well they're all gone.. ;) There is a nopfn method which I converted in a subsequent patch I sent you. Maybe that's what you mean? Ah thats what it was, we added a nopfn not a nopage.. Thanks, Dave. Thanks, Nick Dave. Anyway, please apply. -- drm: nopage Convert drm from nopage to fault. Remove redundant vma range checks. Signed-off-by: Nick Piggin [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Cc: linux-kernel@vger.kernel.org --- -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 1/3] drm: nopage
Dave, this patch is against 2.6.24-rc6-mm1. You said git-drm had rewritten this area, but the patch didn't have any rejects and seems to run fine here (although I'm not exactly sure how to exercise drm too well). Hi Nick, there should be a new nopage method added though which you need to convert.. Dave. Anyway, please apply. -- drm: nopage Convert drm from nopage to fault. Remove redundant vma range checks. Signed-off-by: Nick Piggin [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Cc: linux-kernel@vger.kernel.org --- drivers/char/drm/drm_vm.c | 131 +- 1 file changed, 61 insertions(+), 70 deletions(-) Index: linux-2.6/drivers/char/drm/drm_vm.c === --- linux-2.6.orig/drivers/char/drm/drm_vm.c +++ linux-2.6/drivers/char/drm/drm_vm.c @@ -70,7 +70,7 @@ static pgprot_t drm_io_prot(uint32_t map } /** - * \c nopage method for AGP virtual memory. + * \c fault method for AGP virtual memory. * * \param vma virtual memory area. * \param address access address. @@ -80,8 +80,8 @@ static pgprot_t drm_io_prot(uint32_t map * map, get the page, increment the use count and return it. */ #if __OS_HAS_AGP -static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, - unsigned long address) +static __inline__ int drm_do_vm_fault(struct vm_area_struct *vma, + struct vm_fault *vmf) { struct drm_file *priv = vma-vm_file-private_data; struct drm_device *dev = priv-head-dev; @@ -93,19 +93,24 @@ static __inline__ struct page *drm_do_vm * Find the right map */ if (!drm_core_has_AGP(dev)) - goto vm_nopage_error; + goto vm_fault_error; if (!dev-agp || !dev-agp-cant_use_aperture) - goto vm_nopage_error; + goto vm_fault_error; if (drm_ht_find_item(dev-map_hash, vma-vm_pgoff, hash)) - goto vm_nopage_error; + goto vm_fault_error; r_list = drm_hash_entry(hash, struct drm_map_list, hash); map = r_list-map; if (map map-type == _DRM_AGP) { - unsigned long offset = address - vma-vm_start; + /* + * Using vm_pgoff as a selector forces us to use this unusual + * addressing scheme. + */ + unsigned long offset = (unsigned long)vmf-virtual_address - + vma-vm_start; unsigned long baddr = map-offset + offset; struct drm_agp_mem *agpmem; struct page *page; @@ -127,7 +132,7 @@ static __inline__ struct page *drm_do_vm } if (!agpmem) - goto vm_nopage_error; + goto vm_fault_error; /* * Get the page, inc the use count, and return it @@ -135,27 +140,28 @@ static __inline__ struct page *drm_do_vm offset = (baddr - agpmem-bound) PAGE_SHIFT; page = virt_to_page(__va(agpmem-memory-memory[offset])); get_page(page); + vmf-page = page; DRM_DEBUG (baddr = 0x%lx page = 0x%p, offset = 0x%lx, count=%d\n, baddr, __va(agpmem-memory-memory[offset]), offset, page_count(page)); - return page; + return 0; } - vm_nopage_error: - return NOPAGE_SIGBUS; /* Disallow mremap */ + vm_fault_error: + return VM_FAULT_SIGBUS; /* Disallow mremap */ } #else/* __OS_HAS_AGP */ -static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, - unsigned long address) +static __inline__ int drm_do_vm_fault(struct vm_area_struct *vma, + struct vm_fault *vmf) { - return NOPAGE_SIGBUS; + return VM_FAULT_SIGBUS; } #endif /* __OS_HAS_AGP */ /** - * \c nopage method for shared virtual memory. + * \c fault method for shared virtual memory. * * \param vma virtual memory area. * \param address access address. @@ -164,28 +170,27 @@ static __inline__ struct page *drm_do_vm * Get the mapping, find the real physical page to map, get the page, and * return it. */ -static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma, - unsigned long address) +static __inline__ int drm_do_vm_shm_fault(struct vm_area_struct *vma, + struct vm_fault *vmf) { struct drm_map *map = (struct drm_map *) vma-vm_private_data; unsigned long offset; unsigned