Date: Mon, 2 Jun 2008 21:23:02 +0300 From: Kostik Belousov <kostikbel@gmail.com> To: Michiel Boland <michiel@boland.org> Cc: freebsd-current@freebsd.org Subject: Re: hard hang with intel video driver Message-ID: <20080602182302.GN63348@deviant.kiev.zoral.com.ua> In-Reply-To: <Pine.GSO.4.64.0806021817570.24865@neerbosch.nijmegen.internl.net> References: <Pine.GSO.4.64.0806021817570.24865@neerbosch.nijmegen.internl.net>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] On Mon, Jun 02, 2008 at 06:32:45PM +0200, Michiel Boland wrote: > Hi. I'm not having much luck with the 'intel' video driver on i386 > -CURRENT. Whereas it would panic the box earlier when starting X (see > http://lists.freebsd.org/pipermail/freebsd-current/2008-February/082955.html > ), it now just completely hangs the machine. > > No DDB, nothing. > > FWIW hardware is a dell optiplex 756. Kernel is GENERIC with one added > option (BREAK_TO_DEBUGGER). Graphics card is reported as 'Q963/Q965 > Integrated Graphics Controller' by pciconf. > > The i810 driver works fine, but from what I gather from the xorg-drivers > port, this driver is being phased out in favour of the intel driver. Is > that correct? If so, then some work is needed somewhere. > > What can I do to debug this further? I can't poweroff/poweron this machine > remotely. :( There is a patch produced long time ago that might be relevant to the hang, may be not. diff --git a/sys/dev/drm/i915_dma.c b/sys/dev/drm/i915_dma.c index eadd9e7..7c9acab 100644 --- a/sys/dev/drm/i915_dma.c +++ b/sys/dev/drm/i915_dma.c @@ -367,20 +367,14 @@ static int i915_emit_cmds(drm_device_t * dev, int __user * buffer, int dwords) for (i = 0; i < dwords;) { int cmd, sz; - if (DRM_COPY_FROM_USER_UNCHECKED(&cmd, &buffer[i], sizeof(cmd))) { - - return DRM_ERR(EINVAL); - } + cmd = buffer[i]; if ((sz = validate_cmd(cmd)) == 0 || i + sz > dwords) return DRM_ERR(EINVAL); OUT_RING(cmd); while (++i, --sz) { - if (DRM_COPY_FROM_USER_UNCHECKED(&cmd, &buffer[i], - sizeof(cmd))) { - return DRM_ERR(EINVAL); - } + cmd = buffer[i]; OUT_RING(cmd); } } @@ -401,10 +395,7 @@ static int i915_emit_box(drm_device_t * dev, drm_clip_rect_t box; RING_LOCALS; - if (DRM_COPY_FROM_USER_UNCHECKED(&box, &boxes[i], sizeof(box))) { - return EFAULT; - } - + box = boxes[i]; if (box.y2 <= box.y1 || box.x2 <= box.x1 || box.y2 <= 0 || box.x2 <= 0) { DRM_ERROR("Bad box %d,%d..%d,%d\n", box.x1, box.y1, box.x2, box.y2); @@ -604,6 +595,7 @@ static int i915_batchbuffer(DRM_IOCTL_ARGS) drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *) dev_priv->sarea_priv; drm_i915_batchbuffer_t batch; + size_t cliplen; int ret; if (!dev_priv->allow_batchbuffer) { @@ -619,14 +611,25 @@ static int i915_batchbuffer(DRM_IOCTL_ARGS) LOCK_TEST_WITH_RETURN(dev, filp); + DRM_UNLOCK(); + cliplen = batch.num_cliprects * sizeof(drm_clip_rect_t); if (batch.num_cliprects && DRM_VERIFYAREA_READ(batch.cliprects, - batch.num_cliprects * - sizeof(drm_clip_rect_t))) + cliplen)) { + DRM_LOCK(); return DRM_ERR(EFAULT); - + } + ret = vslock(batch.cliprects, cliplen); + if (ret) { + DRM_ERROR("Fault wiring cliprects\n"); + DRM_LOCK(); + return DRM_ERR(EFAULT); + } + DRM_LOCK(); ret = i915_dispatch_batchbuffer(dev, &batch); - sarea_priv->last_dispatch = (int)hw_status[5]; + DRM_UNLOCK(); + vsunlock(batch.cliprects, cliplen); + DRM_LOCK(); return ret; } @@ -638,6 +641,7 @@ static int i915_cmdbuffer(DRM_IOCTL_ARGS) drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *) dev_priv->sarea_priv; drm_i915_cmdbuffer_t cmdbuf; + size_t cliplen; int ret; DRM_COPY_FROM_USER_IOCTL(cmdbuf, (drm_i915_cmdbuffer_t __user *) data, @@ -648,22 +652,38 @@ static int i915_cmdbuffer(DRM_IOCTL_ARGS) LOCK_TEST_WITH_RETURN(dev, filp); + DRM_UNLOCK(); + cliplen = cmdbuf.num_cliprects * sizeof(drm_clip_rect_t); if (cmdbuf.num_cliprects && - DRM_VERIFYAREA_READ(cmdbuf.cliprects, - cmdbuf.num_cliprects * - sizeof(drm_clip_rect_t))) { + DRM_VERIFYAREA_READ(cmdbuf.cliprects, cliplen)) { DRM_ERROR("Fault accessing cliprects\n"); + DRM_LOCK(); return DRM_ERR(EFAULT); } - - ret = i915_dispatch_cmdbuffer(dev, &cmdbuf); + ret = vslock(cmdbuf.cliprects, cliplen); if (ret) { - DRM_ERROR("i915_dispatch_cmdbuffer failed\n"); - return ret; + DRM_ERROR("Fault wiring cliprects\n"); + DRM_LOCK(); + return DRM_ERR(EFAULT); } - - sarea_priv->last_dispatch = (int)hw_status[5]; - return 0; + ret = vslock(cmdbuf.buf, cmdbuf.sz); + if (ret) { + vsunlock(cmdbuf.cliprects, cliplen); + DRM_ERROR("Fault wiring cmds\n"); + DRM_LOCK(); + return DRM_ERR(EFAULT); + } + DRM_LOCK(); + ret = i915_dispatch_cmdbuffer(dev, &cmdbuf); + if (ret == 0) + sarea_priv->last_dispatch = (int)hw_status[5]; + else + DRM_ERROR("i915_dispatch_cmdbuffer failed\n"); + DRM_UNLOCK(); + vsunlock(cmdbuf.buf, cmdbuf.sz); + vsunlock(cmdbuf.cliprects, cliplen); + DRM_LOCK(); + return (ret); } static int i915_do_cleanup_pageflip(drm_device_t * dev) [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkhEOoYACgkQC3+MBN1Mb4joXwCgyUCpmGFzEpYpFmOmydCGSjpH MTEAn0xpRNXe+ZKRU6y8IOpNssf9RspL =ii/a -----END PGP SIGNATURE-----help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080602182302.GN63348>
