rpms/kernel/devel linux-2.6-drm-git-mm-revert-nopfn.patch, NONE, 1.1 kernel.spec, 1.465, 1.466

Dave Airlie (airlied) fedora-extras-commits at redhat.com
Mon Mar 3 03:34:54 UTC 2008


Author: airlied

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv9856

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-drm-git-mm-revert-nopfn.patch 
Log Message:
* Mon Mar 03 2008 Dave Airlie <airlied at redhat.com>
- drm: revert nopfn->fault conversion to fix oops on intel


linux-2.6-drm-git-mm-revert-nopfn.patch:

--- NEW FILE linux-2.6-drm-git-mm-revert-nopfn.patch ---
commit 4825484968daa23b3a55446c5f40f4d35fb6ff21
Author: Dave Airlie <airlied at dhcp-64-219.bne.redhat.com>
Date:   Mon Mar 3 13:29:52 2008 +1000

    Revert "drm:  reimplement nopfn callers with fault"
    
    This reverts commit ae0bdbd7e1d02e978323640256125f8a5391510a.

diff --git a/drivers/char/drm/drm_vm.c b/drivers/char/drm/drm_vm.c
index 6184b98..3cd0b1c 100644
--- a/drivers/char/drm/drm_vm.c
+++ b/drivers/char/drm/drm_vm.c
@@ -679,8 +679,8 @@ EXPORT_SYMBOL(drm_mmap);
  * \c Pagefault method for buffer objects.
  *
  * \param vma Virtual memory area.
- * \param vmf vm fault data
- * \return Error or VM_FAULT_NOPAGE: the pfn is manually inserted.
+ * \param address File offset.
+ * \return Error or refault. The pfn is manually inserted.
  *
  * It's important that pfns are inserted while holding the bo->mutex lock.
  * otherwise we might race with unmap_mapping_range() which is always
@@ -692,7 +692,8 @@ EXPORT_SYMBOL(drm_mmap);
  * protected by the bo->mutex lock.
  */
 
-static int drm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
+static unsigned long drm_bo_vm_nopfn(struct vm_area_struct *vma,
+				     unsigned long address)
 {
 	struct drm_buffer_object *bo = (struct drm_buffer_object *) vma->vm_private_data;
 	unsigned long page_offset;
@@ -704,22 +705,25 @@ static int drm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 	unsigned long bus_base;
 	unsigned long bus_offset;
 	unsigned long bus_size;
-	unsigned long ret = VM_FAULT_NOPAGE;
+	unsigned long ret = NOPFN_REFAULT;
+
+	if (address > vma->vm_end)
+		return NOPFN_SIGBUS;
 
 	dev = bo->dev;
 	err = drm_bo_read_lock(&dev->bm.bm_lock);
 	if (err)
-		return VM_FAULT_NOPAGE;
+		return NOPFN_REFAULT;
 
 	err = mutex_lock_interruptible(&bo->mutex);
 	if (err) {
 		drm_bo_read_unlock(&dev->bm.bm_lock);
-		return VM_FAULT_NOPAGE;
+		return NOPFN_REFAULT;
 	}
 
 	err = drm_bo_wait(bo, 0, 0, 0);
 	if (err) {
-		ret = (err != -EAGAIN) ? VM_FAULT_SIGBUS : VM_FAULT_NOPAGE;
+		ret = (err != -EAGAIN) ? NOPFN_SIGBUS : NOPFN_REFAULT;
 		goto out_unlock;
 	}
 
@@ -734,7 +738,7 @@ static int drm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 			DRM_BO_FLAG_FORCE_MAPPABLE;
 		err = drm_bo_move_buffer(bo, new_flags, 0, 0);
 		if (err) {
-			ret = (err != -EAGAIN) ? VM_FAULT_SIGBUS : VM_FAULT_NOPAGE;
+			ret = (err != -EAGAIN) ? NOPFN_SIGBUS : NOPFN_REFAULT;
 			goto out_unlock;
 		}
 	}
