Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 06 Jul 2007 10:55:21 -0400
From:      Michael Butler <imb@protected-networks.net>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        stable@freebsd.org, freebsd-current@freebsd.org, x11@freebsd.org
Subject:   Re: xorg 7.2 locks system in current
Message-ID:  <468E57D9.20406@protected-networks.net>
In-Reply-To: <20070706095113.GD2200@deviant.kiev.zoral.com.ua>
References:  <468DC8BB.307@micom.mng.net> <20070706095113.GD2200@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kostik Belousov wrote:
> [Redirecting to x11@ as more appropriate]
>
> 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 ?

This appears to be equally applicable to 6-stable. I've had random
lock-ups with an i945GM and which, on initial and brief testing, appear
to be gone using this patch,

	Michael


> 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 = drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 
> +	    0xffffffff);
> +	if (!dmah) {
> +		dev->dev_private = (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 = dmah;
>  
>  	DRM_GETSAREA();
>  	if (!dev_priv->sarea) {
> @@ -181,15 +196,6 @@ static int i915_initialize(drm_device_t * dev,
>  	dev_priv->allow_batchbuffer = 1;
>  
>  	/* Program Hardware Status Page */
> -	dev_priv->status_page_dmah = drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 
> -	    0xffffffff);
> -
> -	if (!dev_priv->status_page_dmah) {
> -		dev->dev_private = (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 = dev_priv->status_page_dmah->vaddr;
>  	dev_priv->dma_status_page = dev_priv->status_page_dmah->busaddr;
>  	

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

iD4DBQFGjlfZQv9rrgRC1JIRAnKKAJjho4IxKKbkckbFHJWXkU0eXB48AJ9pcxI/
fCAdV0vMyddsC2WfFKN9Vg==
=5hrb
-----END PGP SIGNATURE-----



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