Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Jul 2007 12:51:13 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Ganbold <ganbold@micom.mng.net>
Cc:        freebsd-current@freebsd.org
Subject:   Re: xorg 7.2 locks system in current
Message-ID:  <20070706095113.GD2200@deviant.kiev.zoral.com.ua>
In-Reply-To: <468DC8BB.307@micom.mng.net>
References:  <468DC8BB.307@micom.mng.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--8p/3hdGJBHAENZPK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

[Redirecting to x11@ as more appropriate]

On Fri, Jul 06, 2007 at 12:44:43PM +0800, Ganbold wrote:
> Hi,
>=20
> I have todays CURRENT. My machine is Dell Latitude D620 with 945GM=20
> graphics card.
> When I try to run xorg 7.2, my machine hangs and on serial console it=20
> showed:
>=20
> uma_zalloc_arg: zone "64" with the following non-sleepable locks held:
> exclusive sleep mutex drm device r =3D 0 (0xc3c06cd8) locked @=20
> /usr/src/sys/modules/drm/drm/../../../dev/drm/drm_drv.c:907
> KDB: enter: witness_warn
> [thread pid 739 tid 100092 ]
> Stopped at      kdb_enter+0x32: leave
> db> bt
> Tracing pid 739 tid 100092 td 0xc3fe2220
> kdb_enter(c086100b,e63ea9fc,4,1,0,...) at kdb_enter+0x32
> witness_warn(5,0,c08bd9fe,c08a71b1,66666666,...) at witness_warn+0x1b9
> uma_zalloc_arg(c1072d20,0,102,2,c09d9d64,...) at uma_zalloc_arg+0x34
> malloc(2c,c093d0c0,102,12,c4325db0,...) at malloc+0xd2
> sysctl_add_oid(c4325dcc,c09d9d64,ffffffff,c4325db0,80000001,...) at=20
> sysctl_add_oid+0x95
> alloc_bounce_zone(44,c09399e0,101,1000,c3c8ec80,...) at=20
> alloc_bounce_zone+0x16d
> bus_dma_tag_create(0,1000,0,ffffffff,ffffffff,...) at=20
> bus_dma_tag_create+0x1a9
> drm_pci_alloc(c3c06c00,1000,1000,ffffffff,20000,...) at drm_pci_alloc+0xe1
> i915_dma_init(c3bf3800,80446440,c4325e80,3,c3fe2220,...) at=20
> i915_dma_init+0x2b8
> drm_ioctl(c3bf3800,80446440,c4325e80,3,c3fe2220,...) at drm_ioctl+0x357
> giant_ioctl(c3bf3800,80446440,c4325e80,3,c3fe2220,...) at giant_ioctl+0x56
> devfs_ioctl_f(c3e70048,80446440,c4325e80,c405c500,c3fe2220,...) at=20
> devfs_ioctl_f+0xc9
> kern_ioctl(c3fe2220,8,80446440,c4325e80,0,...) at kern_ioctl+0x243
> ioctl(c3fe2220,e63eacfc,c,c089e511,c0935830,...) at ioctl+0x134
> syscall(e63ead38) at syscall+0x2b3
> Xint0x80_syscall() at Xint0x80_syscall+0x20
> --- syscall (54, FreeBSD ELF32, ioctl), eip =3D 0x483decc3, esp =3D=20
> 0xbfbfea5c, ebp =3D 0xbfbfea78 ---
> db>
> db> c
> uma_zalloc_arg: zone "16" with the following non-sleepable locks held:
> exclusive sleep mutex drm device r =3D 0 (0xc3c06cd8) locked @=20
> /usr/src/sys/modules/drm/drm/../../../dev/drm/drm_drv.c:907
> KDB: enter: witness_warn
> [thread pid 739 tid 100092 ]
> Stopped at      kdb_enter+0x32: leave
> db>
>=20
> thanks,
>=20
> Ganbold

Man page states explicitely that bus_dma_tag_create() (as well as
bus_dmamem_alloc()) shall not be called with non-sleepable lock held.
I am not completely sure, but it seems to be safe to drop the drm
lock around drm_pci_alloc() when the later moved to the start of the
i915_initialize().

Could you, please, test the patch below ?

diff --git a/sys/dev/drm/i915_dma.c b/sys/dev/drm/i915_dma.c
index 1d1877b..118d160 100644
--- a/sys/dev/drm/i915_dma.c
+++ b/sys/dev/drm/i915_dma.c
@@ -122,7 +122,22 @@ static int i915_initialize(drm_device_t * dev,
 			   drm_i915_private_t * dev_priv,
 			   drm_i915_init_t * init)
 {
+	drm_dma_handle_t *dmah;
+
+	DRM_UNLOCK();
+	dmah =3D drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE,=20
+	    0xffffffff);
+	if (!dmah) {
+		dev->dev_private =3D (void *)dev_priv;
+		i915_dma_cleanup(dev);
+		DRM_ERROR("Can not allocate hardware status page\n");
+		DRM_LOCK();
+		return DRM_ERR(ENOMEM);
+	}
+	DRM_LOCK();
+
 	memset(dev_priv, 0, sizeof(drm_i915_private_t));
+	dev_priv->status_page_dmah =3D dmah;
=20
 	DRM_GETSAREA();
 	if (!dev_priv->sarea) {
@@ -181,15 +196,6 @@ static int i915_initialize(drm_device_t * dev,
 	dev_priv->allow_batchbuffer =3D 1;
=20
 	/* Program Hardware Status Page */
-	dev_priv->status_page_dmah =3D drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE,=
=20
-	    0xffffffff);
-
-	if (!dev_priv->status_page_dmah) {
-		dev->dev_private =3D (void *)dev_priv;
-		i915_dma_cleanup(dev);
-		DRM_ERROR("Can not allocate hardware status page\n");
-		return DRM_ERR(ENOMEM);
-	}
 	dev_priv->hw_status_page =3D dev_priv->status_page_dmah->vaddr;
 	dev_priv->dma_status_page =3D dev_priv->status_page_dmah->busaddr;
 =09

--8p/3hdGJBHAENZPK
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (FreeBSD)

iD8DBQFGjhCQC3+MBN1Mb4gRAu1lAKCeLLHpsIpz2oIqeaMJxj3mpV29FgCg6+Hf
EXC1PoCuIv6K59Y7CVB74cY=
=Fm4F
-----END PGP SIGNATURE-----

--8p/3hdGJBHAENZPK--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070706095113.GD2200>