@@ -743,12 +747,11 @@ static int drm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 				&bus_size);
 
 	if (err) {
-		ret = VM_FAULT_SIGBUS;
+		ret = NOPFN_SIGBUS;
 		goto out_unlock;
 	}
 
-	/* XXX: vmf->pgoff may work here, but it adds on vma->vm_pgoff */
-	page_offset = ((unsigned long)vmf->virtual_address - vma->vm_start) >> PAGE_SHIFT;
+	page_offset = (address - vma->vm_start) >> PAGE_SHIFT;
 
 	if (bus_size) {
 		struct drm_mem_type_manager *man = &dev->bm.man[bo->mem.mem_type];
@@ -761,7 +764,7 @@ static int drm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 		drm_ttm_fixup_caching(ttm);
 		page = drm_ttm_get_page(ttm, page_offset);
 		if (!page) {
-			ret = VM_FAULT_OOM;
+			ret = NOPFN_OOM;
 			goto out_unlock;
 		}
 		pfn = page_to_pfn(page);
@@ -770,9 +773,9 @@ static int drm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 			drm_io_prot(_DRM_TTM, vma);
 	}
 
-	err = vm_insert_pfn(vma, (unsigned long)vmf->virtual_address, pfn);
+	err = vm_insert_pfn(vma, address, pfn);
 	if (err) {
-		ret = (err != -EAGAIN) ? VM_FAULT_OOM : VM_FAULT_NOPAGE;
+		ret = (err != -EAGAIN) ? NOPFN_OOM : NOPFN_REFAULT;
 		goto out_unlock;
 	}
 out_unlock:
@@ -827,7 +830,7 @@ static void drm_bo_vm_close(struct vm_area_struct *vma)
 }
 
 static struct vm_operations_struct drm_bo_vm_ops = {
-	.fault = drm_bo_vm_fault,
+	.nopfn = drm_bo_vm_nopfn,
 	.open = drm_bo_vm_open,
 	.close = drm_bo_vm_close,
 };


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.465
retrieving revision 1.466
diff -u -r1.465 -r1.466
--- kernel.spec	2 Mar 2008 05:08:48 -0000	1.465
+++ kernel.spec	3 Mar 2008 03:34:19 -0000	1.466
@@ -619,6 +619,7 @@
 Patch1801: linux-2.6-drm-git-mm.patch
 Patch1802: linux-2.6-ppc32-ucmpdi2.patch
 Patch1803: nouveau-drm.patch
+Patch1804: linux-2.6-drm-git-mm-revert-nopfn.patch
 
 # kludge to make ich9 e1000 work
 Patch2000: linux-2.6-e1000-ich9.patch
@@ -1133,6 +1134,7 @@
 ApplyPatch linux-2.6-drm-git-mm.patch
 ApplyPatch linux-2.6-ppc32-ucmpdi2.patch
 ApplyPatch nouveau-drm.patch
+ApplyPatch linux-2.6-drm-git-mm-revert-nopfn.patch
 
 # ext4dev stable patch queue, slated for 2.6.25
 #ApplyPatch linux-2.6-ext4-stable-queue.patch
@@ -1736,7 +1738,10 @@
 %kernel_variant_files -a /%{image_install_path}/xen*-%{KVERREL} -e /etc/ld.so.conf.d/kernelcap-%{KVERREL}.conf %{with_xen} xen
 
 %changelog
-* Sun Mar 01 2008 Jarod Wilson <jwilson at redhat.com>
+* Mon Mar 03 2008 Dave Airlie <airlied at redhat.com>
+- drm: revert nopfn->fault conversion to fix oops on intel
+
+* Sat Mar 01 2008 Jarod Wilson <jwilson at redhat.com>
 - firewire: fix suspend/resume on older PowerPC Macs (#312871)
 - firewire: support for first-gen Apple UniNorth controller
 - firewire: add option for remote debugging




More information about the fedora-extras-commits mailing list