Sun Jul 5 21:31:48 2015 UTC ()
Pull up following revision(s) (requested by chs in ticket #854):
	sys/external/bsd/drm2/dist/drm/i915/i915_gem.c: revision 1.31
fix Xorg coredumps that have started happening recently.
the problem is that we get a SIGALRM while we're sleeping during a page fault
on a mapping of a GEM object, and since we're sleeping interruptibly,
the GEM operation fails with EINTR.  this error is returned all the way back
through uvm_fault() to the trap handler, which responds to that error
by delivering a SIGSEGV.
fix this by doing like the linux version of the GEM fault handler and converting
EINTR into success, which results in delivering the original signal and
retrying the fault.


(snj)
diff -r1.14.2.8 -r1.14.2.9 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c

cvs diff -r1.14.2.8 -r1.14.2.9 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c 2015/04/23 07:31:17 1.14.2.8
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c 2015/07/05 21:31:48 1.14.2.9
@@ -1859,26 +1859,35 @@ i915_gem_fault(struct uvm_faultinfo *ufi @@ -1859,26 +1859,35 @@ i915_gem_fault(struct uvm_faultinfo *ufi
1859 /* XXX errno NetBSD->Linux */ 1859 /* XXX errno NetBSD->Linux */
1860 ret = -i915_udv_fault(ufi, vaddr, pps, npages, centeridx, access_type, 1860 ret = -i915_udv_fault(ufi, vaddr, pps, npages, centeridx, access_type,
1861 flags, 1861 flags,
1862 (dev_priv->gtt.mappable_base + i915_gem_obj_ggtt_offset(obj))); 1862 (dev_priv->gtt.mappable_base + i915_gem_obj_ggtt_offset(obj)));
1863unpin: 1863unpin:
1864 i915_gem_object_ggtt_unpin(obj); 1864 i915_gem_object_ggtt_unpin(obj);
1865unlock: 1865unlock:
1866 mutex_unlock(&dev->struct_mutex); 1866 mutex_unlock(&dev->struct_mutex);
1867out: 1867out:
1868 mutex_enter(uobj->vmobjlock); 1868 mutex_enter(uobj->vmobjlock);
1869 uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap, uobj); 1869 uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap, uobj);
1870 if (ret == -ERESTART) 1870 if (ret == -ERESTART)
1871 uvm_wait("i915flt"); 1871 uvm_wait("i915flt");
 1872
 1873 /*
 1874 * Remap EINTR to success, so that we return to userland.
 1875 * On the way out, we'll deliver the signal, and if the signal
 1876 * is not fatal then the user code which faulted will most likely
 1877 * fault again, and we'll come back here for another try.
 1878 */
 1879 if (ret == -EINTR)
 1880 ret = 0;
1872 /* XXX Deal with GPU hangs here... */ 1881 /* XXX Deal with GPU hangs here... */
1873 intel_runtime_pm_put(dev_priv); 1882 intel_runtime_pm_put(dev_priv);
1874 /* XXX errno Linux->NetBSD */ 1883 /* XXX errno Linux->NetBSD */
1875 return -ret; 1884 return -ret;
1876} 1885}
1877 1886
1878/* 1887/*
1879 * XXX i915_udv_fault is copypasta of udv_fault from uvm_device.c. 1888 * XXX i915_udv_fault is copypasta of udv_fault from uvm_device.c.
1880 * 1889 *
1881 * XXX pmap_enter_default instead of pmap_enter because of a problem 1890 * XXX pmap_enter_default instead of pmap_enter because of a problem
1882 * with using weak aliases in kernel modules or something. 1891 * with using weak aliases in kernel modules or something.
1883 */ 1892 */
1884int pmap_enter_default(pmap_t, vaddr_t, paddr_t, vm_prot_t, unsigned); 1893int pmap_enter_default(pmap_t, vaddr_t, paddr_t, vm_prot_t, unsigned);